Interface SerializerExtension
-
- All Known Implementing Classes:
ImmutableListSerializerExtension,ImmutableMapSerializerExtension,OptionalSerializerExtension
public interface SerializerExtensionA SerializerExtension allows unserializable types to be serialized by SerializableAutoValue.Extensions are discovered at compile time using the
ServiceLoaderAPIs, allowing them to run without any additional annotations. To be found byServiceLoader, an extension class must be public with a public no-arg constructor, and its fully-qualified name must appear in a file calledMETA-INF/services/com.google.auto.value.extension.serializable.serializer.interfaces.SerializerExtensionin a jar that is on the compiler's-classpathor-processorpath.When SerializableAutoValue maps each field in an AutoValue to a serializable proxy object, it asks each SerializerExtension whether it can generate code to make the given type serializable. A SerializerExtension replies that it can by returning a non-empty
Serializer.A SerializerExtension is also provided with a SerializerFactory, which it can use to query nested types.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Optional<Serializer>getSerializer(TypeMirror type, SerializerFactory factory, ProcessingEnvironment processingEnv)
-
-
-
Method Detail
-
getSerializer
Optional<Serializer> getSerializer(TypeMirror type, SerializerFactory factory, ProcessingEnvironment processingEnv)
Returns aSerializerif thisSerializerExtensionapplies to the giventype. Otherwise,Optional.emptyis returned.- Parameters:
type- the type being serializedfactory- aSerializerFactorythat can be used to serialize nested typesprocessingEnv- the processing environment provided by the annotation processing framework
-
-