Package com.atlassian.bamboo.utils
Class BambooReflectionUtils
java.lang.Object
com.atlassian.bamboo.utils.BambooReflectionUtils
Utility methods related to Java reflection API.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptiongetAllDeclaredFields
(@NotNull Class<?> clazz) Returns all fields declared in the supplied class and its superclasses.getAllDeclaredMethods
(Class<?> clazz) Returns all methods declared in the supplied class and its superclasses.static Class<?>
getSimpleType
(@NotNull Class<?> aClass) static boolean
hasCustomDeserialisation
(Class<?> clazz) Returns true if the class or any of its superclasses contain custom deserialisation method(s).static <T> T
instantiateQuietly
(@NotNull Class<T> aClass) Instantiates a class quietly, throwing all possible exceptions asRuntimeException
.static @NotNull String
method2SignatureString
(@NotNull Method method) Returns simplified signature of a method consisting of fully qualified class name, method name and list of argument types.
-
Constructor Details
-
BambooReflectionUtils
public BambooReflectionUtils()
-
-
Method Details
-
instantiateQuietly
Instantiates a class quietly, throwing all possible exceptions asRuntimeException
. UsesClass.newInstance()
method to instantiate class.- Type Parameters:
T
- type of the object to be instantiated- Parameters:
aClass
- class to be instantiated.- Returns:
- instantiated object of the given class
- Throws:
RuntimeException
- if any exceptions occurred while instantiating the class (e.g.InstantiationException
orIllegalAccessException
),RuntimeException
will be thrown as a wrapping exception.
-
getSimpleType
- Parameters:
aClass
-- Returns:
- simple type for arrays, for example for java.lang.String[] class it will return java.lang.String
-
getAllDeclaredFields
Returns all fields declared in the supplied class and its superclasses. -
getAllDeclaredMethods
Returns all methods declared in the supplied class and its superclasses. -
hasCustomDeserialisation
Returns true if the class or any of its superclasses contain custom deserialisation method(s). Note: does not take method visibility into account. -
method2SignatureString
Returns simplified signature of a method consisting of fully qualified class name, method name and list of argument types.
-