public interface BuilderFrameworkSupport
enableFramework
in CalledMethodsAnnotatedTypeFactory
.
Every method in this class is permitted to do nothing (or always return false). The work that each method must do is particular to the builder framework being supported.
Modifier and Type | Method and Description |
---|---|
void |
handleBuilderBuildMethod(AnnotatedTypeMirror.AnnotatedExecutableType builderBuildType)
Hook for adding annotations to a build() method (i.e.
|
void |
handleConstructor(NewClassTree tree,
AnnotatedTypeMirror type)
Hook for adding annotations (e.g.,
@ CalledMethods ) to a constructor call. |
void |
handleToBuilderMethod(AnnotatedTypeMirror.AnnotatedExecutableType toBuilderType)
Hook for supporting a builder framework's
toBuilder routine. |
boolean |
isBuilderBuildMethod(ExecutableElement candidateBuildElement)
Determines if a method is a
build method on a Builder type for the builder
framework. |
boolean |
isToBuilderMethod(ExecutableElement candidateToBuilderElement)
Determines if a method is a
toBuilder method on a type generated by the builder
framework. |
boolean isToBuilderMethod(ExecutableElement candidateToBuilderElement)
toBuilder
method on a type generated by the builder
framework.candidateToBuilderElement
- a methodtrue
if candidateToBuilderElement
is a toBuilder
method on a
type generated by the builder frameworkvoid handleToBuilderMethod(AnnotatedTypeMirror.AnnotatedExecutableType toBuilderType)
toBuilder
routine. Typically, the returned
Builder has had all of its required setters invoked. So, implementations of this method
should add a CalledMethods
annotation
capturing this fact.toBuilderType
- the type of a method that is the toBuilder
method (as determined
by isToBuilderMethod(ExecutableElement)
) for a type that has an associated
builderboolean isBuilderBuildMethod(ExecutableElement candidateBuildElement)
build
method on a Builder
type for the builder
framework.candidateBuildElement
- a methodtrue
if candidateBuildElement
is a build
method on a Builder
type for the builder frameworkvoid handleBuilderBuildMethod(AnnotatedTypeMirror.AnnotatedExecutableType builderBuildType)
For build
methods on Builder
types, implementations of this method should
determine the required properties and add a corresponding CalledMethods
annotation to the type of the
receiver parameter.
builderBuildType
- the type of a method that is the build
method (as determined
by isBuilderBuildMethod(ExecutableElement)
) for a buildervoid handleConstructor(NewClassTree tree, AnnotatedTypeMirror type)
@
CalledMethods
) to a constructor call.tree
- a constructor calltype
- type of the call expression