Package com.kazforge.jsonapi.diagnostic
Record Class SourceLocation
java.lang.Object
java.lang.Record
com.kazforge.jsonapi.diagnostic.SourceLocation
- All Implemented Interfaces:
Serializable
public record SourceLocation(int lineNumber, int columnNumber, long charOffset, long byteOffset)
extends Record
implements Serializable
Backend-independent payload-safe source position for a document-read diagnostic. The current
Jackson adapters populate it from parser positions reported through caller-configured Jackson.
The value contains line, column, and character/byte offsets only, never source text. A
negative component is unavailable; UNKNOWN has no available components.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final SourceLocationLocation when the current backend did not report a usable position. -
Constructor Summary
ConstructorsConstructorDescriptionSourceLocation(int lineNumber, int columnNumber, long charOffset, long byteOffset) Creates an instance of aSourceLocationrecord class. -
Method Summary
Modifier and TypeMethodDescriptionlongReturns the value of thebyteOffsetrecord component.longReturns the value of thecharOffsetrecord component.intReturns the value of thecolumnNumberrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.booleanisKnown()Returns whether at least one position component is available.intReturns the value of thelineNumberrecord component.final StringtoString()Returns a string representation of this record class.
-
Field Details
-
UNKNOWN
Location when the current backend did not report a usable position.
-
-
Constructor Details
-
SourceLocation
public SourceLocation(int lineNumber, int columnNumber, long charOffset, long byteOffset) Creates an instance of aSourceLocationrecord class.- Parameters:
lineNumber- the value for thelineNumberrecord componentcolumnNumber- the value for thecolumnNumberrecord componentcharOffset- the value for thecharOffsetrecord componentbyteOffset- the value for thebyteOffsetrecord component
-
-
Method Details
-
isKnown
public boolean isKnown()Returns whether at least one position component is available. -
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. All components in this record class are compared with '=='. -
lineNumber
public int lineNumber()Returns the value of thelineNumberrecord component.- Returns:
- the value of the
lineNumberrecord component
-
columnNumber
public int columnNumber()Returns the value of thecolumnNumberrecord component.- Returns:
- the value of the
columnNumberrecord component
-
charOffset
public long charOffset()Returns the value of thecharOffsetrecord component.- Returns:
- the value of the
charOffsetrecord component
-
byteOffset
public long byteOffset()Returns the value of thebyteOffsetrecord component.- Returns:
- the value of the
byteOffsetrecord component
-