Package com.dslplatform.json.processor
Class CompiledJsonAnnotationProcessor
- java.lang.Object
-
- javax.annotation.processing.AbstractProcessor
-
- com.dslplatform.json.processor.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
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static classCompiledJsonAnnotationProcessor.Options
-
Field Summary
Fields Modifier and Type Field Description private AnnotationUsageannotationUsageprivate static java.lang.StringCONFIGprivate java.lang.StringconfigurationFileNameprivate static java.util.Set<java.lang.String>Creatorsprivate static java.util.Map<java.lang.String,java.lang.String>Defaultsprivate java.lang.StringgeneratedMarkerprivate static java.lang.StringGRADLE_OPTION_AGGREGATINGprivate static java.lang.StringGRADLE_OPTION_ISOLATINGprivate static java.util.Map<java.lang.String,java.lang.String>Indexesprivate static java.util.Map<java.lang.String,OptimizedConverter>InlinedConvertersprivate javax.lang.model.element.TypeElementjacksonCreatorElementprivate javax.lang.model.type.DeclaredTypejacksonCreatorTypeprivate javax.lang.model.element.TypeElementjsonbCreatorElementprivate javax.lang.model.type.DeclaredTypejsonbCreatorTypeprivate static java.util.Set<java.lang.String>JsonIgnoreprivate static java.util.Map<java.lang.String,java.util.List<Analysis.AnnotationMapping<java.lang.Boolean>>>JsonRequiredprivate LogLevellogLevelprivate static java.util.Map<java.lang.String,java.util.List<Analysis.AnnotationMapping<java.lang.Boolean>>>NonNullableprivate static java.util.Map<java.lang.String,java.lang.String>PropertyAliasprivate UnknownTypesunknownTypesprivate booleanwithJacksonprivate booleanwithJsonbprivate booleanwithNullable
-
Constructor Summary
Constructors Constructor Description CompiledJsonAnnotationProcessor()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private static voidbuildCode(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, java.lang.String generatedMarker)private static booleanbuildRootConfiguration(java.io.Writer code, java.lang.String configurationName, java.util.Map<java.lang.String,StructInfo> configurations, javax.annotation.processing.ProcessingEnvironment processingEnv)(package private) static java.lang.StringfindConverterName(StructInfo structInfo)java.util.Set<java.lang.String>getSupportedOptions()javax.lang.model.SourceVersiongetSupportedSourceVersion()voidinit(javax.annotation.processing.ProcessingEnvironment processingEnv)private static booleanisAssignableFrom(java.util.Set<java.lang.reflect.Type> known, java.lang.reflect.Type test)private static voidmixin(java.io.Writer code, boolean writeOnly, StructInfo si, java.lang.String className)booleanprocess(java.util.Set<? extends javax.lang.model.element.TypeElement> annotations, javax.annotation.processing.RoundEnvironment roundEnv)private voidsaveToServiceConfigFile(java.util.List<java.lang.String> configurations, java.util.List<javax.lang.model.element.Element> elements)
-
-
-
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
-
CONFIG
private static final java.lang.String CONFIG
- See Also:
- Constant Field Values
-
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
-
logLevel
private LogLevel logLevel
-
annotationUsage
private AnnotationUsage annotationUsage
-
unknownTypes
private UnknownTypes unknownTypes
-
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
-
-
Method Detail
-
init
public void init(javax.annotation.processing.ProcessingEnvironment processingEnv)
- Specified by:
initin interfacejavax.annotation.processing.Processor- Overrides:
initin classjavax.annotation.processing.AbstractProcessor
-
getSupportedOptions
public java.util.Set<java.lang.String> getSupportedOptions()
- Specified by:
getSupportedOptionsin interfacejavax.annotation.processing.Processor- Overrides:
getSupportedOptionsin classjavax.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:
processin interfacejavax.annotation.processing.Processor- Specified by:
processin classjavax.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:
getSupportedSourceVersionin interfacejavax.annotation.processing.Processor- Overrides:
getSupportedSourceVersionin classjavax.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
-
-