Class CompiledJsonAnnotationProcessor

  • All Implemented Interfaces:
    javax.annotation.processing.Processor

    @SupportedAnnotationTypes({"com.dslplatform.json.CompiledJson","com.dslplatform.json.JsonAttribute","com.dslplatform.json.JsonConverter","com.dslplatform.json.JsonValue","com.fasterxml.jackson.annotation.JsonCreator","javax.json.bind.annotation.JsonbCreator"})
    public class CompiledJsonAnnotationProcessor
    extends javax.annotation.processing.AbstractProcessor
    • Field Detail

      • JsonIgnore

        private static final java.util.Set<java.lang.String> JsonIgnore
      • NonNullable

        private static final java.util.Map<java.lang.String,​java.util.List<Analysis.AnnotationMapping<java.lang.Boolean>>> NonNullable
      • PropertyAlias

        private static final java.util.Map<java.lang.String,​java.lang.String> PropertyAlias
      • JsonRequired

        private static final java.util.Map<java.lang.String,​java.util.List<Analysis.AnnotationMapping<java.lang.Boolean>>> JsonRequired
      • Creators

        private static final java.util.Set<java.lang.String> Creators
      • Indexes

        private static final java.util.Map<java.lang.String,​java.lang.String> Indexes
      • InlinedConverters

        private static final java.util.Map<java.lang.String,​OptimizedConverter> InlinedConverters
      • Defaults

        private static final java.util.Map<java.lang.String,​java.lang.String> Defaults
      • GRADLE_OPTION_ISOLATING

        private static final java.lang.String GRADLE_OPTION_ISOLATING
        See Also:
        Constant Field Values
      • GRADLE_OPTION_AGGREGATING

        private static final java.lang.String GRADLE_OPTION_AGGREGATING
        See Also:
        Constant Field Values
      • withJackson

        private boolean withJackson
      • withJsonb

        private boolean withJsonb
      • withNullable

        private boolean withNullable
      • configurationFileName

        private java.lang.String configurationFileName
      • generatedMarker

        private java.lang.String generatedMarker
      • jacksonCreatorElement

        private javax.lang.model.element.TypeElement jacksonCreatorElement
      • jacksonCreatorType

        private javax.lang.model.type.DeclaredType jacksonCreatorType
      • jsonbCreatorElement

        private javax.lang.model.element.TypeElement jsonbCreatorElement
      • jsonbCreatorType

        private javax.lang.model.type.DeclaredType jsonbCreatorType
    • Constructor Detail

      • CompiledJsonAnnotationProcessor

        public CompiledJsonAnnotationProcessor()
    • Method Detail

      • init

        public void init​(javax.annotation.processing.ProcessingEnvironment processingEnv)
        Specified by:
        init in interface javax.annotation.processing.Processor
        Overrides:
        init in class javax.annotation.processing.AbstractProcessor
      • getSupportedOptions

        public java.util.Set<java.lang.String> getSupportedOptions()
        Specified by:
        getSupportedOptions in interface javax.annotation.processing.Processor
        Overrides:
        getSupportedOptions in class javax.annotation.processing.AbstractProcessor
      • isAssignableFrom

        private static boolean isAssignableFrom​(java.util.Set<java.lang.reflect.Type> known,
                                                java.lang.reflect.Type test)
      • process

        public boolean process​(java.util.Set<? extends javax.lang.model.element.TypeElement> annotations,
                               javax.annotation.processing.RoundEnvironment roundEnv)
        Specified by:
        process in interface javax.annotation.processing.Processor
        Specified by:
        process in class javax.annotation.processing.AbstractProcessor
      • saveToServiceConfigFile

        private void saveToServiceConfigFile​(java.util.List<java.lang.String> configurations,
                                             java.util.List<javax.lang.model.element.Element> elements)
      • getSupportedSourceVersion

        public javax.lang.model.SourceVersion getSupportedSourceVersion()
        Specified by:
        getSupportedSourceVersion in interface javax.annotation.processing.Processor
        Overrides:
        getSupportedSourceVersion in class javax.annotation.processing.AbstractProcessor
      • findConverterName

        static java.lang.String findConverterName​(StructInfo structInfo)
      • buildCode

        private static void buildCode​(java.io.Writer code,
                                      javax.annotation.processing.ProcessingEnvironment environment,
                                      java.lang.String className,
                                      StructInfo si,
                                      java.util.Map<java.lang.String,​StructInfo> structs,
                                      TypeSupport typeSupport,
                                      boolean allowUnknown,
                                      @Nullable
                                      java.lang.String generatedMarker)
                               throws java.io.IOException
        Throws:
        java.io.IOException
      • mixin

        private static void mixin​(java.io.Writer code,
                                  boolean writeOnly,
                                  StructInfo si,
                                  java.lang.String className)
                           throws java.io.IOException
        Throws:
        java.io.IOException
      • buildRootConfiguration

        private static boolean buildRootConfiguration​(java.io.Writer code,
                                                      java.lang.String configurationName,
                                                      java.util.Map<java.lang.String,​StructInfo> configurations,
                                                      javax.annotation.processing.ProcessingEnvironment processingEnv)
                                               throws java.io.IOException
        Throws:
        java.io.IOException