if(loadedEntity == null) {
return loadedValue;
}
String ident = property.getIdentification();
if(ident == null || ident.length() == 0) {
throw new ReportException("Incorrect ident for property:" + property.getAlias());
}
try {
StringTokenizer identTokenizer = new StringTokenizer(ident);
do {
String identchunk = identTokenizer.nextToken(".");
if(property instanceof QueryEntityMethod) {
loadedEntity = loadedEntity.getClass().getMethod(identchunk).invoke(loadedEntity);
} else if(property instanceof QueryEntityField) {
try {//try method
String prefix;
if(property.getCls().equals(Boolean.class)) {
prefix = "is";
} else {
prefix = "get";
}
String methodName = prefix + identchunk.substring(0, 1).toUpperCase()
+ identchunk.substring(1);
loadedEntity = loadedEntity.getClass().getMethod(methodName).invoke(loadedEntity);
} catch(MethodNotFoundException ex) {
loadedEntity = loadedEntity.getClass().getField(identchunk).get(loadedEntity);
}
} else {
throw new ReportException("Unknown property reference class:" + property.getClass());
}
} while(loadedEntity != null && identTokenizer.hasMoreTokens());
loadedValue = TypeConverter.getGenericValue(loadedEntity);
} catch (Exception ex) {
ex.printStackTrace();
throw new ReportException("Неизвестное свойство: '" + ident
+ "' в сущности " + loadedEntity.getClass().getSimpleName(), ex);
}
return loadedValue;
}