if (objects == null) {
return null;
}
// Pass 1: Quick check if class is in objects
for (int i = 0; i < objects.length; i++) {
Object object = objects[i];
if (cla.isInstance(object)) {
return object;
}
}
// Pass 2: check LogRelations
for (int i = 0; i < objects.length; i++) {
Object object = objects[i];
if (object instanceof LogRelation) {
LogRelation logRelation = (LogRelation)object;
Object answer = logRelation.queryForClass(cla);
if (answer != null) {
return answer;
}
}
}
return null;