Top Description Inners Constructors Methods
com.google.auto.value.extension.serializable.serializer.impl

public final Class ImmutableMapSerializerExtension

extends Object
implements SerializerExtension
Class Inheritance
All Implemented Interfaces
com.google.auto.value.extension.serializable.serializer.interfaces.SerializerExtension
Annotations
@AutoService:SerializerExtension
Imports
com.google.auto.common.MoreTypes, com.google.auto.service.AutoService, com.google.auto.value.extension.serializable.serializer.interfaces.Serializer, .SerializerExtension, .SerializerFactory, com.google.auto.value.extension.serializable.serializer.runtime.FunctionWithExceptions, com.google.common.collect.ImmutableMap, com.squareup.javapoet.CodeBlock, java.util.Optional, java.util.function.Function, javax.annotation.processing.ProcessingEnvironment, javax.lang.model.element.TypeElement, javax.lang.model.type.TypeKind, javax.lang.model.type.TypeMirror

A SerializerExtension that deserializes objects inside an ImmutableMap.

Enables unserializable objects inside an ImmutableMap to be serializable.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
private static javax.lang.model.type.TypeMirror
getKeyType(javax.lang.model.type.TypeMirror type)

public Optional<Serializer>
getSerializer(javax.lang.model.type.TypeMirror
the type being serialized
typeMirror
,
SerializerFactory
a SerializerFactory that can be used to serialize nested types
factory
,
javax.annotation.processing.ProcessingEnvironment
the processing environment provided by the annotation processing framework
processingEnv
)

Implements com.google.auto.value.extension.serializable.serializer.interfaces.SerializerExtension.getSerializer.

Returns a Serializer if this SerializerExtension applies to the given type.

private static javax.lang.model.type.TypeMirror
getValueType(javax.lang.model.type.TypeMirror type)

private static boolean
isImmutableMap(javax.lang.model.type.TypeMirror type)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

ImmutableMapSerializerExtensionback to summary
public ImmutableMapSerializerExtension()

Method Detail

getKeyTypeback to summary
private static javax.lang.model.type.TypeMirror getKeyType(javax.lang.model.type.TypeMirror type)
getSerializerback to summary
public Optional<Serializer> getSerializer(javax.lang.model.type.TypeMirror typeMirror, SerializerFactory factory, javax.annotation.processing.ProcessingEnvironment processingEnv)

Implements com.google.auto.value.extension.serializable.serializer.interfaces.SerializerExtension.getSerializer.

Doc from com.google.auto.value.extension.serializable.serializer.interfaces.SerializerExtension.getSerializer.

Returns a Serializer if this SerializerExtension applies to the given type. Otherwise, Optional.empty is returned.

Parameters
typeMirror:javax.lang.model.type.TypeMirror

the type being serialized

factory:SerializerFactory

a SerializerFactory that can be used to serialize nested types

processingEnv:javax.annotation.processing.ProcessingEnvironment

the processing environment provided by the annotation processing framework

Annotations
@Override
getValueTypeback to summary
private static javax.lang.model.type.TypeMirror getValueType(javax.lang.model.type.TypeMirror type)
isImmutableMapback to summary
private static boolean isImmutableMap(javax.lang.model.type.TypeMirror type)
com.google.auto.value.extension.serializable.serializer.impl back to summary

private Class ImmutableMapSerializerExtension.ImmutableMapSerializer

extends Object
implements Serializer
Class Inheritance
  • java.lang.Object
  • com.google.auto.value.extension.serializable.serializer.impl.ImmutableMapSerializerExtension.ImmutableMapSerializer
All Implemented Interfaces
com.google.auto.value.extension.serializable.serializer.interfaces.Serializer

Field Summary

Modifier and TypeField and Description
private final SerializerFactory
private final javax.lang.model.type.TypeMirror
private final javax.lang.model.type.TypeMirror
private final Serializer
private final javax.annotation.processing.ProcessingEnvironment
private final javax.lang.model.type.TypeMirror
private final javax.lang.model.type.TypeMirror
private final Serializer

Constructor Summary

AccessConstructor and Description
pack-priv
ImmutableMapSerializer(javax.lang.model.type.TypeMirror keyType, javax.lang.model.type.TypeMirror valueType, Serializer keyTypeSerializer, Serializer valueTypeSerializer, SerializerFactory factory, javax.annotation.processing.ProcessingEnvironment processingEnv)

Method Summary

Modifier and TypeMethod and Description
public CodeBlock
fromProxy(CodeBlock expression)

Implements com.google.auto.value.extension.serializable.serializer.interfaces.Serializer.fromProxy.

Creates an expression that converts the proxy type back to the original type.

private CodeBlock
generateKeyMapFunction(javax.lang.model.type.TypeMirror originalType, javax.lang.model.type.TypeMirror transformedType, Function<CodeBlock, CodeBlock> proxyMap)

private CodeBlock
generateValueMapFunction(javax.lang.model.type.TypeMirror originalType, javax.lang.model.type.TypeMirror transformedType, Function<CodeBlock, CodeBlock> proxyMap)

public javax.lang.model.type.TypeMirror
proxyFieldType()

Implements com.google.auto.value.extension.serializable.serializer.interfaces.Serializer.proxyFieldType.

The proxy type the original unserializable type will be mapped to.

public CodeBlock
toProxy(CodeBlock expression)

Implements com.google.auto.value.extension.serializable.serializer.interfaces.Serializer.toProxy.

Creates an expression that converts the original type to the proxy type.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

factoryback to summary
private final SerializerFactory factory
keyProxyTypeback to summary
private final javax.lang.model.type.TypeMirror keyProxyType
keyTypeback to summary
private final javax.lang.model.type.TypeMirror keyType
keyTypeSerializerback to summary
private final Serializer keyTypeSerializer
processingEnvback to summary
private final javax.annotation.processing.ProcessingEnvironment processingEnv
valueProxyTypeback to summary
private final javax.lang.model.type.TypeMirror valueProxyType
valueTypeback to summary
private final javax.lang.model.type.TypeMirror valueType
valueTypeSerializerback to summary
private final Serializer valueTypeSerializer

Constructor Detail

ImmutableMapSerializerback to summary
pack-priv ImmutableMapSerializer(javax.lang.model.type.TypeMirror keyType, javax.lang.model.type.TypeMirror valueType, Serializer keyTypeSerializer, Serializer valueTypeSerializer, SerializerFactory factory, javax.annotation.processing.ProcessingEnvironment processingEnv)

Method Detail

fromProxyback to summary
public CodeBlock fromProxy(CodeBlock expression)

Implements com.google.auto.value.extension.serializable.serializer.interfaces.Serializer.fromProxy.

Doc from com.google.auto.value.extension.serializable.serializer.interfaces.Serializer.fromProxy.

Creates an expression that converts the proxy type back to the original type.

Annotations
@Override
generateKeyMapFunctionback to summary
private CodeBlock generateKeyMapFunction(javax.lang.model.type.TypeMirror originalType, javax.lang.model.type.TypeMirror transformedType, Function<CodeBlock, CodeBlock> proxyMap)
generateValueMapFunctionback to summary
private CodeBlock generateValueMapFunction(javax.lang.model.type.TypeMirror originalType, javax.lang.model.type.TypeMirror transformedType, Function<CodeBlock, CodeBlock> proxyMap)
proxyFieldTypeback to summary
public javax.lang.model.type.TypeMirror proxyFieldType()

Implements com.google.auto.value.extension.serializable.serializer.interfaces.Serializer.proxyFieldType.

Doc from com.google.auto.value.extension.serializable.serializer.interfaces.Serializer.proxyFieldType.

The proxy type the original unserializable type will be mapped to.

Annotations
@Override
toProxyback to summary
public CodeBlock toProxy(CodeBlock expression)

Implements com.google.auto.value.extension.serializable.serializer.interfaces.Serializer.toProxy.

Doc from com.google.auto.value.extension.serializable.serializer.interfaces.Serializer.toProxy.

Creates an expression that converts the original type to the proxy type.

Annotations
@Override