Class ReflectionUtils

java.lang.Object
de.uni_trier.wi2.procake.utils.ReflectionUtils

public class ReflectionUtils extends Object
  • Constructor Details

    • ReflectionUtils

      public ReflectionUtils()
  • Method Details

    • getStaticFields

      public static HashMap<Class<?>,List<Field>> getStaticFields(List<Class<?>> classes)
      Parameters:
      classes - List of classes
      Returns:
      A mapping of classes to their corresponding static fields
    • getStaticFields

      public static List<Field> getStaticFields(Class<?> clazz)
      Parameters:
      clazz - The class from which the static fields should be obtained
      Returns:
      The list of static fields from that class
    • getStaticField

      public static Object getStaticField(Class<?> clazz, String fieldName)
      Parameters:
      clazz - The class from which the static field should be obtained
      fieldName - The name of the field that should be obtained
      Returns:
      The value of the field
    • getField

      public static Field getField(Object obj, String fieldName)
      Parameters:
      obj - The object whose field should be accessed
      fieldName - The name of the field which should be accessed
      Returns:
      The requested Field
    • getFieldValue

      public static Object getFieldValue(Object obj, String fieldName)
      Parameters:
      obj - The object whose property value should be accessed
      fieldName - The name of the field which should be accessed
      Returns:
      The requested field value or null if not found