Class KeyBuilder


  • class KeyBuilder
    extends java.lang.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  KeyBuilder.Key
      The Key object represents an object that can be used in a hash container.
      private static class  KeyBuilder.KeyType
      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 Label label
      This is the label that the keys should be built with.
    • Constructor Summary

      Constructors 
      Constructor Description
      KeyBuilder​(Label label)
      Constructor for the KeyBuilder object.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.Object getKey()
      This generates a key for the Label object that this represents.
      private java.lang.String getKey​(java.lang.String[] list)
      This generates a key for the Label object that this represents.
      private java.lang.Object getKey​(KeyBuilder.KeyType type)
      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 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 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 Detail

      • getKey

        public java.lang.Object getKey()
                                throws java.lang.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:
        java.lang.Exception
      • getKey

        private java.lang.Object getKey​(KeyBuilder.KeyType type)
                                 throws java.lang.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:
        java.lang.Exception
      • getKey

        private java.lang.String getKey​(java.lang.String[] list)
                                 throws java.lang.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:
        java.lang.Exception