Package io.activej.common.reflection
Class ReflectionUtils
java.lang.Object
io.activej.common.reflection.ReflectionUtils
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic booleancanBeCreated(Class<?> cls, String... factoryMethodNames) static <A extends Annotation>
Optional<A>deepFindAnnotation(Class<?> aClass, Class<A> annotation) static StringextractFieldNameFromGetter(Method getter) static StringextractFieldNameFromGetterName(String getterName) static StringextractFieldNameFromSetter(Method setter) static StringextractFieldNameFromSetterName(String setterName) static ObjectfetchAnnotationElementValue(Annotation annotation, Method element) Returns values if it is not null, otherwise throws exceptiongetAllMethods(Class<?> cls) Returns a list containingMethodobjects reflecting all the methods of the class or interface represented by thisClassobject, including those declared by the class or interface and those from superclasses and superinterfaces.static StringgetAnnotationString(Annotation annotation) Builds string representation of annotation with its elements.static booleanisBoxedPrimitiveType(Class<?> cls) static booleanisClassPresent(String fullClassName) static booleanisClassPresent(String fullClassName, ClassLoader classLoader) static booleanstatic booleanisPrimitiveType(Class<?> cls) static booleanisPrimitiveTypeOrBox(Class<?> cls) static booleanstatic booleanstatic booleanstatic booleanisSimpleType(Class<?> cls) static booleanisThrowable(Class<?> cls) static <T> TtryToCreateInstanceWithFactoryMethods(Class<T> cls, String... factoryMethodNames) static <T> Optional<T>walkClassHierarchy(@NotNull Class<?> aClass, @NotNull Function<Class<?>, Optional<T>> finder)
-
Constructor Details
-
ReflectionUtils
public ReflectionUtils()
-
-
Method Details
-
isPrimitiveType
-
isBoxedPrimitiveType
-
isPrimitiveTypeOrBox
-
isSimpleType
-
isThrowable
-
isPublic
-
isPublic
-
isGetter
-
isSetter
-
extractFieldNameFromGetter
-
extractFieldNameFromGetterName
-
extractFieldNameFromSetter
-
extractFieldNameFromSetterName
-
canBeCreated
-
tryToCreateInstanceWithFactoryMethods
-
isClassPresent
-
isClassPresent
-
getAllMethods
Returns a list containingMethodobjects reflecting all the methods of the class or interface represented by thisClassobject, including those declared by the class or interface and those from superclasses and superinterfaces. -
deepFindAnnotation
public static <A extends Annotation> Optional<A> deepFindAnnotation(Class<?> aClass, Class<A> annotation) -
walkClassHierarchy
-
getAnnotationString
Builds string representation of annotation with its elements. The string looks differently depending on the number of elements, that an annotation has. If annotation has no elements, string looks like this : "AnnotationName" If annotation has a single element with the name "value", string looks like this : "AnnotationName(someValue)" If annotation has one or more custom elements, string looks like this : "(key1=value1,key2=value2)"- Throws:
ReflectiveOperationException
-
fetchAnnotationElementValue
public static Object fetchAnnotationElementValue(Annotation annotation, Method element) throws ReflectiveOperationException Returns values if it is not null, otherwise throws exception- Throws:
ReflectiveOperationException
-