Class Annotation

java.lang.Object
com.android.dx.util.MutabilityControl
com.android.dx.rop.annotation.Annotation
All Implemented Interfaces:
ToHuman, Comparable<Annotation>

public final class Annotation extends MutabilityControl implements Comparable<Annotation>, ToHuman
An annotation on an element of a class. Annotations have an associated type and additionally consist of a set of (name, value) pairs, where the names are unique.
  • Constructor Details

    • Annotation

      public Annotation(CstType type, AnnotationVisibility visibility)
      Construct an instance. It initially contains no elements.
      Parameters:
      type - non-null; type of the annotation
      visibility - non-null; the visibility of the annotation
  • Method Details

    • equals

      public boolean equals(Object other)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • compareTo

      public int compareTo(Annotation other)
      Specified by:
      compareTo in interface Comparable<Annotation>
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • toHuman

      public String toHuman()
      Return the "human" string form of this instance. This is generally less "debuggy" than toString().
      Specified by:
      toHuman in interface ToHuman
      Returns:
      non-null; the human string form
    • getType

      public CstType getType()
      Gets the type of this instance.
      Returns:
      non-null; the type
    • getVisibility

      public AnnotationVisibility getVisibility()
      Gets the visibility of this instance.
      Returns:
      non-null; the visibility
    • put

      public void put(NameValuePair pair)
      Put an element into the set of (name, value) pairs for this instance. If there is a preexisting element with the same name, it will be replaced by this method.
      Parameters:
      pair - non-null; the (name, value) pair to place into this instance
    • add

      public void add(NameValuePair pair)
      Add an element to the set of (name, value) pairs for this instance. It is an error to call this method if there is a preexisting element with the same name.
      Parameters:
      pair - non-null; the (name, value) pair to add to this instance
    • getNameValuePairs

      public Collection<NameValuePair> getNameValuePairs()
      Gets the set of name-value pairs contained in this instance. The result is always unmodifiable.
      Returns:
      non-null; the set of name-value pairs