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 void
assertGetterMethod
(Method getterMethod, Class<? extends Annotation> annotationClass) static void
assertReadMethod
(Method readMethod, Class<? extends Annotation> annotationClass) static Field
static Method
getGetterMethod
(Class<?> containingClass, String propertyName) static String
getGetterPropertyName
(Member member) Returns the JavaBeans property name of the given member.static Method
getSetterMethod
(Class<?> containingClass, Class<?> propertyType, String propertyName) static Method
getSetterMethod
(Class<?> containingClass, String propertyName) static boolean
static boolean
hasGetterMethod
(Class<?> containingClass, String propertyName) static boolean
isGetterMethod
(Method method) Checks whether the given method is a valid getter method according to the JavaBeans standard.static boolean
static boolean
static boolean
isMethodOverwritten
(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
-