Class AnnotationNode

  • All Implemented Interfaces:
    NodeMetaDataHandler

    public class AnnotationNode
    extends ASTNode
    Represents an annotation which can be attached to interfaces, classes, methods, fields, parameters, and other places.
    • Constructor Detail

      • AnnotationNode

        public AnnotationNode​(ClassNode classNode)
    • Method Detail

      • getClassNode

        public ClassNode getClassNode()
      • isBuiltIn

        public boolean isBuiltIn()
      • hasRuntimeRetention

        public boolean hasRuntimeRetention()
        Flag corresponding to RetentionPolicy.RUNTIME.
        Returns:
        true if the annotation should be visible at runtime, false otherwise
      • setRuntimeRetention

        public void setRuntimeRetention​(boolean flag)
        Sets the internal flag if the current annotation has RetentionPolicy.SOURCE.
        Parameters:
        flag - if true then current annotation is marked as having RetentionPolicy.RUNTIME.
      • hasSourceRetention

        public boolean hasSourceRetention()
        Flag corresponding to RetentionPolicy.SOURCE.
        Returns:
        true if the annotation is only allowed in sources false otherwise
      • setSourceRetention

        public void setSourceRetention​(boolean flag)
        Sets the internal flag if the current annotation has RetentionPolicy.SOURCE.
        Parameters:
        flag - if true then current annotation is marked as having RetentionPolicy.SOURCE.
      • hasClassRetention

        public boolean hasClassRetention()
        Flag corresponding to RetentionPolicy.CLASS. This is the default when no RetentionPolicy annotations are present.
        Returns:
        true if the annotation is written in the bytecode, but not visible at runtime false otherwise
      • setClassRetention

        public void setClassRetention​(boolean flag)
        Sets the internal flag if the current annotation has an explicit RetentionPolicy.CLASS.
        Parameters:
        flag - if true then current annotation is marked as having RetentionPolicy.CLASS.
      • setAllowedTargets

        public void setAllowedTargets​(int bitmap)
      • isTargetAllowed

        public boolean isTargetAllowed​(int target)
      • targetToName

        public static String targetToName​(int target)