Class TypeUtils

  • public final class TypeUtils
    extends Object
    Utility class.
    • Method Detail

      • getSuperclassTypeElement

        public static @Nullable TypeElement getSuperclassTypeElement​(TypeElement element)
      • extractClosestRealTypeAsString

        public static String extractClosestRealTypeAsString​(TypeMirror type,
                                                            Context context)
      • containsAnnotation

        public static boolean containsAnnotation​(Element element,
                                                 String... annotations)
      • isAnnotationMirrorOfType

        public static boolean isAnnotationMirrorOfType​(AnnotationMirror annotationMirror,
                                                       String fqcn)
        Returns true if the provided annotation type is of the same type as the provided class, false otherwise. This method uses the string class names for comparison. See also getting-class-values-from-annotations.
        annotationMirror - The annotation mirror
        fqcn - the fully qualified class name to check against
        true if the provided annotation type is of the same type as the provided class, false otherwise.
      • getAnnotationMirror

        public static @Nullable AnnotationMirror getAnnotationMirror​(Element element,
                                                                     String fqcn)
        Checks whether the Element hosts the annotation with the given fully qualified class name.
        element - the element to check for the hosted annotation
        fqcn - the fully qualified class name of the annotation to check for
        the annotation mirror for the specified annotation class from the Element or null in case the TypeElement does not host the specified annotation.
      • determineAccessTypeForHierarchy

        public static void determineAccessTypeForHierarchy​(TypeElement searchedElement,
                                                           Context context)
      • determineAnnotationSpecifiedAccessType

        public static @Nullable AccessType determineAnnotationSpecifiedAccessType​(Element element)
      • getElementKindForAccessType

        public static ElementKind getElementKindForAccessType​(AccessType accessType)