Package io.github.qishr.cascara.lang.json.ast
Class JsonScalar
java.lang.Object
io.github.qishr.cascara.lang.json.ast.JsonNode
io.github.qishr.cascara.lang.json.ast.JsonScalar
All Implemented Interfaces:
ScalarAstNode<JsonNode>
public class JsonScalar
extends JsonNode
Constructor Summary
| Constructor | Description |
|---|---|
| JsonScalar(JsonToken token, PrimitiveType primitiveType, boolean isKey, JsonOptions options) | Constructor for use in parsers. |
| JsonScalar(Object jvmValue, QuoteStyle quoteStyle, boolean isKey, JsonOptions options) | |
| JsonScalar(Object content, JsonOptions options) | |
| JsonScalar(Object jvmValue, QuoteStyle quoteStyle) | A programmatic and serializer constructor. |
| JsonScalar(Object jvmValue) | A programmatic and serializer constructor. |
| JsonScalar(JsonToken tok, Object jvmValue) | |
| JsonScalar(Object jvmValue, boolean isKey) | A programmatic and serializer constructor. |
| JsonScalar() | The default constructor |
Method Summary
| Modifier and Type | Method | Description |
|---|---|---|
| public PrimitiveType | getPrimitiveType() | |
| public QuoteStyle | getQuoteStyle() | |
| public JsonScalar | setQuoteStyle(QuoteStyle style) | |
| public String | getLexeme() | |
| public String | getContent() | |
| public Object | getPrimitive() | Returns the dialect-aware JVM value (cached). |
| public String | asString() | Returns the logical clean text value, stripped of outer formatting and escape markers. |
| public int | asInteger() | |
| public int | asInteger(int defaultValue) | |
| public double | asDouble() | |
| public double | asDouble(double defaultValue) | |
| public boolean | asBoolean() | |
| public boolean | asBoolean(boolean defaultValue) | Returns the boolean value of the scalar, if there is one, otherwise the specified default is returned. |
| public List<JsonNode> | getChildren() | Scalars are leaf nodes and have no children. |
| public boolean | equals(Object o) | |
| public int | hashCode() | |
| public String | toString() | |
| public JsonOptions | getOptions() |
Methods inherited from JsonNode
getEndColumn, getEndLine, getComments, getStartColumn, getToken, setToken, addComment, getStartLine
Method Details
getPrimitiveType
public PrimitiveType getPrimitiveType()
Specified By:
getQuoteStyle
public QuoteStyle getQuoteStyle()
Specified By:
setQuoteStyle
public JsonScalar setQuoteStyle(QuoteStyle style)
Specified By:
getLexeme
public String getLexeme()
Specified By:
getContent
public String getContent()
Specified By:
getPrimitive
public Object getPrimitive()
Returns the dialect-aware JVM value (cached).
Specified By:
asString
public String asString()
Returns the logical clean text value, stripped of outer formatting and escape markers.
Specified By:
asInteger
public int asInteger()
Specified By:
asInteger
public int asInteger(int defaultValue)
Specified By:
asDouble
public double asDouble()
Specified By:
asDouble
public double asDouble(double defaultValue)
Specified By:
asBoolean
public boolean asBoolean()
Specified By:
asBoolean
public boolean asBoolean(boolean defaultValue)
Returns the boolean value of the scalar, if there is one, otherwise the specified default is returned.
Specified By:
getChildren
public List<JsonNode> getChildren()
Scalars are leaf nodes and have no children.
Overrides:
equals
public boolean equals(Object o)
Overrides:
hashCode
public int hashCode()
Overrides:
toString
public String toString()
Overrides:
getOptions
public JsonOptions getOptions()