Class KeyBuilder

java.lang.Object
org.simpleframework.xml.core.KeyBuilder

class KeyBuilder extends Object
The KeyBuilder is 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 class 
    The Key object represents an object that can be used in a hash container.
    private static enum 
    The KeyType enumeration is used to differentiate keys created for attributes from those created from elements.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private final Label
    This is the label that the keys should be built with.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructor for the KeyBuilder object.
  • Method Summary

    Modifier and Type
    Method
    Description
    This generates a key for the Label object that this represents.
    private String
    getKey(String[] list)
    This generates a key for the Label object that this represents.
    private Object
    This generates a key for the Label object that this represents.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • label

      private final Label label
      This is the label that the keys should be built with.
  • Constructor Details

    • KeyBuilder

      public KeyBuilder(Label label)
      Constructor for the KeyBuilder object. 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 Details

    • getKey

      public Object getKey() throws Exception
      This generates a key for the Label object 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:
      Exception
    • getKey

      private Object getKey(KeyBuilder.KeyType type) throws Exception
      This generates a key for the Label object 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:
      Exception
    • getKey

      private String getKey(String[] list) throws Exception
      This generates a key for the Label object 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:
      Exception