Package io.github.qishr.cascara.common.lang.processor
Class AbstractSerializer
java.lang.Object
io.github.qishr.cascara.common.lang.processor.AbstractSerializer
All Implemented Interfaces:
Serializer
Direct Known Subtypes:
JsonSerializer, YamlSerializer
public abstract class AbstractSerializer
Field Summary
| Modifier and Type | Field | Description |
|---|---|---|
| protected int | depth | |
| protected int | depthLimit | |
| protected Reporter | reporter |
Constructor Summary
| Constructor | Description |
|---|---|
| AbstractSerializer(String contentType, AstNodeFactory |
|
| AbstractSerializer(String contentType, AstNodeFactory |
Method Summary
| Modifier and Type | Method | Description |
|---|---|---|
| protected abstract T | self() | |
| protected abstract K | serializeKey(Object key) | |
| public T | setProviderFactoryEnabled(boolean b) | |
| public T | setHeuristicMatchEnabled(boolean b) | |
| protected N | serialize(Object jvmInstance) | Creates the appropriate AstNode (Scalar, Sequence, or Map) based on the Java value type. |
| protected C | deserialize(AstNode node, TypeReference |
Converts an AST structure back into a Java object of the generic type referenced by typeRef. |
| protected C | deserialize(AstNode node, Type targetType) | Converts an AST structure back into a Java object of the specified type. |
| protected void | setupSerializer() | |
| public T | setOptions(LanguageOptions<?> options) | |
| public Properties | getServiceProperties() | |
| public T | registerTypeDescriptor(TypeDescriptor<?> typeDescriptor) | |
| protected SerializerException | error(Throwable t, Object[] details) | |
| protected void | warn(DiagnosticMessage message, Object[] details) | |
| protected void | warnInaccessible(Class<?> jvmType, Method method, Throwable t) | |
| protected void | warnInaccessible(Class<?> jvmType, Field field, Throwable t) | |
| protected void | debug(String message, Object[] details) | |
| protected void | trace(String message, Object[] details) | |
| protected void | report(Level level, String message, Object[] details) |
Field Details
depth
protected int depth
depthLimit
protected int depthLimit
reporter
protected Reporter reporter
Method Details
self
protected abstract T self()
serializeKey
protected abstract K serializeKey(Object key)
setProviderFactoryEnabled
@io.github.qishr.cascara.common.annotation.NonNull
public T setProviderFactoryEnabled(boolean b)
Specified By:
setHeuristicMatchEnabled
@io.github.qishr.cascara.common.annotation.NonNull
public T setHeuristicMatchEnabled(boolean b)
Specified By:
serialize
@io.github.qishr.cascara.common.annotation.NonNull
protected N serialize(Object jvmInstance)
Creates the appropriate AstNode (Scalar, Sequence, or Map) based on the Java value type.
deserialize
@io.github.qishr.cascara.common.annotation.Nullable
protected C deserialize(AstNode node, TypeReference
Converts an AST structure back into a Java object of the generic type referenced by typeRef.
deserialize
@io.github.qishr.cascara.common.annotation.Nullable
protected C deserialize(AstNode node, Type targetType)
Converts an AST structure back into a Java object of the specified type.
Parameters:
node - The AST node to convert.
targetType - The class type to convert to.
setupSerializer
protected void setupSerializer()
setOptions
@io.github.qishr.cascara.common.annotation.NonNull
public T setOptions(LanguageOptions<?> options)
getServiceProperties
@io.github.qishr.cascara.common.annotation.NonNull
public Properties getServiceProperties()
registerTypeDescriptor
@io.github.qishr.cascara.common.annotation.NonNull
public T registerTypeDescriptor(TypeDescriptor<?> typeDescriptor)
Specified By:
error
protected SerializerException error(Throwable t, Object[] details)
warn
protected void warn(DiagnosticMessage message, Object[] details)
warnInaccessible
protected void warnInaccessible(Class<?> jvmType, Method method, Throwable t)
warnInaccessible
protected void warnInaccessible(Class<?> jvmType, Field field, Throwable t)
debug
protected void debug(String message, Object[] details)
trace
protected void trace(String message, Object[] details)
report
protected void report(Level level, String message, Object[] details)