Class ReflectionHelper

java.lang.Object
ai.timefold.solver.core.impl.domain.common.ReflectionHelper

public final class ReflectionHelper extends Object
  • Method Details

    • getGetterPropertyName

      public static String getGetterPropertyName(Member member)
      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

      public static boolean isGetterMethod(Method method)
      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

      public static boolean hasGetterMethod(Class<?> containingClass, String propertyName)
      Parameters:
      containingClass - never null
      propertyName - never null
      Returns:
      true if that getter exists
    • getGetterMethod

      public static Method getGetterMethod(Class<?> containingClass, String propertyName)
      Parameters:
      containingClass - never null
      propertyName - never null
      Returns:
      sometimes null
    • getDeclaredGetterMethod

      public static Method getDeclaredGetterMethod(Class<?> containingClass, String propertyName)
      Parameters:
      containingClass - never null
      propertyName - never null
      Returns:
      sometimes null
    • getDeclaredMethod

      public static Method getDeclaredMethod(Class<?> containingClass, String methodName, Class<?>... parameterTypes)
      Parameters:
      containingClass - never null
      methodName - never null
      Returns:
      sometimes null
    • hasField

      public static boolean hasField(Class<?> containingClass, String fieldName)
      Parameters:
      containingClass - never null
      fieldName - never null
      Returns:
      true if that field exists
    • getField

      public static Field getField(Class<?> containingClass, String fieldName)
      Parameters:
      containingClass - never null
      fieldName - never null
      Returns:
      sometimes null
    • getDeclaredField

      public static Field getDeclaredField(Class<?> containingClass, String fieldName)
      Parameters:
      containingClass - never null
      fieldName - never null
      Returns:
      sometimes null
    • getSetterMethod

      public static Method getSetterMethod(Class<?> containingClass, Class<?> propertyType, String propertyName)
      Parameters:
      containingClass - never null
      propertyType - never null
      propertyName - never null
      Returns:
      null if it doesn't exist
    • getDeclaredSetterMethod

      public static Method getDeclaredSetterMethod(Class<?> containingClass, Class<?> propertyType, String propertyName)
      Parameters:
      containingClass - never null
      propertyType - never null
      propertyName - never null
      Returns:
      null if it doesn't exist
    • getSetterMethod

      public static Method getSetterMethod(Class<?> containingClass, String propertyName)
      Parameters:
      containingClass - never null
      propertyName - never null
      Returns:
      null if it doesn't exist
    • isMethodOverwritten

      public static boolean isMethodOverwritten(Method parentMethod, Class<?> childClass)
    • assertGetterMethod

      public static void assertGetterMethod(Method getterMethod)
    • assertGetterMethod

      public static void assertGetterMethod(Method getterMethod, Class<? extends Annotation> annotationClass)
    • assertReadMethod

      public static void assertReadMethod(Method readMethod)
    • assertReadMethod

      public static void assertReadMethod(Method readMethod, Class<? extends Annotation> annotationClass)
    • transformArrayToList

      public static <Value_> List<Value_> transformArrayToList(Object arrayObject)