Skip to content

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

Interface ScalarDescriptor

java.lang.Object
        io.github.qishr.cascara.common.lang.type.ScalarDescriptor

All Implemented Interfaces:
    TypeDescriptor

All Known Implementing Classes:
    AbstractScalarDescriptor


public interface ScalarDescriptor

Method Summary

Modifier and Type Method Description
public abstract T toJvmType(String text) Converts the text into the JVM type specified by this TypeDescriptor.
public abstract Object toPrimitive(T jvmInstance) Converts the JVM type specified by this TypeDescriptor into a JSON Schema primitive type.
public abstract String getFormat() Retuns the JSON Schema format used by this TypeDescriptor.
public abstract String getContentEncoding() Returns the JSON Schema contentEncoding use by this TypeDescriptor.
public default void populateSchema(MapAstNode node)

Method Details

toJvmType

public abstract T toJvmType(String text)

Converts the text into the JVM type specified by this TypeDescriptor.


toPrimitive

public abstract Object toPrimitive(T jvmInstance)

Converts the JVM type specified by this TypeDescriptor into a JSON Schema primitive type.

Returns:

One of: null, string, integer (JVM Long), number (JVM Double), boolean.


getFormat

public abstract String getFormat()

Retuns the JSON Schema format used by this TypeDescriptor.


getContentEncoding

public abstract String getContentEncoding()

Returns the JSON Schema contentEncoding use by this TypeDescriptor.


populateSchema

public default void populateSchema(MapAstNode node)

Specified By:

TypeDescriptor