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_ARRAYstatic Object[]EMPTY_OBJECT_ARRAY
-
Constructor Summary
Constructors Constructor Description ReflectionUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static StringdescribeMethodInSortFriendlyWay(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 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 booleanisInstantiable(Class<?> theType)static <T> TnewInstance(Class<T> theType)Instantiate a class by no-arg constructor, throwConfigurationExceptionif we fail to do sostatic <T> TnewInstance(Class<T> theType, Class<?> theArgumentType, Object theArgument)static ObjectnewInstanceOfFhirServerType(String theType)static <T> TnewInstanceOrReturnNull(String theClassName, Class<T> theType)static <T> TnewInstanceOrReturnNull(String theClassName, Class<T> theType, Class<?>[] theArgTypes, Object[] theArgs)static booleantypeExists(String theName)
-
-
-
Field Detail
-
EMPTY_OBJECT_ARRAY
public static final Object[] EMPTY_OBJECT_ARRAY
-
EMPTY_CLASS_ARRAY
public static final Class<?>[] EMPTY_CLASS_ARRAY
-
-
Constructor Detail
-
ReflectionUtil
public ReflectionUtil()
-
-
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.
-
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, throwConfigurationExceptionif 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)
-
-