You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Perhaps, in order not to overload the API, it is better to store in the generated class the original class type and just that.
It would be up to those who make use of the API to retrieve the attribute type. Being able to do something like this:
publicclassReflectionUtils {
publicstaticClass<?> getType(ObjectclassOrObject, StringattributeName) throwsNoSuchFieldException, SecurityException {
finalClass<?> clazz;
if (classOrObjectinstanceofClass) { // It's a classclazz = (Class<?>) classOrObject;
} else { // It is an objectclazz = classOrObject.getClass();
}
returnclazz.getDeclaredField(attributeName).getType();
}
}
Advantage: does not overload the API and the code above is a simple solution.
Disadvantage: If it is a batch call with thousands or millions of calls, it would be much faster if the type information was already available statically.
Currently, the BeanMetaInfo class stores only the attribute name. In some cases it would be interesting to know the attribute type as well.
The text was updated successfully, but these errors were encountered: