public interface SerializationRule
| Modifier and Type | Method and Description |
|---|---|
boolean |
apply(SerializationClass type,
SerializationContext context,
List<SerializationRule> rules,
boolean serializing)
Apply the rule to the given type, knowing the given context.
|
default boolean |
canInstantiate(TypeDefinition type,
SerializationContext context)
During deserialization, when a type needs to be instantiated, this method is called to know
if this rule is providing a custom way to instantiate the given type.
|
default Object |
convertSerializationValue(Object value,
TypeDefinition type,
SerializationContext context)
Before to serialize a value, this method is called in order to give the opportunity to convert to another value.
|
default TypeDefinition |
getDeserializationType(TypeDefinition type,
SerializationContext context)
Can be used to change a type during deserialization, in a similar way as the method
convertSerializationValue during serialization.
|
default Object |
getDeserializationValue(Object value,
TypeDefinition type,
SerializationContext context)
Can be used to change the deserialization, in a similar way as the method
convertSerializationValue during serialization.
|
default Object |
instantiate(TypeDefinition type,
SerializationContext context)
Called if the method canInstantiate previously returned true during deserialization.
|
boolean |
isEquivalent(SerializationRule rule)
Check if this rule is equivalent to the given rule.
|
default void |
onInstantiation(TypeDefinition type,
Object instance,
SerializationContext context)
Called each time a type is instantiated during deserialization.
|
boolean apply(SerializationClass type, SerializationContext context, List<SerializationRule> rules, boolean serializing) throws SerializationException
SerializationExceptionboolean isEquivalent(SerializationRule rule)
default Object convertSerializationValue(Object value, TypeDefinition type, SerializationContext context) throws SerializationException
SerializationExceptiondefault TypeDefinition getDeserializationType(TypeDefinition type, SerializationContext context)
default Object getDeserializationValue(Object value, TypeDefinition type, SerializationContext context) throws SerializationException
SerializationExceptiondefault boolean canInstantiate(TypeDefinition type, SerializationContext context)
default Object instantiate(TypeDefinition type, SerializationContext context) throws SerializationException
SerializationExceptiondefault void onInstantiation(TypeDefinition type, Object instance, SerializationContext context) throws SerializationException
SerializationExceptionCopyright © 2019. All rights reserved.