Class ReflectionUtils

java.lang.Object
io.activej.common.reflection.ReflectionUtils

public final class ReflectionUtils extends Object
  • Constructor Details

    • ReflectionUtils

      public ReflectionUtils()
  • Method Details

    • isPrimitiveType

      public static boolean isPrimitiveType(Class<?> cls)
    • isBoxedPrimitiveType

      public static boolean isBoxedPrimitiveType(Class<?> cls)
    • isPrimitiveTypeOrBox

      public static boolean isPrimitiveTypeOrBox(Class<?> cls)
    • isSimpleType

      public static boolean isSimpleType(Class<?> cls)
    • isThrowable

      public static boolean isThrowable(Class<?> cls)
    • isPublic

      public static boolean isPublic(Class<?> cls)
    • isPublic

      public static boolean isPublic(Method method)
    • isGetter

      public static boolean isGetter(Method method)
    • isSetter

      public static boolean isSetter(Method method)
    • extractFieldNameFromGetter

      public static String extractFieldNameFromGetter(Method getter)
    • extractFieldNameFromGetterName

      public static String extractFieldNameFromGetterName(String getterName)
    • extractFieldNameFromSetter

      public static String extractFieldNameFromSetter(Method setter)
    • extractFieldNameFromSetterName

      public static String extractFieldNameFromSetterName(String setterName)
    • canBeCreated

      public static boolean canBeCreated(Class<?> cls, String... factoryMethodNames)
    • tryToCreateInstanceWithFactoryMethods

      @Nullable public static <T> T tryToCreateInstanceWithFactoryMethods(Class<T> cls, String... factoryMethodNames)
    • isClassPresent

      public static boolean isClassPresent(String fullClassName)
    • isClassPresent

      public static boolean isClassPresent(String fullClassName, ClassLoader classLoader)
    • getAllMethods

      public static List<Method> getAllMethods(Class<?> cls)
      Returns a list containing Method objects reflecting all the methods of the class or interface represented by this Class object, 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

      public static <T> Optional<T> walkClassHierarchy(@NotNull @NotNull Class<?> aClass, @NotNull @NotNull Function<Class<?>,Optional<T>> finder)
    • getAnnotationString

      public static String getAnnotationString(Annotation annotation) throws ReflectiveOperationException
      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