Package io.github.qishr.cascara.common.lang.ast
Interface ScalarAstNode
java.lang.Object
io.github.qishr.cascara.common.lang.ast.ScalarAstNode
All Implemented Interfaces:
AstNode
All Known Implementing Classes:
ReferenceScalarNode, JsonScalarNode, JsonCommentNode, YamlScalarNode
public interface ScalarAstNode
Method Summary
| Modifier and Type | Method | Description |
|---|---|---|
| public abstract QuoteStyle | getQuoteStyle() | Returns the QuoteStyle used by a node: PLAIN, SINGLE, DOUBLE, LITERAL, or FOLDED. |
| public abstract void | setQuoteStyle(QuoteStyle style) | Sets the QuoteStyle used by a node |
| public abstract String | getRaw() | Returns the exact, unparsed text block directly from the file buffer. |
| public abstract Object | getPrimitive() | Returns the Java-native representation of the scalar (e.g., Integer, Boolean, String). |
| public abstract void | setPrimitive(Object value) | Updates the logical native primitive value of this node. |
| public abstract String | asString() | |
| public abstract int | asInteger() | |
| public abstract int | asInteger(int defaultValue) | |
| public abstract double | asDouble() | |
| public abstract double | asDouble(double defaultValue) | |
| public abstract boolean | asBoolean() | |
| public abstract boolean | asBoolean(boolean defaultValue) |
Method Details
getQuoteStyle
public abstract QuoteStyle getQuoteStyle()
Returns the QuoteStyle used by a node: PLAIN, SINGLE, DOUBLE, LITERAL, or FOLDED.
setQuoteStyle
public abstract void setQuoteStyle(QuoteStyle style)
Sets the QuoteStyle used by a node
getRaw
public abstract String getRaw()
Returns the exact, unparsed text block directly from the file buffer.
getPrimitive
public abstract Object getPrimitive()
Returns the Java-native representation of the scalar (e.g., Integer, Boolean, String).
setPrimitive
public abstract void setPrimitive(Object value)
Updates the logical native primitive value of this node.This method invalidates any pre-existing raw string cache derived from a file buffer, marking the node as dirty so the emitter can contextually re-serialize the new value on the next text export pass.
asString
public abstract String asString()
Specified By:
asInteger
public abstract int asInteger()
asInteger
public abstract int asInteger(int defaultValue)
asDouble
public abstract double asDouble()
asDouble
public abstract double asDouble(double defaultValue)
asBoolean
public abstract boolean asBoolean()
asBoolean
public abstract boolean asBoolean(boolean defaultValue)