|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.eclipse.epsilon.eol.util.ReflectionUtil
public class ReflectionUtil
Constructor Summary | |
---|---|
ReflectionUtil()
|
Method Summary | |
---|---|
static java.lang.Object |
executeMethod(java.lang.reflect.Method method,
java.lang.Object obj,
java.lang.Object[] parameters)
|
static java.lang.Object |
executeMethod(java.lang.Object obj,
java.lang.reflect.Method method,
java.lang.Object[] parameters,
AST ast)
|
static java.lang.Object |
executeMethod(java.lang.Object obj,
java.lang.String methodName,
java.lang.Object[] parameters)
|
static java.util.List<java.lang.reflect.Field> |
getAllInheritedInstanceFields(java.lang.Class<?> klazz)
|
static java.lang.reflect.Field |
getField(java.lang.Class<?> clazz,
java.lang.String fieldName)
Gets a field of a class using reflection by introspecting the class and its supertype(s) |
static java.lang.Object |
getFieldValue(java.lang.Object object,
java.lang.String fieldName)
Returns the value of a field of an object |
static java.lang.reflect.Method |
getMethodFor(java.lang.Object obj,
java.lang.String methodName,
java.lang.Object[] parameters,
boolean includeInheritedMethods,
boolean allowContravariantConversionForParameters)
|
static java.util.Set<java.lang.String> |
getMethodNames(java.lang.Object obj,
boolean includeInheritedMethods)
|
static boolean |
hasMethods(java.lang.Object obj,
java.lang.String methodName)
|
static boolean |
isInstance(java.lang.Class<?> clazz,
java.lang.Object instance)
Checks if the instance is an instance of clazz Necessary because in Java, int.class != Integer.class etc |
static java.lang.String |
methodToString(java.lang.reflect.Method method)
Returns a string representation of the method |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ReflectionUtil()
Method Detail |
---|
public static boolean hasMethods(java.lang.Object obj, java.lang.String methodName)
public static java.util.Set<java.lang.String> getMethodNames(java.lang.Object obj, boolean includeInheritedMethods)
public static java.lang.reflect.Method getMethodFor(java.lang.Object obj, java.lang.String methodName, java.lang.Object[] parameters, boolean includeInheritedMethods, boolean allowContravariantConversionForParameters)
allowContravariantConversionForParameters
- when false, parameters will have exactly the same class as the arguments to the returned method
when true, parameters may have a type that is more specific than the arguments to the returned methodpublic static java.lang.Object executeMethod(java.lang.Object obj, java.lang.reflect.Method method, java.lang.Object[] parameters, AST ast) throws EolRuntimeException
EolRuntimeException
public static java.lang.Object executeMethod(java.lang.Object obj, java.lang.String methodName, java.lang.Object[] parameters) throws java.lang.Throwable
java.lang.Throwable
public static java.lang.Object executeMethod(java.lang.reflect.Method method, java.lang.Object obj, java.lang.Object[] parameters) throws java.lang.Throwable
java.lang.Throwable
public static java.lang.String methodToString(java.lang.reflect.Method method)
method
-
public static java.lang.Object getFieldValue(java.lang.Object object, java.lang.String fieldName)
object
- fieldName
-
public static java.lang.reflect.Field getField(java.lang.Class<?> clazz, java.lang.String fieldName)
clazz
- fieldName
-
public static boolean isInstance(java.lang.Class<?> clazz, java.lang.Object instance)
clazz
- instance
-
public static java.util.List<java.lang.reflect.Field> getAllInheritedInstanceFields(java.lang.Class<?> klazz)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |