public class LombokSupport extends Object implements BuilderFrameworkSupport
Modifier and Type | Field and Description |
---|---|
static List<String> |
NONNULL_ANNOTATIONS
The list of annotations that Lombok treats as non-null.
|
Constructor and Description |
---|
LombokSupport(CalledMethodsAnnotatedTypeFactory atypeFactory)
Create a new LombokSupport.
|
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. |
public LombokSupport(CalledMethodsAnnotatedTypeFactory atypeFactory)
atypeFactory
- the typechecker's type factorypublic boolean isBuilderBuildMethod(ExecutableElement candidateBuildElement)
BuilderFrameworkSupport
build
method on a Builder
type for the builder
framework.isBuilderBuildMethod
in interface BuilderFrameworkSupport
candidateBuildElement
- a methodtrue
if candidateBuildElement
is a build
method on a Builder
type for the builder frameworkpublic void handleBuilderBuildMethod(AnnotatedTypeMirror.AnnotatedExecutableType builderBuildType)
BuilderFrameworkSupport
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.
handleBuilderBuildMethod
in interface BuilderFrameworkSupport
builderBuildType
- the type of a method that is the build
method (as determined by
BuilderFrameworkSupport.isBuilderBuildMethod(ExecutableElement)
) for a builderpublic boolean isToBuilderMethod(ExecutableElement candidateToBuilderElement)
BuilderFrameworkSupport
toBuilder
method on a type generated by the builder
framework.isToBuilderMethod
in interface BuilderFrameworkSupport
candidateToBuilderElement
- a methodtrue
if candidateToBuilderElement
is a toBuilder
method on a
type generated by the builder frameworkpublic void handleToBuilderMethod(AnnotatedTypeMirror.AnnotatedExecutableType toBuilderType)
BuilderFrameworkSupport
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.handleToBuilderMethod
in interface BuilderFrameworkSupport
toBuilderType
- the type of a method that is the toBuilder
method (as determined
by BuilderFrameworkSupport.isToBuilderMethod(ExecutableElement)
) for a type that has an associated builderpublic void handleConstructor(NewClassTree tree, AnnotatedTypeMirror type)
BuilderFrameworkSupport
@
CalledMethods
) to a constructor call.handleConstructor
in interface BuilderFrameworkSupport
tree
- a constructor calltype
- type of the call expression