Class AnnotationProcessingHelper


  • public final class AnnotationProcessingHelper
    extends java.lang.Object
    Helper for annotation processing.
    Author:
    harald
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static boolean isModifierSet​(javax.lang.model.element.Modifier modifier, javax.lang.model.element.Modifier[] modifierList)
      Checks if a modifier is in the set of modifiers.
      static boolean isTypeInstanceoOf​(javax.annotation.processing.ProcessingEnvironment processingEnv, javax.lang.model.type.TypeMirror typeMirror, java.lang.String className)
      Checks whether a type is a given instance of a class.
      static boolean isTypeInstanceoOf​(javax.annotation.processing.ProcessingEnvironment processingEnv, javax.lang.model.type.TypeMirror typeMirror, java.lang.String className, java.lang.String genType)
      Checks whether a type is an instance of of a given classname and optional generics type.
      static java.lang.String objectArrayToString​(java.lang.Object[] objArray, java.lang.String separator)
      Creates a string from an object array.
      static javax.lang.model.element.Modifier[] readModifiers​(java.util.StringTokenizer stok)
      Gets an array of modifiers from a string tokenizer.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • readModifiers

        public static javax.lang.model.element.Modifier[] readModifiers​(java.util.StringTokenizer stok)
        Gets an array of modifiers from a string tokenizer.
        Parameters:
        stok - the string tokenizer
        Returns:
        the modifier array
      • isModifierSet

        public static boolean isModifierSet​(javax.lang.model.element.Modifier modifier,
                                            javax.lang.model.element.Modifier[] modifierList)
        Checks if a modifier is in the set of modifiers.
        Parameters:
        modifier - the modifier to check
        modifierList - the list of modifiers
        Returns:
        true if modifier is in the list of modifiers
      • objectArrayToString

        public static java.lang.String objectArrayToString​(java.lang.Object[] objArray,
                                                           java.lang.String separator)
        Creates a string from an object array. Copied from StringHelper to keep dependencies small.
        Parameters:
        objArray - the array of objects
        separator - the string between two objects
        Returns:
        the object array string
      • isTypeInstanceoOf

        public static boolean isTypeInstanceoOf​(javax.annotation.processing.ProcessingEnvironment processingEnv,
                                                javax.lang.model.type.TypeMirror typeMirror,
                                                java.lang.String className,
                                                java.lang.String genType)
        Checks whether a type is an instance of of a given classname and optional generics type.
        Parameters:
        processingEnv - the annotation processing environment
        typeMirror - the element type
        className - the class to check
        genType - the generic type
        Returns:
        true if type is an instance of of a given classname
      • isTypeInstanceoOf

        public static boolean isTypeInstanceoOf​(javax.annotation.processing.ProcessingEnvironment processingEnv,
                                                javax.lang.model.type.TypeMirror typeMirror,
                                                java.lang.String className)
        Checks whether a type is a given instance of a class.
        Parameters:
        processingEnv - the annotation processing environment
        typeMirror - the element type
        className - the class to check
        Returns:
        true if the typeMirror represents an instance of className