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 aSpanrecord class. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.keys()Returns a list of the keys that are associated with this span.intlength()Returns the value of thelengthrecord component.line()Returns the value of thelinerecord component.intoffset()Returns the offset from the start of the text to the start of this span.token()Returns the value of thetokenrecord component.final StringtoString()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 thelinerecord component.- Returns:
- the value of the
linerecord component
-
length
public int length()Returns the value of thelengthrecord component. -
token
Returns the value of thetokenrecord component.- Returns:
- the value of the
tokenrecord component
-