Package de.uni_trier.wi2.procake.utils
Class ReflectionUtils
- java.lang.Object
-
- de.uni_trier.wi2.procake.utils.ReflectionUtils
-
public class ReflectionUtils extends Object
-
-
Constructor Summary
Constructors Constructor Description ReflectionUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static FieldgetField(Object obj, String fieldName)static ObjectgetFieldValue(Object obj, String fieldName)static ObjectgetStaticField(Class<?> clazz, String fieldName)static List<Field>getStaticFields(Class<?> clazz)static HashMap<Class<?>,List<Field>>getStaticFields(List<Class<?>> classes)
-
-
-
Method Detail
-
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 obtainedfieldName- 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 accessedfieldName- The name of the field which should be accessed- Returns:
- The requested
Field
-
-