Class AnnotationMap

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable

    public class AnnotationMap
    extends java.lang.Object
    implements java.lang.Cloneable, java.io.Serializable
    A map of annotations used with ComponentDefinition and ComponentInfo.

    Note: it is not thread safe.

    Author:
    tomyeh
    See Also:
    Serialized Form
    • Constructor Summary

      Constructors 
      Constructor Description
      AnnotationMap()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addAll​(AnnotationMap src)
      Adds all annotations of the specified map to this map.
      void addAnnotation​(java.lang.String propName, java.lang.String annotName, java.util.Map<java.lang.String,​java.lang.String[]> annotAttrs, Location loc)
      Adds an annotation.
      java.lang.Object clone()
      Clones this annotation map.
      java.util.List<java.lang.String> getAnnotatedProperties()
      Returns a read-only list of the name (String) of properties that are associated at least one annotation (never null).
      java.util.List<java.lang.String> getAnnotatedPropertiesBy​(java.lang.String annotName)
      Returns a read-only list of the names (String) of the properties that are associated with the specified annotation (never null).
      Annotation getAnnotation​(java.lang.String propName, java.lang.String annotName)
      Returns the annotation associated with the specified property, or null if not available.
      java.util.Collection<Annotation> getAnnotations​(java.lang.String propName)
      Returns a read-only collection of all annotations associated with the the specified property.
      java.util.Collection<Annotation> getAnnotations​(java.lang.String propName, java.lang.String annotName)
      Returns the annotations associated with the specified property.
      boolean isEmpty()
      Returns whether no annotation at all.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • AnnotationMap

        public AnnotationMap()
    • Method Detail

      • isEmpty

        public boolean isEmpty()
        Returns whether no annotation at all.
      • getAnnotation

        public Annotation getAnnotation​(java.lang.String propName,
                                        java.lang.String annotName)
        Returns the annotation associated with the specified property, or null if not available.
        Parameters:
        annotName - the annotation name
        propName - the property name, e.g., "value". If null, this method returns the annotation(s) associated with the component (rather than a particular property).
      • getAnnotations

        public java.util.Collection<Annotation> getAnnotations​(java.lang.String propName,
                                                               java.lang.String annotName)
        Returns the annotations associated with the specified property. It never returns null.
        Parameters:
        annotName - the annotation name
        propName - the property name, e.g., "value". If null, this method returns the annotation(s) associated with the component (rather than a particular property).
        Since:
        6.0.0
      • getAnnotations

        public java.util.Collection<Annotation> getAnnotations​(java.lang.String propName)
        Returns a read-only collection of all annotations associated with the the specified property.
        Parameters:
        propName - the property name, e.g., "value". If null, this method returns the annotation(s) associated with the component (rather than a particular property).
      • getAnnotatedPropertiesBy

        public java.util.List<java.lang.String> getAnnotatedPropertiesBy​(java.lang.String annotName)
        Returns a read-only list of the names (String) of the properties that are associated with the specified annotation (never null).
      • getAnnotatedProperties

        public java.util.List<java.lang.String> getAnnotatedProperties()
        Returns a read-only list of the name (String) of properties that are associated at least one annotation (never null).
      • addAll

        public void addAll​(AnnotationMap src)
        Adds all annotations of the specified map to this map.
      • addAnnotation

        public void addAnnotation​(java.lang.String propName,
                                  java.lang.String annotName,
                                  java.util.Map<java.lang.String,​java.lang.String[]> annotAttrs,
                                  Location loc)
        Adds an annotation.
        Parameters:
        propName - the property name. If null, this method returns the annotation(s) associated with the component (rather than a particular property).
        Since:
        6.0.0
      • clone

        public java.lang.Object clone()
        Clones this annotation map.
        Overrides:
        clone in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object