Class GwtSerialization


  • class GwtSerialization
    extends java.lang.Object
    Generates GWT serialization code for @AutoValue classes also marked @GwtCompatible(serializable = true).
    • Field Detail

      • processingEnv

        private final javax.annotation.processing.ProcessingEnvironment processingEnv
      • type

        private final javax.lang.model.element.TypeElement type
    • Constructor Detail

      • GwtSerialization

        GwtSerialization​(GwtCompatibility gwtCompatibility,
                         javax.annotation.processing.ProcessingEnvironment processingEnv,
                         javax.lang.model.element.TypeElement type)
    • Method Detail

      • shouldWriteGwtSerializer

        private boolean shouldWriteGwtSerializer()
      • maybeWriteGwtSerializer

        void maybeWriteGwtSerializer​(AutoValueTemplateVars autoVars)
        Writes the GWT serializer for the given type, if appropriate. An @AutoValue class gets a GWT serializer if it is annotated with @GwtCompatible(serializable = true), where the @GwtCompatible annotation can come from any package.

        If the type is com.example.Foo then the generated AutoValue subclass is com.example.AutoValue_Foo and the GWT serializer is com.example.AutoValue_Foo_CustomFieldSerializer.

        Parameters:
        autoVars - the template variables defined for this type.
      • writeSourceFile

        private void writeSourceFile​(java.lang.String className,
                                     java.lang.String text,
                                     javax.lang.model.element.TypeElement originatingType)