Record Class JsonText.Span

java.lang.Object
java.lang.Record
uk.blankaspect.common.json.JsonText.Span
Record Components:
line - the line of which the span is a subsequence.
length - the length of the text of the span.
token - the token with which the span will be associated.
All Implemented Interfaces:
ITextSpan
Enclosing class:
JsonText

public static record JsonText.Span(JsonText.Line line, int length, JsonText.Token token) extends Record implements ITextSpan
This record encapsulates a subsequence of the text of a JsonText.Line that is associated with a JSON token.
  • Constructor Details

    • Span

      public Span(JsonText.Line line, int length, JsonText.Token token)
      Creates an instance of a Span record class.
      Parameters:
      line - the value for the line record component
      length - the value for the length record component
      token - the value for the token record component
  • Method Details

    • offset

      public int offset()
      Returns the offset from the start of the text to the start of this span.
      Specified by:
      offset in interface ITextSpan
      Returns:
      the offset from the start of the text to the start of this span.
    • keys

      public List<String> keys()
      Returns a list of the keys that are associated with this span.
      Specified by:
      keys in interface ITextSpan
      Returns:
      a list of the keys that are associated with this span.
    • toString

      public final 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. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with '=='.
      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.
    • line

      public JsonText.Line line()
      Returns the value of the line record component.
      Returns:
      the value of the line record component
    • length

      public int length()
      Returns the value of the length record component.
      Specified by:
      length in interface ITextSpan
      Returns:
      the value of the length record component
    • token

      public JsonText.Token token()
      Returns the value of the token record component.
      Returns:
      the value of the token record component