
Package ca.uhn.fhir.util
Class ReflectionUtil
- java.lang.Object
-
- ca.uhn.fhir.util.ReflectionUtil
-
public class ReflectionUtil extends Object
-
-
Field Summary
Fields Modifier and Type Field Description static Class<?>[]
EMPTY_CLASS_ARRAY
static Object[]
EMPTY_OBJECT_ARRAY
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static String
describeMethodInSortFriendlyWay(Method theMethod)
Returns a description likestartsWith params(java.lang.String, int) returns(boolean)
.static List<Method>
getDeclaredMethods(Class<?> theClazz)
Returns all methods declared against theClazz.static List<Method>
getDeclaredMethods(Class<?> theClazz, boolean theIncludeMethodsFromSuperclasses)
Returns all methods declared against theClazz.static Class<?>
getGenericCollectionTypeOfField(Field next)
static Class<?>
getGenericCollectionTypeOfFieldWithSecondOrderForList(Field next)
For a field of type List>, returns Foo static Class<?>
getGenericCollectionTypeOfMethodParameter(Method theMethod, int theParamIndex)
static Class<?>
getGenericCollectionTypeOfMethodReturnType(Method theMethod)
static boolean
isInstantiable(Class<?> theType)
static <T> T
newInstance(Class<T> theType)
Instantiate a class by no-arg constructor, throwConfigurationException
if we fail to do sostatic <T> T
newInstance(Class<T> theType, Class<?> theArgumentType, Object theArgument)
static Object
newInstanceOfFhirServerType(String theType)
static <T> T
newInstanceOrReturnNull(String theClassName, Class<T> theType)
static <T> T
newInstanceOrReturnNull(String theClassName, Class<T> theType, Class<?>[] theArgTypes, Object[] theArgs)
static boolean
typeExists(String theName)
-
-
-
Field Detail
-
EMPTY_OBJECT_ARRAY
public static final Object[] EMPTY_OBJECT_ARRAY
-
EMPTY_CLASS_ARRAY
public static final Class<?>[] EMPTY_CLASS_ARRAY
-
-
Method Detail
-
getDeclaredMethods
public static List<Method> getDeclaredMethods(Class<?> theClazz)
Returns all methods declared against theClazz. This method returns a predictable order, which is sorted by method name and then by parameters.This method does not include superclass methods (see
getDeclaredMethods(Class, boolean)
if you want to include those.
-
getDeclaredMethods
public static List<Method> getDeclaredMethods(Class<?> theClazz, boolean theIncludeMethodsFromSuperclasses)
Returns all methods declared against theClazz. This method returns a predictable order, which is sorted by method name and then by parameters.
-
describeMethodInSortFriendlyWay
public static String describeMethodInSortFriendlyWay(Method theMethod)
Returns a description likestartsWith params(java.lang.String, int) returns(boolean)
. The format is chosen in order to provide a predictable and useful sorting order.
-
getGenericCollectionTypeOfField
public static Class<?> getGenericCollectionTypeOfField(Field next)
-
getGenericCollectionTypeOfFieldWithSecondOrderForList
public static Class<?> getGenericCollectionTypeOfFieldWithSecondOrderForList(Field next)
For a field of type List>, returns Foo
-
getGenericCollectionTypeOfMethodParameter
public static Class<?> getGenericCollectionTypeOfMethodParameter(Method theMethod, int theParamIndex)
-
getGenericCollectionTypeOfMethodReturnType
public static Class<?> getGenericCollectionTypeOfMethodReturnType(Method theMethod)
-
isInstantiable
public static boolean isInstantiable(Class<?> theType)
-
newInstance
public static <T> T newInstance(Class<T> theType)
Instantiate a class by no-arg constructor, throwConfigurationException
if we fail to do so
-
newInstance
public static <T> T newInstance(Class<T> theType, Class<?> theArgumentType, Object theArgument)
-
newInstanceOfFhirServerType
public static Object newInstanceOfFhirServerType(String theType)
-
newInstanceOrReturnNull
public static <T> T newInstanceOrReturnNull(String theClassName, Class<T> theType)
-
newInstanceOrReturnNull
public static <T> T newInstanceOrReturnNull(String theClassName, Class<T> theType, Class<?>[] theArgTypes, Object[] theArgs)
-
typeExists
public static boolean typeExists(String theName)
-
-