public abstract class PropertyCodeGenerator
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
static class |
PropertyCodeGenerator.Type
Property type.
|
| Modifier and Type | Field and Description |
|---|---|
protected Metadata |
metadata |
protected Metadata.Property |
property |
| Constructor and Description |
|---|
PropertyCodeGenerator(Metadata metadata,
Metadata.Property property) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
addAccessorAnnotations(SourceBuilder code) |
abstract void |
addBuilderFieldAccessors(SourceBuilder code)
Add the accessor methods for the property to the builder's source code.
|
abstract void |
addBuilderFieldDeclaration(SourceBuilder code)
Add the field declaration for the property to the builder's source code.
|
abstract void |
addClearField(Block code)
Adds a clear call for the property given a template builder to the builder's source code.
|
abstract void |
addFinalFieldAssignment(SourceBuilder code,
Excerpt finalField,
java.lang.String builder)
Add the final assignment of the property to the value object's source code.
|
void |
addGetterAnnotations(SourceBuilder code)
Adds method annotations for the value type getter method.
|
abstract void |
addMergeFromBuilder(Block code,
java.lang.String builder)
Add a merge from builder for the property to the builder's source code.
|
abstract void |
addMergeFromValue(Block code,
java.lang.String value)
Add a merge from value for the property to the builder's source code.
|
void |
addPartialFieldAssignment(SourceBuilder code,
Excerpt finalField,
java.lang.String builder)
Add the final assignment of the property to the partial value object's source code.
|
void |
addReadValueFragment(SourceBuilder code,
Excerpt finalField)
Adds a fragment converting the value object's field to the property's type.
|
void |
addSetBuilderFromPartial(Block code,
java.lang.String builder)
Sets the property on a builder from within a partial value's toBuilder() method.
|
abstract void |
addSetFromResult(SourceBuilder code,
Excerpt builder,
Excerpt variable)
Adds a set call for the property from a function result to the builder's source code.
|
void |
addValueFieldDeclaration(SourceBuilder code,
FieldAccess finalField)
Add the field declaration for the property to the value's source code.
|
boolean |
equals(java.lang.Object obj) |
java.util.Set<? extends StaticExcerpt> |
getStaticExcerpts()
Returns excerpts for any static types or methods added by this generator.
|
PropertyCodeGenerator.Type |
getType()
Returns whether the property is required, optional, or has a default.
|
int |
hashCode() |
java.lang.String |
toString() |
protected final Metadata metadata
protected final Metadata.Property property
public PropertyCodeGenerator(Metadata metadata, Metadata.Property property)
public PropertyCodeGenerator.Type getType()
public void addValueFieldDeclaration(SourceBuilder code, FieldAccess finalField)
public abstract void addBuilderFieldDeclaration(SourceBuilder code)
public abstract void addBuilderFieldAccessors(SourceBuilder code)
public abstract void addFinalFieldAssignment(SourceBuilder code, Excerpt finalField, java.lang.String builder)
public void addPartialFieldAssignment(SourceBuilder code, Excerpt finalField, java.lang.String builder)
public abstract void addMergeFromValue(Block code, java.lang.String value)
public abstract void addMergeFromBuilder(Block code, java.lang.String builder)
public void addSetBuilderFromPartial(Block code, java.lang.String builder)
public void addGetterAnnotations(SourceBuilder code)
public void addReadValueFragment(SourceBuilder code, Excerpt finalField)
public abstract void addSetFromResult(SourceBuilder code, Excerpt builder, Excerpt variable)
public abstract void addClearField(Block code)
public java.util.Set<? extends StaticExcerpt> getStaticExcerpts()
protected void addAccessorAnnotations(SourceBuilder code)
public boolean equals(java.lang.Object obj)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic java.lang.String toString()
toString in class java.lang.Object