Package org.simpleframework.xml.core
Class KeyBuilder.Key
java.lang.Object
org.simpleframework.xml.core.KeyBuilder.Key
- Enclosing class:
KeyBuilder
The
Key
object represents an object that can be
used in a hash container. The hashCode
and the
equals
method will ensure that a label with the
same XPath options will hash to the same position.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final KeyBuilder.KeyType
This is the type of key that this represents.private final String
This is the value that is used to provide the hash code. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
This is used to compare keys and determine equality.boolean
equals
(KeyBuilder.Key key) This is used to compare keys and determine equality.int
hashCode()
This returns the hash code for the key.toString()
This returns the string representation of the key.
-
Field Details
-
type
This is the type of key that this represents. -
value
This is the value that is used to provide the hash code.
-
-
Constructor Details
-
Key
Constructor for theKey
object. This requires the label and a key type to create a unique key. The key type allows keys based on attributes to be differentiated from those created for elements.- Parameters:
type
- this is the type that the key is created forvalue
- this is the value used for the hash code- Throws:
Exception
-
-
Method Details
-
equals
This is used to compare keys and determine equality. If the key value is the same and the key type is the same then the key is considered equal, even if the labels are different. -
equals
This is used to compare keys and determine equality. If the key value is the same and the key type is the same then the key is considered equal, even if the labels are different.- Parameters:
key
- this is the value to compared to this- Returns:
- this returns true if the object is equal
-
hashCode
public int hashCode()This returns the hash code for the key. The hash code is generated from the internal string the key represents. -
toString
This returns the string representation of the key. This is used for debugging purposes in order to determine what the key was generated from.
-