Package org.glassfish.tests.utils
Class ReflectionUtils
- java.lang.Object
-
- org.glassfish.tests.utils.ReflectionUtils
-
@Deprecated public class ReflectionUtils extends Object
Deprecated.Using reflection in tests is considered as bad practice. Use it only if you don't have another option.Utilities to create a configured Habitat and cache them- Author:
- David Matejcek
-
-
Constructor Summary
Constructors Constructor Description ReflectionUtils()Deprecated.
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static <T> TgetField(Object instance, String fieldName)Deprecated.static <T> TgetField(Object instance, String fieldName, Class<?> ancestorOfInstance)Deprecated.static <T> TgetStaticField(Class<?> clazz, String fieldName)Deprecated.static voidsetField(Object instance, String fieldName, Object value)Deprecated.Sets the field of the instance to the given value.static voidsetStaticField(Class<?> clazz, String fieldName, Object value)Deprecated.Sets the static field of the class to the given value.
-
-
-
Method Detail
-
setStaticField
public static void setStaticField(Class<?> clazz, String fieldName, Object value)
Deprecated.Sets the static field of the class to the given value.
-
getStaticField
public static <T> T getStaticField(Class<?> clazz, String fieldName)
Deprecated.- Type Parameters:
T- an expected assignable type of the field value.- Returns:
- a value of the static field of the clazz
-
setField
public static void setField(Object instance, String fieldName, Object value)
Deprecated.Sets the field of the instance to the given value.
-
getField
public static <T> T getField(Object instance, String fieldName)
Deprecated.- Type Parameters:
T- an expected assignable type of the field value.- Parameters:
fieldName- a field declared in the instance's class- Returns:
- a value of the field of the instance
-
getField
public static <T> T getField(Object instance, String fieldName, Class<?> ancestorOfInstance)
Deprecated.- Type Parameters:
T- an expected assignable type of the field value.- Parameters:
fieldName- a field declared in the ancestor of the instance- Returns:
- a value of the field of the instance
-
-