Record Class XmlPath

java.lang.Object
java.lang.Record
io.jenkins.plugins.configsplice.engine.xml.XmlPath

public record XmlPath(List<XmlPath.Element> elements, XmlPath.Selector selector) extends Record
A generic XML path: a chain of element steps ending in a selector (SRS section 8.7).
 configuration.'system.webServer'.security.requestFiltering.requestLimits.@maxAllowedContentLength
 configuration.location[0].'system.webServer'.handlers.add[1].@name
 configuration.appSettings.add[0].#text
 

Note the quoting of 'system.webServer': a dot always separates steps, so an element whose name contains one has to be quoted or it would be read as two steps.

The chain always starts at the document element, which is what distinguishes a generic path from the DotNetPath shorthands: a path beginning appSettings. is shorthand, one beginning configuration. is generic. That also means generic paths can reach content the shorthands deliberately cannot, such as entries nested inside <location>.

Matching is entirely lexical. An element written xdt:add in the source is matched by the path xdt:add and by nothing else; namespace URIs are never resolved and prefixes are never treated as interchangeable (SRS section 8.7.2 rule 2).

  • Constructor Details

    • XmlPath

      public XmlPath(List<XmlPath.Element> elements, XmlPath.Selector selector)
      Creates an instance of a XmlPath record class.
      Parameters:
      elements - the value for the elements record component
      selector - the value for the selector record component
  • Method Details

    • canonical

      public String canonical()
      Renders the path back into source form. Used in diagnostics; never contains a value.
    • toString

      public String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • elements

      public List<XmlPath.Element> elements()
      Returns the value of the elements record component.
      Returns:
      the value of the elements record component
    • selector

      public XmlPath.Selector selector()
      Returns the value of the selector record component.
      Returns:
      the value of the selector record component