public abstract class AbstractMapperGenerator extends Object implements MapperGenerator
| Constructor and Description |
|---|
AbstractMapperGenerator() |
| Modifier and Type | Method and Description |
|---|---|
protected com.squareup.javapoet.TypeName |
abstractObjectMapper(Element element) |
protected String |
enclosingName(Element element,
String postfix) |
void |
generate(Element element) |
protected void |
generateDeserializer(TypeMirror beanType,
String packageName) |
protected void |
generateJsonMappers(TypeMirror beanType,
String packageName,
Name beanName)
generateJsonMappers.
|
protected void |
generateSerializer(TypeMirror beanType,
String packageName) |
protected static TypeMirror |
getElementType(Element element) |
protected abstract Iterable<com.squareup.javapoet.MethodSpec> |
getMapperMethods(Element element,
TypeMirror type)
getMapperMethods.
|
protected abstract Class<?> |
getSuperClass()
getSuperClass.
|
protected com.squareup.javapoet.MethodSpec |
makeConstructor(Name beanName) |
protected com.squareup.javapoet.MethodSpec |
makeNewDeserializerMethod(Element element,
TypeMirror beanType)
makeNewDeserializerMethod.
|
protected com.squareup.javapoet.MethodSpec |
makeNewSerializerMethod(TypeMirror beanType)
makeNewSerializerMethod.
|
protected static boolean |
useInterface(Element element) |
public void generate(Element element) throws IOException
generate in interface MapperGeneratorIOExceptionprotected static TypeMirror getElementType(Element element)
protected static boolean useInterface(Element element)
protected com.squareup.javapoet.TypeName abstractObjectMapper(Element element)
protected com.squareup.javapoet.MethodSpec makeConstructor(Name beanName)
protected com.squareup.javapoet.MethodSpec makeNewDeserializerMethod(Element element, TypeMirror beanType)
makeNewDeserializerMethod.
Creates method for build corresponding deserializer for given beanType. If beanType is basic type, generated code utilize existing deserializers. Otherwise, it creates instances of newly generated ones.element - beanType - protected com.squareup.javapoet.MethodSpec makeNewSerializerMethod(TypeMirror beanType)
makeNewSerializerMethod.
Creates method for build corresponding serializer for given beanType. If beanType is basic type, generated code utilize existing serializers. Otherwise, it creates instances of newly generated ones.beanType - protected abstract Iterable<com.squareup.javapoet.MethodSpec> getMapperMethods(Element element, TypeMirror type)
getMapperMethods.
element - a Element object.type - a TypeMirror object.Iterable object.protected void generateJsonMappers(TypeMirror beanType, String packageName, Name beanName)
generateJsonMappers.
Creates mapper implementation for given beanType. If beanType is generic type, create corresponding mappers for type arguments incl. their type arguments as well. All type parameters will be included as part of the name of the mapper implementation. Note that mappers are not generated for "simple" data types, since their implementation already exist.beanType - a TypeMirror object.packageName - a String object.protected void generateSerializer(TypeMirror beanType, String packageName)
protected void generateDeserializer(TypeMirror beanType, String packageName)
Copyright © 2019. All rights reserved.