public class ReflectionUtil extends Object
| Constructor and Description |
|---|
ReflectionUtil() |
| Modifier and Type | Method and Description |
|---|---|
Class<?>[] |
geClassArgumentsFromGeneric(Type genericType)
Gets all type arguments out of a generic.
|
Object |
getFieldValue(Object resultObject,
Field field)
Gets the value from a specific field in the passed object.
|
boolean |
isFieldArrayOrList(Field field)
Checks if the field is an array or list.
|
boolean |
isFieldPrimitive(Field field)
Checks if field is primitive.
|
<T> Iterable<Field> |
retrieveAllFields(Class<T> clazz)
Given a class, return all fields in the entire class hierarchy.
|
<T> void |
setField(T resultObject,
Field field,
Object value)
Set a value into the passed field.
|
boolean |
shouldConstituentMembersBeUnmarshalled(Class<?> clazz)
Checks if given class should have its constituent members unmarshalled.
|
public boolean isFieldPrimitive(Field field)
field - the field to checkpublic boolean isFieldArrayOrList(Field field)
field - the field to check.public Class<?>[] geClassArgumentsFromGeneric(Type genericType)
For example, it will retrieve String from Map<String, Object>
genericType - the generic type to insect.public <T> void setField(T resultObject,
Field field,
Object value)
throws IllegalAccessException
T - the type of the result object.resultObject - the object in which to set the field.field - the field to set.value - the value to set.IllegalAccessException - if field cannot be set.public Object getFieldValue(Object resultObject, Field field) throws IllegalAccessException
resultObject - the object to search.field - the field to get from.IllegalAccessException - if field cannot be accessed.public <T> Iterable<Field> retrieveAllFields(Class<T> clazz)
T - the Class typeclazz - the class to search.public boolean shouldConstituentMembersBeUnmarshalled(Class<?> clazz)
clazz - a class to check.Copyright © 2015 Elastic Path Software, Inc. All rights reserved.