Package org.simpleframework.xml.core
Class KeyBuilder
- java.lang.Object
-
- org.simpleframework.xml.core.KeyBuilder
-
class KeyBuilder extends java.lang.ObjectTheKeyBuilderis used build unique keys for labels using the paths defined in those labels. Building keys in this way ensures that labels can be uniquely identified. This helps in constructor injection when we need to match a parameter with a label to determine which constructor signature should be used.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static classKeyBuilder.KeyTheKeyobject represents an object that can be used in a hash container.private static classKeyBuilder.KeyTypeTheKeyTypeenumeration is used to differentiate keys created for attributes from those created from elements.
-
Constructor Summary
Constructors Constructor Description KeyBuilder(Label label)Constructor for theKeyBuilderobject.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.ObjectgetKey()This generates a key for theLabelobject that this represents.private java.lang.StringgetKey(java.lang.String[] list)This generates a key for theLabelobject that this represents.private java.lang.ObjectgetKey(KeyBuilder.KeyType type)This generates a key for theLabelobject that this represents.
-
-
-
Field Detail
-
label
private final Label label
This is the label that the keys should be built with.
-
-
Constructor Detail
-
KeyBuilder
public KeyBuilder(Label label)
Constructor for theKeyBuilderobject. This is used to create a builder using the provided label. A key will be unique based on the XPath options for the label.- Parameters:
label- this is the label to build he key for
-
-
Method Detail
-
getKey
public java.lang.Object getKey() throws java.lang.ExceptionThis generates a key for theLabelobject that this represents. Each key is generated based on the label type and the XPath options for the label. This ensures that similar labels create the same key values.- Returns:
- this returns a key to represent the label
- Throws:
java.lang.Exception
-
getKey
private java.lang.Object getKey(KeyBuilder.KeyType type) throws java.lang.Exception
This generates a key for theLabelobject that this represents. Each key is generated based on the label type and the XPath options for the label. This ensures that similar labels create the same key values.- Parameters:
type- this is the type that this key builder represents- Returns:
- this returns a key to represent the label
- Throws:
java.lang.Exception
-
getKey
private java.lang.String getKey(java.lang.String[] list) throws java.lang.ExceptionThis generates a key for theLabelobject that this represents. Each key is generated based on the label type and the XPath options for the label. This ensures that similar labels create the same key values.- Parameters:
list- this is the list of XPath expressions to be used- Returns:
- this returns a key to represent the label
- Throws:
java.lang.Exception
-
-