Package org.simpleframework.xml.core
Class LabelKey
- java.lang.Object
-
- org.simpleframework.xml.core.LabelKey
-
class LabelKey extends java.lang.Object
TheLabelKey
object is used to create a key that will uniquely identify an annotated method within a class. Creation of a key in this way enables annotated methods and fields to be cached and looked up using a key.
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.Class
label
This is the annotation type that this is represented in the key.private java.lang.String
name
This is the name of the field or method that is represented.private java.lang.Class
owner
This is the declaring class where the method or field is defined.private java.lang.Class
type
This is the type that is represented by the annotated contact.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(java.lang.Object value)
This is used to determine if two keys are the same.private boolean
equals(LabelKey key)
This is used to determine if two keys are the same.int
hashCode()
This returns the unique has code used for this key.java.lang.String
toString()
This returns a string representation of this key.
-
-
-
Field Detail
-
label
private final java.lang.Class label
This is the annotation type that this is represented in the key.
-
owner
private final java.lang.Class owner
This is the declaring class where the method or field is defined.
-
type
private final java.lang.Class type
This is the type that is represented by the annotated contact.
-
name
private final java.lang.String name
This is the name of the field or method that is represented.
-
-
Constructor Detail
-
LabelKey
public LabelKey(Contact contact, java.lang.annotation.Annotation label)
Constructor for theLabelKey
object. This is used to create an object using the contact and associated annotation that can uniquely identity the label.- Parameters:
contact
- this is the contact that has been annotatedlabel
- this is the primary annotation associated with this
-
-
Method Detail
-
hashCode
public int hashCode()
This returns the unique has code used for this key. The hash code is created by combining the hash code of the method or field name with the hash code of the declaring class.- Overrides:
hashCode
in classjava.lang.Object
- Returns:
- this returns the hash code associated with this key
-
equals
public boolean equals(java.lang.Object value)
This is used to determine if two keys are the same. Ultimately two keys are equal if they represent the same contact and annotation from that contact. If everything is equal by identity then this will be true.- Overrides:
equals
in classjava.lang.Object
- Parameters:
value
- this is the value to compare to this key- Returns:
- this returns true if both keys have the same data
-
equals
private boolean equals(LabelKey key)
This is used to determine if two keys are the same. Ultimately two keys are equal if they represent the same contact and annotation from that contact. If everything is equal by identity then this will be true.- Parameters:
key
- this is the value to compare to this key- Returns:
- this returns true if both keys have the same data
-
toString
public java.lang.String toString()
This returns a string representation of this key. It contains the name and the declaring class for the method or field. This is primarily used for debugging purposes.- Overrides:
toString
in classjava.lang.Object
- Returns:
- this returns a string representation of this key
-
-