Interface PyishSerializable
-
- All Superinterfaces:
PyWrapper
- All Known Implementing Classes:
JinjavaInterpreter
,LazyReference
,NamedParameter
,Namespace
,PyishDate
,SnakeCaseAccessibleMap
@Beta public interface PyishSerializable extends PyWrapper
-
-
Field Summary
Fields Modifier and Type Field Description static com.fasterxml.jackson.databind.ObjectWriter
SELF_WRITER
-
Method Summary
All Methods Static Methods Instance Methods Default Methods Modifier and Type Method Description default <T extends Appendable & CharSequence>
TappendPyishString(T appendable)
Allows for a class to append the custom string representation in Jinjava.default void
writePyishSelf(com.fasterxml.jackson.core.JsonGenerator jsonGenerator, com.fasterxml.jackson.databind.SerializerProvider serializerProvider)
Allows for a class to specify how its pyish string representation will be written to the json generator.static String
writeValueAsString(Object value)
Utility method to assist implementations of PyishSerializable in overridingtoPyishString()
.
-
-
-
Method Detail
-
appendPyishString
default <T extends Appendable & CharSequence> T appendPyishString(T appendable) throws IOException
Allows for a class to append the custom string representation in Jinjava. This method will be used bywritePyishSelf(JsonGenerator, SerializerProvider)
to specify what will be written to the json generator.- Parameters:
appendable
- Appendable to append the pyish string representation to.- Returns:
- The same appendable with an appended result
- Throws:
IOException
-
writePyishSelf
default void writePyishSelf(com.fasterxml.jackson.core.JsonGenerator jsonGenerator, com.fasterxml.jackson.databind.SerializerProvider serializerProvider) throws IOException
Allows for a class to specify how its pyish string representation will be written to the json generator.If the object's serialization can be broken up into multiple jsonGenerator writes, then this method can be overridden to do so instead of a single call to
JsonGenerator.writeRawValue(String)
.- Parameters:
jsonGenerator
- The JsonGenerator to write to.serializerProvider
- Provides default value serialization and attributes stored on the ObjectWriter if needed.- Throws:
IOException
-
-