Skip to content

Package io.github.qishr.cascara.common.lang

Class AbstractPrimitive

java.lang.Object
        io.github.qishr.cascara.common.lang.AbstractPrimitive

Direct Known Subtypes:
    JsonPrimitive, YamlPrimitive


public abstract class AbstractPrimitive

Field Summary

Modifier and Type Field Description
protected final Object nativeValue
protected QuoteStyle quoteStyle

Constructor Summary

Constructor Description
AbstractPrimitive(Object primitiveValue)
AbstractPrimitive(Object input, QuoteStyle quoteStyle, boolean isNative)

Method Summary

Modifier and Type Method Description
protected abstract QuoteStyle inferQuoteStyle(Object value)
protected String unescapeQuotedString(String text, QuoteStyle style) Default baseline unescaping hook.
protected Object coerce(Object input) Iterates through core conversions.
protected abstract Object coerceLiteralValue(String text) Abstract hook to intercept and resolve dialect-specific keywords (e.g., booleans, nulls).
public Object unwrap()
public QuoteStyle getQuoteStyle()
public void setQuoteStyle(QuoteStyle style)
public String asString()
public double asDouble(double defaultValue)
public int asInteger(int defaultValue)
public boolean asBoolean(boolean defaultValue)
public boolean equals(Object o)
public int hashCode()
public String toString()

Field Details

nativeValue

protected final Object nativeValue


quoteStyle

protected QuoteStyle quoteStyle


Method Details

inferQuoteStyle

protected abstract QuoteStyle inferQuoteStyle(Object value)


unescapeQuotedString

protected String unescapeQuotedString(String text, QuoteStyle style)

Default baseline unescaping hook.Can be overridden if a language has specific string escape sequences.


coerce

protected Object coerce(Object input)

Iterates through core conversions.Can be overridden for language-specific nuances.


coerceLiteralValue

protected abstract Object coerceLiteralValue(String text)

Abstract hook to intercept and resolve dialect-specific keywords (e.g., booleans, nulls).


unwrap

public Object unwrap()


getQuoteStyle

public QuoteStyle getQuoteStyle()


setQuoteStyle

public void setQuoteStyle(QuoteStyle style)


asString

public String asString()


asDouble

public double asDouble(double defaultValue)


asInteger

public int asInteger(int defaultValue)


asBoolean

public boolean asBoolean(boolean defaultValue)


equals

public boolean equals(Object o)


hashCode

public int hashCode()


toString

public String toString()