Class ReflectionHelper
java.lang.Object
org.optaplanner.core.impl.domain.common.ReflectionHelper
Avoids the usage of Introspector to work on Android too.
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidassertGetterMethod(Method getterMethod, Class<? extends Annotation> annotationClass) static voidassertReadMethod(Method readMethod, Class<? extends Annotation> annotationClass) static Fieldstatic MethodgetGetterMethod(Class<?> containingClass, String propertyName) static StringgetGetterPropertyName(Member member) Returns the JavaBeans property name of the given member.static MethodgetSetterMethod(Class<?> containingClass, Class<?> propertyType, String propertyName) static MethodgetSetterMethod(Class<?> containingClass, String propertyName) static booleanstatic booleanhasGetterMethod(Class<?> containingClass, String propertyName) static booleanisGetterMethod(Method method) Checks whether the given method is a valid getter method according to the JavaBeans standard.static booleanstatic booleanstatic booleanisMethodOverwritten(Method parentMethod, Class<?> childClass) transformArrayToList(Object arrayObject)
-
Method Details
-
getGetterPropertyName
Returns the JavaBeans property name of the given member.- Parameters:
member- never null- Returns:
- null if the member is neither a field nor a getter method according to the JavaBeans standard
-
isGetterMethod
Checks whether the given method is a valid getter method according to the JavaBeans standard.- Parameters:
method- never null- Returns:
- true if the given method is a getter method
-
hasGetterMethod
- Parameters:
containingClass- never nullpropertyName- never null- Returns:
- true if that getter exists
-
getGetterMethod
- Parameters:
containingClass- never nullpropertyName- never null- Returns:
- sometimes null
-
hasField
- Parameters:
containingClass- never nullfieldName- never null- Returns:
- true if that field exists
-
getField
- Parameters:
containingClass- never nullfieldName- never null- Returns:
- sometimes null
-
getSetterMethod
public static Method getSetterMethod(Class<?> containingClass, Class<?> propertyType, String propertyName) - Parameters:
containingClass- never nullpropertyType- never nullpropertyName- never null- Returns:
- null if it doesn't exist
-
getSetterMethod
- Parameters:
containingClass- never nullpropertyName- never null- Returns:
- null if it doesn't exist
-
isMethodOverwritten
-
assertGetterMethod
public static void assertGetterMethod(Method getterMethod, Class<? extends Annotation> annotationClass) -
assertReadMethod
-
isMap
- Parameters:
type- never null- Returns:
- true if it is a
Map
-
isList
- Parameters:
type- never null- Returns:
- true if it is a
List
-
transformArrayToList
-