public static abstract class BuilderASTTransformation.AbstractBuilderStrategy
extends Object
implements BuilderASTTransformation.BuilderStrategy
Base class for builder generation strategies.
| Modifiers | Name | Description |
|---|---|---|
protected static class |
BuilderASTTransformation.AbstractBuilderStrategy.PropertyInfo |
Holds information about a builder property. |
| Type Params | Return Type | Name and description |
|---|---|---|
|
protected void |
checkKnownField(BuilderASTTransformation transform, AnnotationNode anno, String name, List<FieldNode> fields)Reports an error when no field in fields is named
name. |
|
protected void |
checkKnownProperty(BuilderASTTransformation transform, AnnotationNode anno, String name, List<PropertyInfo> properties)Reports an error when name is not a property in
properties. |
|
protected List<FieldNode> |
getFields(BuilderASTTransformation transform, AnnotationNode anno, ClassNode buildee)Returns the property fields the builder should see. |
|
protected boolean |
getIncludeExclude(BuilderASTTransformation transform, AnnotationNode anno, ClassNode cNode, List<String> excludes, List<String> includes)Fills excludes and includes from anno.
|
|
protected static List<PropertyInfo> |
getPropertyInfoFromBeanInfo(ClassNode cNode, List<String> includes, List<String> excludes, boolean allNames)Lists writable, non-hidden JavaBean properties of cNode
via Introspector. |
|
protected static List<PropertyInfo> |
getPropertyInfoFromClassNode(ClassNode cNode, List<String> includes, List<String> excludes)Lists instance property fields of cNode, skipping internal
names. |
|
protected static List<PropertyInfo> |
getPropertyInfoFromClassNode(ClassNode cNode, List<String> includes, List<String> excludes, boolean allNames)Lists instance property fields of cNode. |
|
protected List<PropertyInfo> |
getPropertyInfoFromClassNode(BuilderASTTransformation transform, AnnotationNode anno, ClassNode cNode, List<String> includes, List<String> excludes, boolean allNames, boolean allProperties)Lists properties of cNode, then property fields from
getFields whose names were not already seen. |
|
protected List<PropertyInfo> |
getPropertyInfos(BuilderASTTransformation transform, AnnotationNode anno, ClassNode buildee, List<String> excludes, List<String> includes, boolean allNames, boolean allProperties)Lists the properties the builder should copy. |
|
protected String |
getSetterName(String prefix, String fieldName)Builds a setter name. |
|
protected boolean |
unsupportedAttribute(BuilderASTTransformation transform, AnnotationNode anno, String memberName)Reports memberName when this strategy does not support it.
|
|
protected boolean |
unsupportedAttribute(BuilderASTTransformation transform, AnnotationNode anno, String memberName, String extraMessage)Reports an error when memberName is set to something other
than the undefined marker. |
Reports an error when no field in fields is named
name. The error text calls name a property.
transform - transformation that records the erroranno - annotation the error is reported againstname - field name that was requestedfields - fields this strategy knows about Reports an error when name is not a property in
properties.
transform - transformation that records the erroranno - annotation the error is reported againstname - property name that was requestedproperties - properties this strategy knows about Returns the property fields the builder should see. When
anno sets includeSuperProperties to true, fields
from superclasses are included; otherwise only the instance
property fields of buildee are returned.
transform - transformation that reads the annotation memberanno - the @Builder annotationbuildee - class being built Fills excludes and includes from anno.
An includes member replaces includes; an
excludes member is appended. When includes is
absent and excludes is still empty, the lists are
filled from a @TupleConstructor on cNode if one
is present. A one-element includes list holding the
undefined marker is treated as no includes.
transform - transformation that reads members and reports errorsanno - the @Builder annotationcNode - class that may carry @TupleConstructorexcludes - names to exclude; this method appends to itincludes - names to include; this method may clear and refill itfalse when both includes and excludes are supplied Lists writable, non-hidden JavaBean properties of cNode
via Introspector. Filtering matches
AbstractASTTransformation.shouldSkipUndefinedAware.
An introspection failure leaves the list collected so far, which
may be empty.
cNode - class to introspect; it must already be loadableincludes - names to keep; null does not filter, and an empty
list drops every nameexcludes - names to drop, or nullallNames - true to keep internal names Lists instance property fields of cNode, skipping internal
names. Same as the four-argument form with allNames false.
cNode - class whose property fields are collectedincludes - names to keep; an empty or null list keeps every
name that is not excludedexcludes - names to drop, or null Lists instance property fields of cNode. A name in
excludes is dropped. When includes is non-empty,
a name absent from it is dropped. When allNames is false,
an internal name is dropped as well.
cNode - class whose property fields are collectedincludes - names to keep; empty or null does not filterexcludes - names to drop, or nullallNames - true to keep internal names Lists properties of cNode, then property fields from
getFields whose names were not already seen. Superclass
properties and static properties are not taken from the property
walk. When allProperties is true, JavaBean getters that
have no field are included. Include, exclude, and internal-name
filtering matches getPropertyInfoFromClassNode(ClassNode, List, List, boolean).
transform - transformation passed to getFieldsanno - annotation passed to getFieldscNode - class whose properties are collectedincludes - names to keep; empty or null does not filterexcludes - names to drop, or nullallNames - true to keep internal namesallProperties - true to include getters with no field Lists the properties the builder should copy. A buildee
with no module is read with
getPropertyInfoFromBeanInfo, and allProperties
is ignored. Otherwise the properties come from the AST.
transform - transformation passed through to the AST walkanno - annotation passed through to the AST walkbuildee - class being builtexcludes - names to drop, or nullincludes - names to keep, or nullallNames - true to keep internal namesallProperties - true to include getters with no field
on the AST path Builds a setter name. An empty prefix yields
fieldName unchanged. Otherwise the result is
prefix plus fieldName with its first character
upper-cased.
prefix - setter prefix, possibly emptyfieldName - property name, with at least one character Reports memberName when this strategy does not support it.
Same as the four-argument form with an empty extra message.
transform - transformation that records the erroranno - annotation being processedmemberName - annotation member to reject when it is settrue when an error was recorded Reports an error when memberName is set to something other
than the undefined marker. A missing member, an undefined string,
or an undefined class is accepted. extraMessage is
appended, with a leading space, when it is not empty.
transform - transformation that records the erroranno - annotation being processedmemberName - annotation member to reject when it is setextraMessage - text appended to the error, or emptytrue when an error was recorded