Package ca.uhn.fhir.util
Class ReflectionUtil
java.lang.Object
ca.uhn.fhir.util.ReflectionUtil
-
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic String
describeMethodInSortFriendlyWay
(Method theMethod) Returns a description likestartsWith params(java.lang.String, int) returns(boolean)
.getDeclaredMethods
(Class<?> theClazz) Returns all methods declared against theClazz.getDeclaredMethods
(Class<?> theClazz, boolean theIncludeMethodsFromSuperclasses) Returns all methods declared against theClazz.static Class
<?> static Class
<?> For a field of type Listinvalid input: '<'Enumeration>, 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 <T> T
newInstance
(String theClassName, Class<T> theType, Class<?>[] theArgTypes, Object[] theArgs) 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 Details
-
EMPTY_OBJECT_ARRAY
-
EMPTY_CLASS_ARRAY
-
-
Method Details
-
getDeclaredMethods
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
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
-
getGenericCollectionTypeOfFieldWithSecondOrderForList
For a field of type Listinvalid input: '<'Enumeration>, returns Foo -
getGenericCollectionTypeOfMethodParameter
public static Class<?> getGenericCollectionTypeOfMethodParameter(Method theMethod, int theParamIndex) -
getGenericCollectionTypeOfMethodReturnType
-
isInstantiable
-
newInstance
Instantiate a class by no-arg constructor, throwConfigurationException
if we fail to do so -
newInstance
-
newInstanceOfFhirServerType
-
newInstanceOrReturnNull
-
newInstanceOrReturnNull
public static <T> T newInstanceOrReturnNull(String theClassName, Class<T> theType, Class<?>[] theArgTypes, Object[] theArgs) -
newInstance
@Nonnull public static <T> T newInstance(String theClassName, Class<T> theType, Class<?>[] theArgTypes, Object[] theArgs) -
typeExists
-