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 the
org.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 -
Method Summary
Modifier and TypeMethodDescriptionprotected 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
-
Constructor Details
-
ImmutablesBuilderProvider
public ImmutablesBuilderProvider()
-
-
Method Details
-
findBuilderInfo
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
-
findBuilderInfoForImmutables
protected BuilderInfo findBuilderInfoForImmutables(TypeElement typeElement, TypeElement immutableAnnotation) -
asImmutableElement
-