com.google.gdata.model
Class AttributeKey<D>

java.lang.Object
  extended by com.google.gdata.model.MetadataKey<D>
      extended by com.google.gdata.model.AttributeKey<D>
Type Parameters:
D - the datatype of the attribute
All Implemented Interfaces:
java.lang.Comparable<MetadataKey<?>>

public final class AttributeKey<D>
extends MetadataKey<D>

A key referring to a particular attribute. Holds the ID of the attribute and the expected datatype. Attribute keys support value-based equality, natural ordering, and matching.


Method Summary
 int compareTo(MetadataKey<?> other)
          Compares first on ID, then on datatype.
 boolean equals(java.lang.Object obj)
           
 int hashCode()
           
 boolean matches(MetadataKey<?> other)
          Returns true if this key is a match for the given key.
static AttributeKey<java.lang.String> of(QName id)
          Construct and return a new attribute key with the default datatype of String.
static
<T> AttributeKey<T>
of(QName id, java.lang.Class<? extends T> datatype)
          Construct and return a new attribute key with the given id and datatype.
 java.lang.String toString()
           
 
Methods inherited from class com.google.gdata.model.MetadataKey
getDatatype, getId
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Method Detail

of

public static AttributeKey<java.lang.String> of(QName id)
Construct and return a new attribute key with the default datatype of String. The id must not be null.


of

public static <T> AttributeKey<T> of(QName id,
                                     java.lang.Class<? extends T> datatype)
Construct and return a new attribute key with the given id and datatype. Both id and datatype must not be null, or a NullPointerException will be thrown.


matches

public boolean matches(MetadataKey<?> other)
Returns true if this key is a match for the given key. This key is a match for the other key if the other key is also an attribute key and if its ID and datatype match.

Specified by:
matches in class MetadataKey<D>

compareTo

public int compareTo(MetadataKey<?> other)
Compares first on ID, then on datatype.


hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

toString

public java.lang.String toString()
Overrides:
toString in class MetadataKey<D>