Package uk.blankaspect.common.json
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.-
Field Summary
Fields inherited from interface uk.blankaspect.common.text.ITextSpan
OFFSET_COMPARATOR, OFFSET_LENGTH_COMPARATOR
-
Constructor Summary
ConstructorsConstructorDescriptionSpan
(JsonText.Line line, int length, JsonText.Token token) Creates an instance of aSpan
record class. -
Method Summary
Modifier and TypeMethodDescriptionfinal boolean
Indicates whether some other object is "equal to" this one.final int
hashCode()
Returns a hash code value for this object.keys()
Returns a list of the keys that are associated with this span.int
length()
Returns the value of thelength
record component.line()
Returns the value of theline
record component.int
offset()
Returns the offset from the start of the text to the start of this span.token()
Returns the value of thetoken
record component.final String
toString()
Returns a string representation of this record class.
-
Constructor Details
-
Method Details
-
offset
public int offset()Returns the offset from the start of the text to the start of this span. -
keys
Returns a list of the keys that are associated with this span. -
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. -
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. -
equals
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 withObjects::equals(Object,Object)
; primitive components are compared with '=='. -
line
Returns the value of theline
record component.- Returns:
- the value of the
line
record component
-
length
public int length()Returns the value of thelength
record component. -
token
Returns the value of thetoken
record component.- Returns:
- the value of the
token
record component
-