public class CustomUpdateActionsGenerator extends Object
HasUpdateActions
.Modifier and Type | Field and Description |
---|---|
protected Elements |
elements |
protected Messager |
messager |
protected Types |
types |
protected TypeUtils |
typeUtils |
Constructor and Description |
---|
CustomUpdateActionsGenerator(Elements elements,
Types types,
Messager messager) |
Modifier and Type | Method and Description |
---|---|
protected void |
addSuppressWarnings(com.squareup.javapoet.MethodSpec.Builder builder) |
protected void |
copyDeprecatedAnnotation(PropertyGenModel property,
com.squareup.javapoet.MethodSpec.Builder methodSpecBuilder) |
protected void |
copyDeprecatedAnnotation(PropertyGenModel property,
com.squareup.javapoet.TypeSpec.Builder typeSpecBuilder) |
protected void |
copyJsonAnnotation(PropertyGenModel property,
com.squareup.javapoet.MethodSpec.Builder builder) |
protected com.squareup.javapoet.MethodSpec |
createConstructor(List<PropertyGenModel> properties) |
protected com.squareup.javapoet.MethodSpec |
createConstructor(List<PropertyGenModel> properties,
List<Modifier> modifiers) |
protected com.squareup.javapoet.MethodSpec |
createCopyFactoryMethod(TypeElement typeElement,
com.squareup.javapoet.ClassName returnType,
List<ExecutableElement> propertyMethods) |
protected com.squareup.javapoet.MethodSpec |
createCopyFactoryMethod(TypeElement typeElement,
com.squareup.javapoet.ClassName returnType,
List<ExecutableElement> propertyMethods,
List<PropertyGenModel> propertyGenModels) |
protected com.squareup.javapoet.MethodSpec |
createDefaultConstructor(List<Modifier> modifiers) |
protected com.squareup.javapoet.MethodSpec |
createFactoryMethod(FactoryMethod factoryMethod,
List<PropertyGenModel> properties,
com.squareup.javapoet.ClassName returnType) |
protected com.squareup.javapoet.MethodSpec |
createFactoryMethod(List<PropertyGenModel> properties,
com.squareup.javapoet.ClassName returnType,
List<String> parameterNames,
String methodName,
boolean useLowercaseBooleans) |
protected List<com.squareup.javapoet.MethodSpec> |
createFactoryMethods(FactoryMethod[] factoryMethods,
List<PropertyGenModel> properties,
com.squareup.javapoet.ClassName returnType) |
protected com.squareup.javapoet.FieldSpec |
createField(PropertyGenModel property) |
protected com.squareup.javapoet.FieldSpec |
createField(PropertyGenModel property,
List<Modifier> modifiers) |
protected com.squareup.javapoet.FieldSpec |
createField(PropertyGenModel property,
Modifier modifier) |
protected com.squareup.javapoet.FieldSpec.Builder |
createFieldBuilder(PropertyGenModel property,
Modifier modifier) |
protected com.squareup.javapoet.MethodSpec |
createGetMethod(PropertyGenModel property) |
protected com.squareup.javapoet.AnnotationSpec |
createJsonPropertyAnnotation(String jsonName) |
protected com.squareup.javapoet.ParameterSpec |
createParameter(PropertyGenModel property,
boolean useLowercaseBooleans,
boolean copyNullable) |
protected com.squareup.javapoet.ParameterSpec |
createParameter(PropertyGenModel property,
com.squareup.javapoet.TypeName parameterType,
boolean copyNullable) |
protected List<com.squareup.javapoet.ParameterSpec> |
createParameters(List<PropertyGenModel> properties,
boolean useLowercaseBooleans,
boolean copyNullable) |
protected String |
escapeJavaKeyword(String name)
Escapes the given name with an
"_" if it's a java keyword (e.g. |
protected List<String> |
expectedClassNames(ExecutableElement annotatedTypeElement) |
List<com.squareup.javapoet.JavaFile> |
generate(T annotatedTypeElement)
Generates the classes for the given annotated type element.
|
protected List<com.squareup.javapoet.TypeSpec> |
generateTypes(ExecutableElement annotatedTypeElement) |
protected List<ExecutableElement> |
getAllPropertyMethodsSorted(TypeElement typeElement)
Returns all property methods - including inherited methods - sorted by their property name.
|
protected String |
getPackageName(Element annotatedTypeElement) |
protected List<PropertyGenModel> |
getPropertyGenModels(List<ExecutableElement> propertyMethods) |
protected List<ExecutableElement> |
getPropertyMethodsSorted(TypeElement typeElement)
Returns property methods - not included inherited methods - sorted by their property name.
|
protected final Elements elements
protected final Types types
protected final Messager messager
protected final TypeUtils typeUtils
protected List<com.squareup.javapoet.TypeSpec> generateTypes(ExecutableElement annotatedTypeElement)
protected List<String> expectedClassNames(ExecutableElement annotatedTypeElement)
public final List<com.squareup.javapoet.JavaFile> generate(T annotatedTypeElement)
annotatedTypeElement
- the annotated type elementprotected com.squareup.javapoet.FieldSpec createField(PropertyGenModel property)
protected com.squareup.javapoet.FieldSpec createField(PropertyGenModel property, Modifier modifier)
protected com.squareup.javapoet.FieldSpec.Builder createFieldBuilder(PropertyGenModel property, Modifier modifier)
protected String escapeJavaKeyword(String name)
"_"
if it's a java keyword (e.g. default
.name
- the name to escapeprotected List<ExecutableElement> getAllPropertyMethodsSorted(TypeElement typeElement)
typeElement
- the type elementPropertyGenModel.getPropertyName(ExecutableElement)
protected List<ExecutableElement> getPropertyMethodsSorted(TypeElement typeElement)
typeElement
- the type elementPropertyGenModel.getPropertyName(ExecutableElement)
protected List<PropertyGenModel> getPropertyGenModels(List<ExecutableElement> propertyMethods)
protected com.squareup.javapoet.MethodSpec createGetMethod(PropertyGenModel property)
protected void copyJsonAnnotation(PropertyGenModel property, com.squareup.javapoet.MethodSpec.Builder builder)
protected void addSuppressWarnings(com.squareup.javapoet.MethodSpec.Builder builder)
protected void copyDeprecatedAnnotation(PropertyGenModel property, com.squareup.javapoet.TypeSpec.Builder typeSpecBuilder)
protected void copyDeprecatedAnnotation(PropertyGenModel property, com.squareup.javapoet.MethodSpec.Builder methodSpecBuilder)
protected com.squareup.javapoet.ParameterSpec createParameter(PropertyGenModel property, boolean useLowercaseBooleans, boolean copyNullable)
property
- the property to generate the parameteruseLowercaseBooleans
- FactoryMethod.useLowercaseBooleans()
copyNullable
- if true, an existing Nullable
annotation on the model will be copied to the parameterprotected com.squareup.javapoet.ParameterSpec createParameter(PropertyGenModel property, com.squareup.javapoet.TypeName parameterType, boolean copyNullable)
protected com.squareup.javapoet.FieldSpec createField(PropertyGenModel property, List<Modifier> modifiers)
protected com.squareup.javapoet.MethodSpec createDefaultConstructor(List<Modifier> modifiers)
protected com.squareup.javapoet.MethodSpec createConstructor(List<PropertyGenModel> properties, List<Modifier> modifiers)
protected List<com.squareup.javapoet.ParameterSpec> createParameters(List<PropertyGenModel> properties, boolean useLowercaseBooleans, boolean copyNullable)
protected com.squareup.javapoet.MethodSpec createConstructor(List<PropertyGenModel> properties)
protected com.squareup.javapoet.AnnotationSpec createJsonPropertyAnnotation(String jsonName)
protected List<com.squareup.javapoet.MethodSpec> createFactoryMethods(FactoryMethod[] factoryMethods, List<PropertyGenModel> properties, com.squareup.javapoet.ClassName returnType)
protected com.squareup.javapoet.MethodSpec createFactoryMethod(FactoryMethod factoryMethod, List<PropertyGenModel> properties, com.squareup.javapoet.ClassName returnType)
protected com.squareup.javapoet.MethodSpec createFactoryMethod(List<PropertyGenModel> properties, com.squareup.javapoet.ClassName returnType, List<String> parameterNames, String methodName, boolean useLowercaseBooleans)
protected com.squareup.javapoet.MethodSpec createCopyFactoryMethod(TypeElement typeElement, com.squareup.javapoet.ClassName returnType, List<ExecutableElement> propertyMethods)
protected com.squareup.javapoet.MethodSpec createCopyFactoryMethod(TypeElement typeElement, com.squareup.javapoet.ClassName returnType, List<ExecutableElement> propertyMethods, List<PropertyGenModel> propertyGenModels)