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 |
Method Summary
| Modifier and Type | Method | Description |
|---|---|---|
| protected abstract T | self() | |
| protected abstract K | serializeKey(Object key) | |
| protected N | serialize(Object jvmInstance) | Creates the appropriate AstNode (Scalar, Sequence, or Map) based on the Java value type. |
| protected M | serializeObject(Object jvmInstance) | |
| protected L | serializeList(List<?> list) | Serializes a List into a YamlSequence. |
| protected M | serializeMap(Map, ?> map) | |
| 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 jvmType) | Converts an AST structure back into a Java object of the specified type. |
| protected List<Field> | getAllSerializableFields(Class<?> jvmType) | Retrieves all declared fields for a class and all its superclasses (excluding Object). |
| protected TypeDescriptor<?> | getTypeDescriptor(Type jvmType) | |
| protected TypeDescriptor<?> | getTypeDescriptor(Class<?> jvmType) | |
| 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(DiagnosticCode code, 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)
serialize
protected N serialize(Object jvmInstance)
Creates the appropriate AstNode (Scalar, Sequence, or Map) based on the Java value type.
serializeObject
protected M serializeObject(Object jvmInstance)
serializeList
protected L serializeList(List<?> list)
Serializes a List into a YamlSequence.
serializeMap
protected M serializeMap(Map, ?> map)
deserialize
protected C deserialize(AstNode node, TypeReference
Converts an AST structure back into a Java object of the generic type referenced by typeRef.
Throws:
deserialize
protected C deserialize(AstNode node, Type jvmType)
Converts an AST structure back into a Java object of the specified type.
Throws:
getAllSerializableFields
protected List<Field> getAllSerializableFields(Class<?> jvmType)
Retrieves all declared fields for a class and all its superclasses (excluding Object).
getTypeDescriptor
@io.github.qishr.cascara.common.annotation.Nullable
protected TypeDescriptor<?> getTypeDescriptor(Type jvmType)
getTypeDescriptor
@io.github.qishr.cascara.common.annotation.Nullable
protected TypeDescriptor<?> getTypeDescriptor(Class<?> jvmType)
setupSerializer
protected void setupSerializer()
setOptions
public T setOptions(LanguageOptions<?> options)
getServiceProperties
public Properties getServiceProperties()
registerTypeDescriptor
public T registerTypeDescriptor(TypeDescriptor<?> typeDescriptor)
Specified By:
error
protected SerializerException error(Throwable t, Object[] details)
warn
protected void warn(DiagnosticCode code, 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)