com.android.dx.rop.annotation
Class Annotation

java.lang.Object
  extended by com.android.dx.util.MutabilityControl
      extended by 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 Summary
Annotation(CstType type, AnnotationVisibility visibility)
          Construct an instance.
 
Method Summary
 void add(NameValuePair pair)
          Add an element to the set of (name, value) pairs for this instance.
 int compareTo(Annotation other)
          
 boolean equals(Object other)
          
 Collection<NameValuePair> getNameValuePairs()
          Gets the set of name-value pairs contained in this instance.
 CstType getType()
          Gets the type of this instance.
 AnnotationVisibility getVisibility()
          Gets the visibility of this instance.
 int hashCode()
          
 void put(NameValuePair pair)
          Put an element into the set of (name, value) pairs for this instance.
 String toHuman()
          Return the "human" string form of this instance.
 String toString()
          
 
Methods inherited from class com.android.dx.util.MutabilityControl
isImmutable, isMutable, setImmutable, throwIfImmutable, throwIfMutable
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

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 Detail

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


Copyright © 2015. All rights reserved.