Package com.dslplatform.json.processor
Class Analysis
java.lang.Object
com.dslplatform.json.processor.Analysis
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static classstatic classprivate static enumprivate class -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Map<String, List<Analysis.AnnotationMapping<Boolean>>> private final Map<String, List<Analysis.AnnotationMapping<Boolean>>> private final AnnotationUsagefinal TypeElementfinal DeclaredTypeprivate final TypeMirrorprivate final TypeMirrorprivate final TypeMirrorfinal TypeElementfinal DeclaredTypefinal TypeElementfinal DeclaredTypeprivate final Elementsprivate booleanprivate final booleanprivate final booleanprivate final booleanprivate final LogLevelprivate final Messagerprivate static final Map<String, NamingStrategy> private final Map<String, StructInfo> private final Typesprivate final TypeSupportprivate final UnknownTypes -
Constructor Summary
ConstructorsConstructorDescriptionAnalysis(ProcessingEnvironment processingEnv, AnnotationUsage annotationUsage, LogLevel logLevel, TypeSupport typeSupport) Analysis(ProcessingEnvironment processingEnv, AnnotationUsage annotationUsage, LogLevel logLevel, TypeSupport typeSupport, Set<String> alternativeIgnore, Map<String, List<Analysis.AnnotationMapping<Boolean>>> alternativeNonNullable, Map<String, String> alternativeAlias, Map<String, List<Analysis.AnnotationMapping<Boolean>>> alternativeMandatory, Set<String> alternativeCreators, Map<String, String> alternativeIndex, UnknownTypes unknownTypes, boolean includeFields, boolean includeBeanMethods, boolean includeExactMethods) -
Method Summary
Modifier and TypeMethodDescriptionanalyze()private voidanalyzeAttribute(StructInfo info, TypeMirror originalType, String name, Analysis.AccessElements access, String target, Stack<String> path, VariableElement field) private Map<String, Analysis.PartKind> analyzeParts(TypeMirror target) private voidanalyzePartsRecursively(TypeMirror target, Map<String, Analysis.PartKind> parts, Set<TypeMirror> usedTypes) private AnnotationMirrorannotation(ExecutableElement read, ExecutableElement write, VariableElement field, VariableElement arg) static StringbeanOrActualName(String name) Deprecated.static StringbeanOrActualName(String name, boolean isBoolean) private static booleanbooleanAnnotationValue(AnnotationMirror ann, String method, boolean defaultValue) private voidcheckParentSignatures(StructInfo info, TypeElement element, Set<StructInfo> implementations, String signature, Set<TypeElement> processed) private voidcheckRelatedProperty(TypeMirror returnType, DeclaredType discoveredBy, String access, Element inside, Element property, Stack<String> path) private voidcheckRelatedPropertyRecursively(TypeMirror returnType, DeclaredType discoveredBy, String access, Element inside, Stack<String> path) private static StringclassDiscriminator(AnnotationMirror annotation) private static StringclassName(AnnotationMirror annotation) (package private) static StringcreateTypeSignature(Types types, TypeMirror type, LinkedHashSet<TypeMirror> usedTypes, Map<String, TypeMirror> genericSignatures) (package private) static voidcreateTypeSignature(Types types, TypeMirror type, Map<String, TypeMirror> genericSignatures, StringBuilder builder) private static TypeElementdeserializeAs(AnnotationMirror annotation) private static <T extends Enum<T>>
TenumAnnotationElementValue(AnnotationMirror annotation, String elementName, Class<T> enumClass) private StringextractReturnType(Element element) private voidfindAllElements(TypeMirror type, Set<Element> usedTypes, Set<TypeMirror> processed) private ExecutableElementfindAnnotatedConstructor(Element element, DeclaredType discoveredBy) private ExecutableElementfindAnnotatedFactory(Element element, DeclaredType discoveredBy, ExecutableElement factory, BuilderInfo builder) private BuilderInfofindBuilder(Element element, DeclaredType discoveredBy, ExecutableElement builder) private TypeMirrorfindConverter(AnnotationMirror dslAnn) private TypeMirrorfindConverter(Element property) private voidprivate ElementfindElement(TypeMirror type) private ElementfindEnumConstantNameSource(TypeElement element) private Map<String, TypeMirror> private voidfindImplementations(Collection<StructInfo> structs) private List<ExecutableElement> findMatchingConstructors(Element element, boolean isMixin) private Map<String, Analysis.AccessElements> findMatchingResult(Map<String, ExecutableElement> setters, Map<String, ExecutableElement> getters, Map<String, VariableElement> arguments, Map<String, Analysis.AccessElements> fieldDetails) private StringfindNameAlias(Element property, VariableElement field, AnnotationMirror dslAnn, String member) private voidprivate voidfindStructs(Element el, DeclaredType discoveredBy, String errorMessage, Stack<String> path, ExecutableElement factory, ExecutableElement builder) private voidgetAllTypes(TypeElement element, List<TypeElement> result, Set<TypeElement> processed) private String[]getAlternativeNames(AnnotationMirror dslAnn) private AnnotationMirrorgetAnnotation(Element element, DeclaredType annotationType) private Map<String, VariableElement> getArguments(ExecutableElement element) private Map<String, Analysis.AccessElements> getBeanProperties(TypeElement element, Map<String, VariableElement> arguments, Map<String, Analysis.AccessElements> fieldDetails) private Map<String, Analysis.AccessElements> getBuilderProperties(TypeElement element, BuilderInfo builder, boolean withBeans, boolean withExact, boolean withFields) getEnumConstants(TypeElement element) private Map<String, Analysis.AccessElements> getExactProperties(TypeElement element, Map<String, VariableElement> arguments, Map<String, Analysis.AccessElements> fieldDetails) private Map<String, Analysis.AccessElements> getFieldDetails(TypeElement element) private CompiledJson.Format[]private Map<String, Analysis.AccessElements> getPublicFields(TypeElement element, Map<String, VariableElement> arguments, Set<String> processed) private List<TypeElement> getTypeHierarchy(TypeElement element) private booleanhasCustomMarker(Element property) booleanhasError()private booleanhasIgnoredAnnotation(Element property, AnnotationMirror dslAnn, VariableElement field) private booleanhasMandatoryAnnotation(Element property, AnnotationMirror dslAnn) private booleanhasNonNullable(Element property, VariableElement field, AnnotationMirror dslAnn) private JsonAttribute.IncludePolicyincludeToMinimalValue(AnnotationMirror annotation) private intindex(Element property, AnnotationMirror dslAnn) private booleanprivate booleanisCompatibileCollection(TypeMirror left, TypeMirror rawCollection) private booleanisCompatibleType(TypeMirror left, TypeMirror right) private booleanisFullMatch(AnnotationMirror dslAnn) private static booleanprivate booleanisRawType(TypeMirror target) private booleanisSupportedEnumNameType(Element element) private StringjsonObjectReaderPath(Element el, boolean includeErrors) private static BooleanmatchCustomBoolean(AnnotationMirror ann, Map<String, List<Analysis.AnnotationMapping<Boolean>>> alternatives) private static IntegermatchCustomInteger(AnnotationMirror ann, Map<String, String> alternatives) private static StringmatchCustomString(AnnotationMirror ann, Map<String, String> alternatives) private NamingStrategynamingStrategy(TypeElement element, AnnotationMirror annotation) private CompiledJson.ObjectFormatPolicyobjectFormatPolicyValue(AnnotationMirror annotation) static StringobjectName(String type) private CompiledJson.BehavioronUnknownValue(AnnotationMirror annotation) private voidprintError(String message, Element element) voidprocessAnnotation(DeclaredType currentAnnotationType, Set<? extends Element> targets) processConverters(Set<? extends Element> converters) private booleanrequiresPublic(Element element) private AnnotationMirrorscanClassForAnnotation(TypeElement element, DeclaredType annotationType, ExecutableElement custom) private CompiledJson.TypeSignaturetypeSignatureValue(AnnotationMirror annotation) (package private) Stringprivate TypeMirrorunpackType(TypeMirror type) (package private) static TypeMirrorunpackType(TypeMirror type, Types types) private ConverterInfovalidateConverter(TypeElement converter, TypeMirror type) private StringvalidateDeserializeAs(TypeElement source, TypeElement target)
-
Field Details
-
annotationUsage
-
logLevel
-
unknownTypes
-
includeFields
private final boolean includeFields -
includeBeanMethods
private final boolean includeBeanMethods -
includeExactMethods
private final boolean includeExactMethods -
elements
-
types
-
messager
-
compiledJsonElement
-
compiledJsonType
-
attributeElement
-
attributeType
-
converterElement
-
converterType
-
typeSupport
-
alternativeIgnore
-
alternativeNonNullable
-
alternativeAlias
-
alternativeMandatory
-
alternativeCreators
-
alternativeIndex
-
baseListType
-
baseSetType
-
baseMapType
-
structs
-
hasError
private boolean hasError -
namingCache
-
-
Constructor Details
-
Analysis
public Analysis(ProcessingEnvironment processingEnv, AnnotationUsage annotationUsage, LogLevel logLevel, TypeSupport typeSupport) -
Analysis
public Analysis(ProcessingEnvironment processingEnv, AnnotationUsage annotationUsage, LogLevel logLevel, TypeSupport typeSupport, @Nullable Set<String> alternativeIgnore, @Nullable Map<String, List<Analysis.AnnotationMapping<Boolean>>> alternativeNonNullable, @Nullable Map<String, String> alternativeAlias, @Nullable Map<String, List<Analysis.AnnotationMapping<Boolean>>> alternativeMandatory, @Nullable Set<String> alternativeCreators, @Nullable Map<String, String> alternativeIndex, @Nullable UnknownTypes unknownTypes, boolean includeFields, boolean includeBeanMethods, boolean includeExactMethods)
-
-
Method Details
-
hasError
public boolean hasError() -
processConverters
-
processAnnotation
-
analyze
-
findConverters
-
findElement
-
findAllElements
-
validateConverter
-
getTypeHierarchy
-
getAllTypes
-
findRelatedReferences
private void findRelatedReferences() -
findGenericSignatures
-
objectName
-
unpackType
-
unpackType
-
analyzeAttribute
private void analyzeAttribute(StructInfo info, TypeMirror originalType, String name, Analysis.AccessElements access, String target, Stack<String> path, @Nullable VariableElement field) -
checkRelatedProperty
private void checkRelatedProperty(TypeMirror returnType, DeclaredType discoveredBy, String access, Element inside, Element property, Stack<String> path) -
checkRelatedPropertyRecursively
private void checkRelatedPropertyRecursively(TypeMirror returnType, DeclaredType discoveredBy, String access, Element inside, Stack<String> path) -
requiresPublic
-
findStructs
private void findStructs(Element el, DeclaredType discoveredBy, String errorMessage, Stack<String> path, @Nullable ExecutableElement factory, @Nullable ExecutableElement builder) -
validateDeserializeAs
-
findMatchingConstructors
@Nullable private List<ExecutableElement> findMatchingConstructors(Element element, boolean isMixin) -
findAnnotatedConstructor
@Nullable private ExecutableElement findAnnotatedConstructor(Element element, DeclaredType discoveredBy) -
findAnnotatedFactory
@Nullable private ExecutableElement findAnnotatedFactory(Element element, DeclaredType discoveredBy, @Nullable ExecutableElement factory, @Nullable BuilderInfo builder) -
findBuilder
@Nullable private BuilderInfo findBuilder(Element element, DeclaredType discoveredBy, @Nullable ExecutableElement builder) -
analyzeParts
-
analyzePartsRecursively
private void analyzePartsRecursively(TypeMirror target, Map<String, Analysis.PartKind> parts, Set<TypeMirror> usedTypes) -
isRawType
-
getEnumConstants
-
findEnumConstantNameSource
-
isSupportedEnumNameType
-
extractReturnType
-
printError
-
jsonObjectReaderPath
-
getArguments
-
typeWithoutAnnotations
-
createTypeSignature
static void createTypeSignature(Types types, TypeMirror type, Map<String, TypeMirror> genericSignatures, StringBuilder builder) -
createTypeSignature
static String createTypeSignature(Types types, TypeMirror type, LinkedHashSet<TypeMirror> usedTypes, Map<String, TypeMirror> genericSignatures) -
isCompatibleType
-
isCompatibileCollection
-
beanOrActualName
Deprecated. -
beanOrActualName
-
getBeanProperties
private Map<String,Analysis.AccessElements> getBeanProperties(TypeElement element, Map<String, VariableElement> arguments, Map<String, Analysis.AccessElements> fieldDetails) -
findMatchingResult
private Map<String,Analysis.AccessElements> findMatchingResult(Map<String, ExecutableElement> setters, Map<String, ExecutableElement> getters, Map<String, VariableElement> arguments, Map<String, Analysis.AccessElements> fieldDetails) -
isAppendableCollection
-
getExactProperties
private Map<String,Analysis.AccessElements> getExactProperties(TypeElement element, Map<String, VariableElement> arguments, Map<String, Analysis.AccessElements> fieldDetails) -
getPublicFields
private Map<String,Analysis.AccessElements> getPublicFields(TypeElement element, Map<String, VariableElement> arguments, Set<String> processed) -
getFieldDetails
-
getBuilderProperties
private Map<String,Analysis.AccessElements> getBuilderProperties(TypeElement element, BuilderInfo builder, boolean withBeans, boolean withExact, boolean withFields) -
findImplementations
-
checkParentSignatures
private void checkParentSignatures(StructInfo info, TypeElement element, Set<StructInfo> implementations, String signature, Set<TypeElement> processed) -
getAlternativeNames
-
isFullMatch
-
index
-
annotation
@Nullable private AnnotationMirror annotation(@Nullable ExecutableElement read, @Nullable ExecutableElement write, @Nullable VariableElement field, @Nullable VariableElement arg) -
hasIgnoredAnnotation
private boolean hasIgnoredAnnotation(Element property, @Nullable AnnotationMirror dslAnn, @Nullable VariableElement field) -
scanClassForAnnotation
@Nullable private AnnotationMirror scanClassForAnnotation(TypeElement element, DeclaredType annotationType, @Nullable ExecutableElement custom) -
getAnnotation
-
hasNonNullable
private boolean hasNonNullable(Element property, @Nullable VariableElement field, @Nullable AnnotationMirror dslAnn) -
deserializeAs
-
namingStrategy
@Nullable private NamingStrategy namingStrategy(TypeElement element, @Nullable AnnotationMirror annotation) -
classDiscriminator
-
className
-
hasMandatoryAnnotation
-
booleanAnnotationValue
private static boolean booleanAnnotationValue(AnnotationMirror ann, String method, boolean defaultValue) -
onUnknownValue
-
typeSignatureValue
@Nullable private CompiledJson.TypeSignature typeSignatureValue(@Nullable AnnotationMirror annotation) -
objectFormatPolicyValue
private CompiledJson.ObjectFormatPolicy objectFormatPolicyValue(@Nullable AnnotationMirror annotation) -
includeToMinimalValue
-
getFormats
-
enumAnnotationElementValue
-
isMinified
-
findConverter
-
findConverter
-
findNameAlias
@Nullable private String findNameAlias(Element property, @Nullable VariableElement field, @Nullable AnnotationMirror dslAnn, String member) -
hasCustomMarker
-
matchCustomBoolean
@Nullable private static Boolean matchCustomBoolean(AnnotationMirror ann, Map<String, List<Analysis.AnnotationMapping<Boolean>>> alternatives) -
matchCustomString
-
matchCustomInteger
-