Class ReflectionHelper
java.lang.Object
ai.timefold.solver.core.impl.domain.common.ReflectionHelper
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidassertGetterMethod(Method getterMethod) static voidassertGetterMethod(Method getterMethod, Class<? extends Annotation> annotationClass) static voidassertReadMethod(Method readMethod) static voidassertReadMethod(Method readMethod, Class<? extends Annotation> annotationClass) static FieldgetDeclaredField(Class<?> containingClass, String fieldName) static MethodgetDeclaredGetterMethod(Class<?> containingClass, String propertyName) static MethodgetDeclaredMethod(Class<?> containingClass, String methodName, Class<?>... parameterTypes) static MethodgetDeclaredSetterMethod(Class<?> containingClass, Class<?> propertyType, String propertyName) 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 booleanisMethodOverwritten(Method parentMethod, Class<?> childClass) static <Value_> List<Value_>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
-
getDeclaredGetterMethod
- Parameters:
containingClass- never nullpropertyName- never null- Returns:
- sometimes null
-
getDeclaredMethod
public static Method getDeclaredMethod(Class<?> containingClass, String methodName, Class<?>... parameterTypes) - Parameters:
containingClass- never nullmethodName- 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
-
getDeclaredField
- 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
-
getDeclaredSetterMethod
public static Method getDeclaredSetterMethod(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
-
assertGetterMethod
public static void assertGetterMethod(Method getterMethod, Class<? extends Annotation> annotationClass) -
assertReadMethod
-
assertReadMethod
-
transformArrayToList
-