Package com.dslplatform.json.processor
Class ConverterTemplate
- java.lang.Object
-
- com.dslplatform.json.processor.ConverterTemplate
-
class ConverterTemplate extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description private java.io.Writercodeprivate Contextcontextprivate EnumTemplateenumTemplate
-
Constructor Summary
Constructors Constructor Description ConverterTemplate(Context context, EnumTemplate enumTemplate)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private voidasFormatConverter(StructInfo si, java.lang.String name, java.lang.String className, boolean binding)private voidbuildArrayType(javax.lang.model.type.TypeMirror type, java.util.Map<java.lang.String,java.lang.Integer> typeVariableIndexes, java.util.Map<java.lang.String,javax.lang.model.type.TypeMirror> genericSignatures)private static intcalcWeakHash(java.lang.String name)private voidcheckMandatory(java.util.List<AttributeInfo> attributes, int start)private voidcheckMandatory(java.util.List<AttributeInfo> attributes, java.lang.String padding)private voidcreateConverter(StructInfo si, java.lang.String typeName, java.lang.String typeArguments)private voidcreateLazyReaderAndWriter(AttributeInfo attr, javax.lang.model.type.TypeMirror mirror, java.lang.String namePrefix, StructInfo si)private java.lang.StringcreateTypeSignature(javax.lang.model.type.TypeMirror type, java.util.Map<java.lang.String,java.lang.Integer> typeVariableIndexes, java.util.Map<java.lang.String,javax.lang.model.type.TypeMirror> genericSignatures)private voidcreateTypeSignature(javax.lang.model.type.TypeMirror type, java.util.Map<java.lang.String,java.lang.Integer> typeVariableIndexes, java.util.Map<java.lang.String,javax.lang.model.type.TypeMirror> genericSignatures, java.lang.StringBuilder builder)(package private) voidemptyArray(StructInfo si, java.lang.String className)(package private) voidemptyObject(StructInfo si, java.lang.String className)private java.lang.StringextractSingleType(AttributeInfo attr, java.util.List<java.lang.String> types)private java.lang.StringextractTypeSignature(AttributeInfo attr, javax.lang.model.type.TypeMirror type, java.util.Map<java.lang.String,javax.lang.model.type.TypeMirror> genericSignatures)(package private) voidfactoryForGenericConverter(StructInfo si)(package private) voidfromArray(StructInfo si, java.lang.String className)(package private) voidfromObject(StructInfo si, java.lang.String className)private voidhandleSwitch(StructInfo si, java.lang.String alignment, boolean useInstance)private booleanisStaticEnum(AttributeInfo attr)private voidprocessPropertyValue(AttributeInfo attr, java.lang.String alignment, boolean useInstance, java.util.Map<java.lang.String,javax.lang.model.type.TypeMirror> genericSignatures)private voidreturnInstance(java.lang.String alignment, StructInfo info, java.lang.String className)private voidwriteArray(java.lang.String className, java.util.List<AttributeInfo> sortedAttributes)private voidwriteDiscriminator(StructInfo si)private voidwriteObject(StructInfo si, java.lang.String className, java.util.List<AttributeInfo> sortedAttributes)private voidwriteProperty(AttributeInfo attr, boolean checkedDefault, java.lang.String alignment)
-
-
-
Field Detail
-
code
private final java.io.Writer code
-
context
private final Context context
-
enumTemplate
private final EnumTemplate enumTemplate
-
-
Constructor Detail
-
ConverterTemplate
ConverterTemplate(Context context, EnumTemplate enumTemplate)
-
-
Method Detail
-
isStaticEnum
private boolean isStaticEnum(AttributeInfo attr)
-
factoryForGenericConverter
void factoryForGenericConverter(StructInfo si) throws java.io.IOException
- Throws:
java.io.IOException
-
createConverter
private void createConverter(StructInfo si, java.lang.String typeName, java.lang.String typeArguments) throws java.io.IOException
- Throws:
java.io.IOException
-
asFormatConverter
private void asFormatConverter(StructInfo si, java.lang.String name, java.lang.String className, boolean binding) throws java.io.IOException
- Throws:
java.io.IOException
-
extractTypeSignature
private java.lang.String extractTypeSignature(AttributeInfo attr, javax.lang.model.type.TypeMirror type, java.util.Map<java.lang.String,javax.lang.model.type.TypeMirror> genericSignatures)
-
extractSingleType
private java.lang.String extractSingleType(AttributeInfo attr, @Nullable java.util.List<java.lang.String> types)
-
createLazyReaderAndWriter
private void createLazyReaderAndWriter(AttributeInfo attr, javax.lang.model.type.TypeMirror mirror, java.lang.String namePrefix, StructInfo si) throws java.io.IOException
- Throws:
java.io.IOException
-
createTypeSignature
private java.lang.String createTypeSignature(javax.lang.model.type.TypeMirror type, java.util.Map<java.lang.String,java.lang.Integer> typeVariableIndexes, java.util.Map<java.lang.String,javax.lang.model.type.TypeMirror> genericSignatures)
-
createTypeSignature
private void createTypeSignature(javax.lang.model.type.TypeMirror type, java.util.Map<java.lang.String,java.lang.Integer> typeVariableIndexes, java.util.Map<java.lang.String,javax.lang.model.type.TypeMirror> genericSignatures, java.lang.StringBuilder builder)
-
buildArrayType
private void buildArrayType(javax.lang.model.type.TypeMirror type, java.util.Map<java.lang.String,java.lang.Integer> typeVariableIndexes, java.util.Map<java.lang.String,javax.lang.model.type.TypeMirror> genericSignatures) throws java.io.IOException- Throws:
java.io.IOException
-
emptyObject
void emptyObject(StructInfo si, java.lang.String className) throws java.io.IOException
- Throws:
java.io.IOException
-
fromObject
void fromObject(StructInfo si, java.lang.String className) throws java.io.IOException
- Throws:
java.io.IOException
-
writeDiscriminator
private void writeDiscriminator(StructInfo si) throws java.io.IOException
- Throws:
java.io.IOException
-
writeObject
private void writeObject(StructInfo si, java.lang.String className, java.util.List<AttributeInfo> sortedAttributes) throws java.io.IOException
- Throws:
java.io.IOException
-
checkMandatory
private void checkMandatory(java.util.List<AttributeInfo> attributes, int start) throws java.io.IOException
- Throws:
java.io.IOException
-
checkMandatory
private void checkMandatory(java.util.List<AttributeInfo> attributes, java.lang.String padding) throws java.io.IOException
- Throws:
java.io.IOException
-
emptyArray
void emptyArray(StructInfo si, java.lang.String className) throws java.io.IOException
- Throws:
java.io.IOException
-
fromArray
void fromArray(StructInfo si, java.lang.String className) throws java.io.IOException
- Throws:
java.io.IOException
-
returnInstance
private void returnInstance(java.lang.String alignment, StructInfo info, java.lang.String className) throws java.io.IOException- Throws:
java.io.IOException
-
writeArray
private void writeArray(java.lang.String className, java.util.List<AttributeInfo> sortedAttributes) throws java.io.IOException- Throws:
java.io.IOException
-
writeProperty
private void writeProperty(AttributeInfo attr, boolean checkedDefault, java.lang.String alignment) throws java.io.IOException
- Throws:
java.io.IOException
-
handleSwitch
private void handleSwitch(StructInfo si, java.lang.String alignment, boolean useInstance) throws java.io.IOException
- Throws:
java.io.IOException
-
processPropertyValue
private void processPropertyValue(AttributeInfo attr, java.lang.String alignment, boolean useInstance, java.util.Map<java.lang.String,javax.lang.model.type.TypeMirror> genericSignatures) throws java.io.IOException
- Throws:
java.io.IOException
-
calcWeakHash
private static int calcWeakHash(java.lang.String name)
-
-