Package org.mapstruct.ap.spi
Class ImmutablesBuilderProvider
- java.lang.Object
-
- org.mapstruct.ap.spi.DefaultBuilderProvider
-
- org.mapstruct.ap.spi.ImmutablesBuilderProvider
-
- All Implemented Interfaces:
BuilderProvider
@Experimental("The Immutables builder provider might change in a subsequent release") public class ImmutablesBuilderProvider extends DefaultBuilderProvider
Builder provider for Immutables. A custom provider is needed because Immutables creates an implementation of an interface and that implementation has the builder. This implementation would try to find the type created by Immutables and would look for the builder in it. Only types annotated with theorg.immutables.value.Value.Immutable
are considered for this discovery.- Author:
- Filip Hrisafov
-
-
Field Summary
-
Fields inherited from class org.mapstruct.ap.spi.DefaultBuilderProvider
elementUtils, typeUtils
-
-
Constructor Summary
Constructors Constructor Description ImmutablesBuilderProvider()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected TypeElement
asImmutableElement(TypeElement typeElement)
protected BuilderInfo
findBuilderInfo(TypeElement typeElement)
Find theBuilderInfo
for the giventypeElement
.protected BuilderInfo
findBuilderInfoForImmutables(TypeElement typeElement)
protected BuilderInfo
findBuilderInfoForImmutables(TypeElement typeElement, TypeElement immutableAnnotation)
-
Methods inherited from class org.mapstruct.ap.spi.DefaultBuilderProvider
findBuilderInfo, findBuilderInfo, findBuildMethods, getTypeElement, init, isBuildMethod, isBuildMethod, isPossibleBuilderCreationMethod, shouldIgnore
-
-
-
-
Method Detail
-
findBuilderInfo
protected BuilderInfo findBuilderInfo(TypeElement typeElement)
Description copied from class:DefaultBuilderProvider
Find theBuilderInfo
for the giventypeElement
.The default implementation iterates over all the methods in
typeElement
and usesDefaultBuilderProvider.isPossibleBuilderCreationMethod(ExecutableElement, TypeElement)
andDefaultBuilderProvider.findBuildMethods(TypeElement, TypeElement)
to create theBuilderInfo
.The default implementation uses
DefaultBuilderProvider.shouldIgnore(TypeElement)
to check if thetypeElement
should be ignored.In case there are multiple
BuilderInfo
then aMoreThanOneBuilderCreationMethodException
is thrown.- Overrides:
findBuilderInfo
in classDefaultBuilderProvider
- Parameters:
typeElement
- the type element for which a builder searched- Returns:
- the
BuilderInfo
ornull
if no builder was found for the typeDefaultBuilderProvider.findBuildMethods(TypeElement, TypeElement)
-
findBuilderInfoForImmutables
protected BuilderInfo findBuilderInfoForImmutables(TypeElement typeElement)
-
findBuilderInfoForImmutables
protected BuilderInfo findBuilderInfoForImmutables(TypeElement typeElement, TypeElement immutableAnnotation)
-
asImmutableElement
protected TypeElement asImmutableElement(TypeElement typeElement)
-
-