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.Immutableare 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 TypeElementasImmutableElement(TypeElement typeElement)protected BuilderInfofindBuilderInfo(TypeElement typeElement)Find theBuilderInfofor the giventypeElement.protected BuilderInfofindBuilderInfoForImmutables(TypeElement typeElement)protected BuilderInfofindBuilderInfoForImmutables(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:DefaultBuilderProviderFind theBuilderInfofor the giventypeElement.The default implementation iterates over all the methods in
typeElementand usesDefaultBuilderProvider.isPossibleBuilderCreationMethod(ExecutableElement, TypeElement)andDefaultBuilderProvider.findBuildMethods(TypeElement, TypeElement)to create theBuilderInfo.The default implementation uses
DefaultBuilderProvider.shouldIgnore(TypeElement)to check if thetypeElementshould be ignored.In case there are multiple
BuilderInfothen aMoreThanOneBuilderCreationMethodExceptionis thrown.- Overrides:
findBuilderInfoin classDefaultBuilderProvider- Parameters:
typeElement- the type element for which a builder searched- Returns:
- the
BuilderInfoornullif 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)
-
-