#1998 preparation move classes to new names 1

This commit is contained in:
sjaakd 2020-01-25 08:06:06 +01:00
parent d056570267
commit 2b36c220a3
21 changed files with 133 additions and 133 deletions

View File

@ -14,7 +14,7 @@ import org.mapstruct.ap.internal.model.HelperMethod;
import org.mapstruct.ap.internal.model.common.Parameter; import org.mapstruct.ap.internal.model.common.Parameter;
import org.mapstruct.ap.internal.model.common.Type; import org.mapstruct.ap.internal.model.common.Type;
import org.mapstruct.ap.internal.model.common.TypeFactory; import org.mapstruct.ap.internal.model.common.TypeFactory;
import org.mapstruct.ap.internal.model.source.MappingOptions; import org.mapstruct.ap.internal.model.source.MappingMethodOptions;
/** /**
* HelperMethod that creates a {@link java.text.DecimalFormat} * HelperMethod that creates a {@link java.text.DecimalFormat}
@ -52,7 +52,7 @@ public class CreateDecimalFormat extends HelperMethod {
} }
@Override @Override
public MappingOptions getMappingOptions() { public MappingMethodOptions getMappingOptions() {
return MappingOptions.empty(); return MappingMethodOptions.empty();
} }
} }

View File

@ -13,7 +13,7 @@ import org.mapstruct.ap.internal.model.common.SourceRHS;
import org.mapstruct.ap.internal.model.common.Type; import org.mapstruct.ap.internal.model.common.Type;
import org.mapstruct.ap.internal.model.source.MappingMethodUtils; import org.mapstruct.ap.internal.model.source.MappingMethodUtils;
import org.mapstruct.ap.internal.model.source.Method; import org.mapstruct.ap.internal.model.source.Method;
import org.mapstruct.ap.internal.util.MapperConfiguration; import org.mapstruct.ap.internal.util.MapperOptions;
import org.mapstruct.ap.internal.util.Message; import org.mapstruct.ap.internal.util.Message;
/** /**
@ -60,7 +60,7 @@ class AbstractBaseBuilder<B extends AbstractBaseBuilder<B>> {
} }
private boolean isDisableSubMappingMethodsGeneration() { private boolean isDisableSubMappingMethodsGeneration() {
MapperConfiguration configuration = MapperConfiguration.getInstanceOn( ctx.getMapperTypeElement() ); MapperOptions configuration = MapperOptions.getInstanceOn( ctx.getMapperTypeElement() );
return configuration.isDisableSubMappingMethodsGeneration(); return configuration.isDisableSubMappingMethodsGeneration();
} }

View File

@ -8,7 +8,7 @@ package org.mapstruct.ap.internal.model;
import org.mapstruct.ap.internal.model.common.Assignment; import org.mapstruct.ap.internal.model.common.Assignment;
import org.mapstruct.ap.internal.model.common.SourceRHS; import org.mapstruct.ap.internal.model.common.SourceRHS;
import org.mapstruct.ap.internal.model.common.Type; import org.mapstruct.ap.internal.model.common.Type;
import org.mapstruct.ap.internal.model.source.BeanMapping; import org.mapstruct.ap.internal.model.source.BeanMappingOptions;
import org.mapstruct.ap.internal.util.Strings; import org.mapstruct.ap.internal.util.Strings;
import static org.mapstruct.ap.internal.model.ForgedMethod.forElementMapping; import static org.mapstruct.ap.internal.model.ForgedMethod.forElementMapping;
@ -58,7 +58,7 @@ public abstract class AbstractMappingMethodBuilder<B extends AbstractMappingMeth
return createForgedAssignment( return createForgedAssignment(
sourceRHS, sourceRHS,
ctx.getTypeFactory() ctx.getTypeFactory()
.builderTypeFor( targetType, BeanMapping.builderPrismFor( method ) ), .builderTypeFor( targetType, BeanMappingOptions.builderPrismFor( method ) ),
forgedMethod forgedMethod
); );
} }

View File

@ -35,16 +35,16 @@ import org.mapstruct.ap.internal.model.common.Parameter;
import org.mapstruct.ap.internal.model.common.Type; import org.mapstruct.ap.internal.model.common.Type;
import org.mapstruct.ap.internal.model.dependency.GraphAnalyzer; import org.mapstruct.ap.internal.model.dependency.GraphAnalyzer;
import org.mapstruct.ap.internal.model.dependency.GraphAnalyzer.GraphAnalyzerBuilder; import org.mapstruct.ap.internal.model.dependency.GraphAnalyzer.GraphAnalyzerBuilder;
import org.mapstruct.ap.internal.model.source.BeanMapping; import org.mapstruct.ap.internal.model.source.BeanMappingOptions;
import org.mapstruct.ap.internal.model.source.Mapping; import org.mapstruct.ap.internal.model.source.Mapping;
import org.mapstruct.ap.internal.model.source.MappingOptions; import org.mapstruct.ap.internal.model.source.MappingMethodOptions;
import org.mapstruct.ap.internal.model.source.Method; import org.mapstruct.ap.internal.model.source.Method;
import org.mapstruct.ap.internal.model.source.SelectionParameters; import org.mapstruct.ap.internal.model.source.SelectionParameters;
import org.mapstruct.ap.internal.model.source.SourceMethod; import org.mapstruct.ap.internal.model.source.SourceMethod;
import org.mapstruct.ap.internal.prism.CollectionMappingStrategyPrism; import org.mapstruct.ap.internal.prism.CollectionMappingStrategyPrism;
import org.mapstruct.ap.internal.prism.NullValueMappingStrategyPrism; import org.mapstruct.ap.internal.prism.NullValueMappingStrategyPrism;
import org.mapstruct.ap.internal.prism.ReportingPolicyPrism; import org.mapstruct.ap.internal.prism.ReportingPolicyPrism;
import org.mapstruct.ap.internal.util.MapperConfiguration; import org.mapstruct.ap.internal.util.MapperOptions;
import org.mapstruct.ap.internal.util.Message; import org.mapstruct.ap.internal.util.Message;
import org.mapstruct.ap.internal.util.Strings; import org.mapstruct.ap.internal.util.Strings;
import org.mapstruct.ap.internal.util.accessor.Accessor; import org.mapstruct.ap.internal.util.accessor.Accessor;
@ -121,7 +121,7 @@ public class BeanMappingMethod extends NormalTypeMappingMethod {
public BeanMappingMethod build() { public BeanMappingMethod build() {
BeanMapping beanMapping = method.getMappingOptions().getBeanMapping(); BeanMappingOptions beanMapping = method.getMappingOptions().getBeanMapping();
SelectionParameters selectionParameters = beanMapping != null ? beanMapping.getSelectionParameters() : null; SelectionParameters selectionParameters = beanMapping != null ? beanMapping.getSelectionParameters() : null;
/* the return type that needs to be constructed (new or factorized), so for instance: */ /* the return type that needs to be constructed (new or factorized), so for instance: */
@ -828,13 +828,13 @@ public class BeanMappingMethod extends NormalTypeMappingMethod {
if ( mappingReferences.isForForgedMethods() ) { if ( mappingReferences.isForForgedMethods() ) {
return ReportingPolicyPrism.IGNORE; return ReportingPolicyPrism.IGNORE;
} }
MappingOptions mappingOptions = method.getMappingOptions(); MappingMethodOptions mappingOptions = method.getMappingOptions();
if ( mappingOptions.getBeanMapping() != null && if ( mappingOptions.getBeanMapping() != null &&
mappingOptions.getBeanMapping().getReportingPolicy() != null ) { mappingOptions.getBeanMapping().getReportingPolicy() != null ) {
return mappingOptions.getBeanMapping().getReportingPolicy(); return mappingOptions.getBeanMapping().getReportingPolicy();
} }
MapperConfiguration mapperSettings = MapperConfiguration.getInstanceOn( ctx.getMapperTypeElement() ); MapperOptions mapperSettings = MapperOptions.getInstanceOn( ctx.getMapperTypeElement() );
return mapperSettings.unmappedTargetPolicy( ctx.getOptions() ); return mapperSettings.unmappedTargetPolicy( ctx.getOptions() );
} }
@ -917,7 +917,7 @@ public class BeanMappingMethod extends NormalTypeMappingMethod {
if ( mappingReferences.isForForgedMethods() ) { if ( mappingReferences.isForForgedMethods() ) {
return ReportingPolicyPrism.IGNORE; return ReportingPolicyPrism.IGNORE;
} }
MapperConfiguration mapperSettings = MapperConfiguration.getInstanceOn( ctx.getMapperTypeElement() ); MapperOptions mapperSettings = MapperOptions.getInstanceOn( ctx.getMapperTypeElement() );
return mapperSettings.unmappedSourcePolicy(); return mapperSettings.unmappedSourcePolicy();
} }

View File

@ -9,7 +9,7 @@ import java.util.Collection;
import javax.lang.model.element.ExecutableElement; import javax.lang.model.element.ExecutableElement;
import org.mapstruct.ap.internal.model.common.BuilderType; import org.mapstruct.ap.internal.model.common.BuilderType;
import org.mapstruct.ap.internal.model.source.BeanMapping; import org.mapstruct.ap.internal.model.source.BeanMappingOptions;
import org.mapstruct.ap.internal.model.source.Method; import org.mapstruct.ap.internal.model.source.Method;
import org.mapstruct.ap.internal.prism.BuilderPrism; import org.mapstruct.ap.internal.prism.BuilderPrism;
import org.mapstruct.ap.internal.util.Message; import org.mapstruct.ap.internal.util.Message;
@ -35,7 +35,7 @@ public class BuilderFinisherMethodResolver {
return null; return null;
} }
BuilderPrism builderMapping = BeanMapping.builderPrismFor( method ); BuilderPrism builderMapping = BeanMappingOptions.builderPrismFor( method );
if ( builderMapping == null && buildMethods.size() == 1 ) { if ( builderMapping == null && buildMethods.size() == 1 ) {
return MethodReference.forMethodCall( first( buildMethods ).getSimpleName().toString() ); return MethodReference.forMethodCall( first( buildMethods ).getSimpleName().toString() );
} }

View File

@ -15,11 +15,11 @@ import javax.lang.model.element.ExecutableElement;
import org.mapstruct.ap.internal.model.common.Accessibility; import org.mapstruct.ap.internal.model.common.Accessibility;
import org.mapstruct.ap.internal.model.common.Parameter; import org.mapstruct.ap.internal.model.common.Parameter;
import org.mapstruct.ap.internal.model.common.Type; import org.mapstruct.ap.internal.model.common.Type;
import org.mapstruct.ap.internal.model.source.MappingOptions; import org.mapstruct.ap.internal.model.source.MappingMethodOptions;
import org.mapstruct.ap.internal.model.beanmapping.MappingReferences; import org.mapstruct.ap.internal.model.beanmapping.MappingReferences;
import org.mapstruct.ap.internal.model.source.Method; import org.mapstruct.ap.internal.model.source.Method;
import org.mapstruct.ap.internal.model.source.ParameterProvidedMethods; import org.mapstruct.ap.internal.model.source.ParameterProvidedMethods;
import org.mapstruct.ap.internal.util.MapperConfiguration; import org.mapstruct.ap.internal.util.MapperOptions;
import org.mapstruct.ap.internal.util.Strings; import org.mapstruct.ap.internal.util.Strings;
/** /**
@ -323,7 +323,7 @@ public class ForgedMethod implements Method {
} }
@Override @Override
public MapperConfiguration getMapperConfiguration() { public MapperOptions getMapperConfiguration() {
return basedOn.getMapperConfiguration(); return basedOn.getMapperConfiguration();
} }
@ -343,7 +343,7 @@ public class ForgedMethod implements Method {
} }
@Override @Override
public MappingOptions getMappingOptions() { public MappingMethodOptions getMappingOptions() {
return basedOn.getMappingOptions(); return basedOn.getMappingOptions();
} }

View File

@ -18,7 +18,7 @@ import org.mapstruct.ap.internal.model.common.Parameter;
import org.mapstruct.ap.internal.model.common.Type; import org.mapstruct.ap.internal.model.common.Type;
import org.mapstruct.ap.internal.model.source.Method; import org.mapstruct.ap.internal.model.source.Method;
import org.mapstruct.ap.internal.model.source.ParameterProvidedMethods; import org.mapstruct.ap.internal.model.source.ParameterProvidedMethods;
import org.mapstruct.ap.internal.util.MapperConfiguration; import org.mapstruct.ap.internal.util.MapperOptions;
import org.mapstruct.ap.internal.util.Strings; import org.mapstruct.ap.internal.util.Strings;
/** /**
@ -238,7 +238,7 @@ public abstract class HelperMethod implements Method {
} }
@Override @Override
public MapperConfiguration getMapperConfiguration() { public MapperOptions getMapperConfiguration() {
return null; return null;
} }

View File

@ -27,7 +27,7 @@ import org.mapstruct.ap.internal.model.common.ModelElement;
import org.mapstruct.ap.internal.model.common.Parameter; import org.mapstruct.ap.internal.model.common.Parameter;
import org.mapstruct.ap.internal.model.common.SourceRHS; import org.mapstruct.ap.internal.model.common.SourceRHS;
import org.mapstruct.ap.internal.model.common.Type; import org.mapstruct.ap.internal.model.common.Type;
import org.mapstruct.ap.internal.model.source.BeanMapping; import org.mapstruct.ap.internal.model.source.BeanMappingOptions;
import org.mapstruct.ap.internal.model.beanmapping.MappingReferences; import org.mapstruct.ap.internal.model.beanmapping.MappingReferences;
import org.mapstruct.ap.internal.model.source.Method; import org.mapstruct.ap.internal.model.source.Method;
import org.mapstruct.ap.internal.model.beanmapping.PropertyEntry; import org.mapstruct.ap.internal.model.beanmapping.PropertyEntry;
@ -38,7 +38,7 @@ import org.mapstruct.ap.internal.prism.BuilderPrism;
import org.mapstruct.ap.internal.prism.NullValueCheckStrategyPrism; import org.mapstruct.ap.internal.prism.NullValueCheckStrategyPrism;
import org.mapstruct.ap.internal.prism.NullValueMappingStrategyPrism; import org.mapstruct.ap.internal.prism.NullValueMappingStrategyPrism;
import org.mapstruct.ap.internal.prism.NullValuePropertyMappingStrategyPrism; import org.mapstruct.ap.internal.prism.NullValuePropertyMappingStrategyPrism;
import org.mapstruct.ap.internal.util.MapperConfiguration; import org.mapstruct.ap.internal.util.MapperOptions;
import org.mapstruct.ap.internal.util.Message; import org.mapstruct.ap.internal.util.Message;
import org.mapstruct.ap.internal.util.NativeTypes; import org.mapstruct.ap.internal.util.NativeTypes;
import org.mapstruct.ap.internal.util.Strings; import org.mapstruct.ap.internal.util.Strings;
@ -111,7 +111,7 @@ public class PropertyMapping extends ModelElement {
public T targetWriteAccessor(Accessor targetWriteAccessor) { public T targetWriteAccessor(Accessor targetWriteAccessor) {
this.targetWriteAccessor = targetWriteAccessor; this.targetWriteAccessor = targetWriteAccessor;
this.targetType = ctx.getTypeFactory().getType( targetWriteAccessor.getAccessedType() ); this.targetType = ctx.getTypeFactory().getType( targetWriteAccessor.getAccessedType() );
BuilderPrism builderPrism = BeanMapping.builderPrismFor( method ); BuilderPrism builderPrism = BeanMappingOptions.builderPrismFor( method );
this.targetBuilderType = ctx.getTypeFactory().builderTypeFor( this.targetType, builderPrism ); this.targetBuilderType = ctx.getTypeFactory().builderTypeFor( this.targetType, builderPrism );
this.targetWriteAccessorType = targetWriteAccessor.getAccessorType(); this.targetWriteAccessorType = targetWriteAccessor.getAccessorType();
return (T) this; return (T) this;
@ -230,8 +230,8 @@ public class PropertyMapping extends ModelElement {
public PropertyMapping build() { public PropertyMapping build() {
MapperConfiguration mapperConfiguration = method.getMapperConfiguration(); MapperOptions mapperConfiguration = method.getMapperConfiguration();
BeanMapping beanMapping = method.getMappingOptions().getBeanMapping(); BeanMappingOptions beanMapping = method.getMappingOptions().getBeanMapping();
// null value check strategy (determine true value based on hierarchy) // null value check strategy (determine true value based on hierarchy)
NullValueCheckStrategyPrism nvcsBean = beanMapping != null ? beanMapping.getNullValueCheckStrategy() : null; NullValueCheckStrategyPrism nvcsBean = beanMapping != null ? beanMapping.getNullValueCheckStrategy() : null;

View File

@ -18,7 +18,7 @@ import org.mapstruct.ap.internal.model.common.BuilderType;
import org.mapstruct.ap.internal.model.common.Parameter; import org.mapstruct.ap.internal.model.common.Parameter;
import org.mapstruct.ap.internal.model.common.Type; import org.mapstruct.ap.internal.model.common.Type;
import org.mapstruct.ap.internal.model.common.TypeFactory; import org.mapstruct.ap.internal.model.common.TypeFactory;
import org.mapstruct.ap.internal.model.source.BeanMapping; import org.mapstruct.ap.internal.model.source.BeanMappingOptions;
import org.mapstruct.ap.internal.model.source.Mapping; import org.mapstruct.ap.internal.model.source.Mapping;
import org.mapstruct.ap.internal.model.source.Method; import org.mapstruct.ap.internal.model.source.Method;
import org.mapstruct.ap.internal.prism.BuilderPrism; import org.mapstruct.ap.internal.prism.BuilderPrism;
@ -203,7 +203,7 @@ public class TargetReference extends AbstractReference {
); );
} }
else { else {
BuilderPrism builderPrism = BeanMapping.builderPrismFor( method ); BuilderPrism builderPrism = BeanMappingOptions.builderPrismFor( method );
builderType = typeFactory.builderTypeFor( nextType, builderPrism ); builderType = typeFactory.builderTypeFor( nextType, builderPrism );
propertyEntry = PropertyEntry.forTargetReference( fullName, propertyEntry = PropertyEntry.forTargetReference( fullName,
targetReadAccessor, targetReadAccessor,
@ -271,7 +271,7 @@ public class TargetReference extends AbstractReference {
return type; return type;
} }
else { else {
BuilderPrism builderPrism = BeanMapping.builderPrismFor( method ); BuilderPrism builderPrism = BeanMappingOptions.builderPrismFor( method );
return typeFactory.effectiveResultTypeFor( type, builderPrism ); return typeFactory.effectiveResultTypeFor( type, builderPrism );
} }
} }

View File

@ -28,7 +28,7 @@ import org.mapstruct.ap.internal.util.Message;
* *
* @author Sjaak Derksen * @author Sjaak Derksen
*/ */
public class BeanMapping { public class BeanMappingOptions {
private final SelectionParameters selectionParameters; private final SelectionParameters selectionParameters;
private final NullValueMappingStrategyPrism nullValueMappingStrategy; private final NullValueMappingStrategyPrism nullValueMappingStrategy;
@ -48,8 +48,8 @@ public class BeanMapping {
* *
* @return new mapping * @return new mapping
*/ */
public static BeanMapping forInheritance(BeanMapping beanMapping) { public static BeanMappingOptions forInheritance(BeanMappingOptions beanMapping) {
return new BeanMapping( return new BeanMappingOptions(
SelectionParameters.forInheritance( beanMapping.selectionParameters ), SelectionParameters.forInheritance( beanMapping.selectionParameters ),
beanMapping.nullValueMappingStrategy, beanMapping.nullValueMappingStrategy,
beanMapping.nullValuePropertyMappingStrategy, beanMapping.nullValuePropertyMappingStrategy,
@ -95,7 +95,7 @@ public class BeanMapping {
return this; return this;
} }
public BeanMapping build() { public BeanMappingOptions build() {
if ( prism == null ) { if ( prism == null ) {
return null; return null;
@ -148,7 +148,7 @@ public class BeanMapping {
); );
//TODO Do we want to add the reporting policy to the BeanMapping as well? To give more granular support? //TODO Do we want to add the reporting policy to the BeanMapping as well? To give more granular support?
return new BeanMapping( return new BeanMappingOptions(
cmp, cmp,
nullValueMappingStrategy, nullValueMappingStrategy,
nullValuePropertyMappingStrategy, nullValuePropertyMappingStrategy,
@ -162,7 +162,7 @@ public class BeanMapping {
} }
} }
private BeanMapping(SelectionParameters selectionParameters, NullValueMappingStrategyPrism nvms, private BeanMappingOptions(SelectionParameters selectionParameters, NullValueMappingStrategyPrism nvms,
NullValuePropertyMappingStrategyPrism nvpms, NullValueCheckStrategyPrism nvcs, NullValuePropertyMappingStrategyPrism nvpms, NullValueCheckStrategyPrism nvcs,
ReportingPolicyPrism reportingPolicy, boolean ignoreByDefault, ReportingPolicyPrism reportingPolicy, boolean ignoreByDefault,
List<String> ignoreUnmappedSourceProperties, BuilderPrism builder, List<String> ignoreUnmappedSourceProperties, BuilderPrism builder,

View File

@ -21,14 +21,14 @@ import org.mapstruct.ap.internal.util.Message;
* *
* @author Gunnar Morling * @author Gunnar Morling
*/ */
public class IterableMapping { public class IterableMappingOptions {
private final SelectionParameters selectionParameters; private final SelectionParameters selectionParameters;
private final FormattingParameters formattingParameters; private final FormattingParameters formattingParameters;
private final AnnotationMirror mirror; private final AnnotationMirror mirror;
private final NullValueMappingStrategyPrism nullValueMappingStrategy; private final NullValueMappingStrategyPrism nullValueMappingStrategy;
public static IterableMapping fromPrism(IterableMappingPrism iterableMapping, ExecutableElement method, public static IterableMappingOptions fromPrism(IterableMappingPrism iterableMapping, ExecutableElement method,
FormattingMessager messager, Types typeUtils) { FormattingMessager messager, Types typeUtils) {
if ( iterableMapping == null ) { if ( iterableMapping == null ) {
return null; return null;
@ -66,14 +66,14 @@ public class IterableMapping {
method method
); );
return new IterableMapping( formatting, return new IterableMappingOptions( formatting,
selection, selection,
iterableMapping.mirror, iterableMapping.mirror,
nullValueMappingStrategy nullValueMappingStrategy
); );
} }
private IterableMapping(FormattingParameters formattingParameters, SelectionParameters selectionParameters, private IterableMappingOptions(FormattingParameters formattingParameters, SelectionParameters selectionParameters,
AnnotationMirror mirror, NullValueMappingStrategyPrism nvms) { AnnotationMirror mirror, NullValueMappingStrategyPrism nvms) {
this.formattingParameters = formattingParameters; this.formattingParameters = formattingParameters;

View File

@ -21,7 +21,7 @@ import org.mapstruct.ap.internal.util.Message;
* *
* @author Gunnar Morling * @author Gunnar Morling
*/ */
public class MapMapping { public class MapMappingOptions {
private final SelectionParameters keySelectionParameters; private final SelectionParameters keySelectionParameters;
private final SelectionParameters valueSelectionParameters; private final SelectionParameters valueSelectionParameters;
@ -30,7 +30,7 @@ public class MapMapping {
private final AnnotationMirror mirror; private final AnnotationMirror mirror;
private final NullValueMappingStrategyPrism nullValueMappingStrategy; private final NullValueMappingStrategyPrism nullValueMappingStrategy;
public static MapMapping fromPrism(MapMappingPrism mapMapping, ExecutableElement method, public static MapMappingOptions fromPrism(MapMappingPrism mapMapping, ExecutableElement method,
FormattingMessager messager, Types typeUtils) { FormattingMessager messager, Types typeUtils) {
if ( mapMapping == null ) { if ( mapMapping == null ) {
return null; return null;
@ -89,7 +89,7 @@ public class MapMapping {
method method
); );
return new MapMapping( return new MapMappingOptions(
keyFormatting, keyFormatting,
keySelection, keySelection,
valueFormatting, valueFormatting,
@ -99,7 +99,7 @@ public class MapMapping {
); );
} }
private MapMapping(FormattingParameters keyFormatting, SelectionParameters keySelectionParameters, private MapMappingOptions(FormattingParameters keyFormatting, SelectionParameters keySelectionParameters,
FormattingParameters valueFormatting, SelectionParameters valueSelectionParameters, AnnotationMirror mirror, FormattingParameters valueFormatting, SelectionParameters valueSelectionParameters, AnnotationMirror mirror,
NullValueMappingStrategyPrism nvms ) { NullValueMappingStrategyPrism nvms ) {
this.keyFormattingParameters = keyFormatting; this.keyFormattingParameters = keyFormatting;

View File

@ -3,7 +3,7 @@
* *
* Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/ */
package org.mapstruct.ap.internal.util; package org.mapstruct.ap.internal.model.source;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.LinkedHashSet; import java.util.LinkedHashSet;
@ -36,17 +36,17 @@ import org.mapstruct.ap.internal.prism.ReportingPolicyPrism;
* *
* @author Sjaak Derksen * @author Sjaak Derksen
*/ */
public class MapperConfiguration { public class MapperOptions {
private final MapperPrism mapperPrism; private final MapperPrism mapperPrism;
private final MapperConfigPrism mapperConfigPrism; private final MapperConfigPrism mapperConfigPrism;
private final DeclaredType config; private final DeclaredType config;
public static MapperConfiguration getInstanceOn(Element e) { public static MapperOptions getInstanceOn(Element e) {
return new MapperConfiguration( MapperPrism.getInstanceOn( e ) ); return new MapperOptions( MapperPrism.getInstanceOn( e ) );
} }
private MapperConfiguration(MapperPrism mapperPrism) { private MapperOptions(MapperPrism mapperPrism) {
this.mapperPrism = mapperPrism; this.mapperPrism = mapperPrism;
if ( mapperPrism.values.config() != null ) { if ( mapperPrism.values.config() != null ) {

View File

@ -24,8 +24,8 @@ import static org.mapstruct.ap.internal.model.source.Mapping.getMappingTargetNam
* *
* @author Andreas Gudian * @author Andreas Gudian
*/ */
public class MappingOptions { public class MappingMethodOptions {
private static final MappingOptions EMPTY = new MappingOptions( Collections.emptySet(), private static final MappingMethodOptions EMPTY = new MappingMethodOptions( Collections.emptySet(),
null, null,
null, null,
null, null,
@ -33,14 +33,14 @@ public class MappingOptions {
); );
private Set<Mapping> mappings; private Set<Mapping> mappings;
private IterableMapping iterableMapping; private IterableMappingOptions iterableMapping;
private MapMapping mapMapping; private MapMappingOptions mapMapping;
private BeanMapping beanMapping; private BeanMappingOptions beanMapping;
private List<ValueMapping> valueMappings; private List<ValueMapping> valueMappings;
private boolean fullyInitialized; private boolean fullyInitialized;
public MappingOptions(Set<Mapping> mappings, IterableMapping iterableMapping, MapMapping mapMapping, public MappingMethodOptions(Set<Mapping> mappings, IterableMappingOptions iterableMapping, MapMappingOptions mapMapping,
BeanMapping beanMapping, List<ValueMapping> valueMappings ) { BeanMappingOptions beanMapping, List<ValueMapping> valueMappings ) {
this.mappings = mappings; this.mappings = mappings;
this.iterableMapping = iterableMapping; this.iterableMapping = iterableMapping;
this.mapMapping = mapMapping; this.mapMapping = mapMapping;
@ -53,7 +53,7 @@ public class MappingOptions {
* *
* @return empty mapping options * @return empty mapping options
*/ */
public static MappingOptions empty() { public static MappingMethodOptions empty() {
return EMPTY; return EMPTY;
} }
@ -65,15 +65,15 @@ public class MappingOptions {
return mappings; return mappings;
} }
public IterableMapping getIterableMapping() { public IterableMappingOptions getIterableMapping() {
return iterableMapping; return iterableMapping;
} }
public MapMapping getMapMapping() { public MapMappingOptions getMapMapping() {
return mapMapping; return mapMapping;
} }
public BeanMapping getBeanMapping() { public BeanMappingOptions getBeanMapping() {
return beanMapping; return beanMapping;
} }
@ -81,15 +81,15 @@ public class MappingOptions {
return valueMappings; return valueMappings;
} }
public void setIterableMapping(IterableMapping iterableMapping) { public void setIterableMapping(IterableMappingOptions iterableMapping) {
this.iterableMapping = iterableMapping; this.iterableMapping = iterableMapping;
} }
public void setMapMapping(MapMapping mapMapping) { public void setMapMapping(MapMappingOptions mapMapping) {
this.mapMapping = mapMapping; this.mapMapping = mapMapping;
} }
public void setBeanMapping(BeanMapping beanMapping) { public void setBeanMapping(BeanMappingOptions beanMapping) {
this.beanMapping = beanMapping; this.beanMapping = beanMapping;
} }
@ -117,7 +117,7 @@ public class MappingOptions {
* @param method the source method * @param method the source method
*/ */
public void applyInheritedOptions(SourceMethod templateMethod, boolean isInverse, SourceMethod method ) { public void applyInheritedOptions(SourceMethod templateMethod, boolean isInverse, SourceMethod method ) {
MappingOptions inherited = templateMethod.getMappingOptions(); MappingMethodOptions inherited = templateMethod.getMappingOptions();
if ( null != inherited ) { if ( null != inherited ) {
if ( getIterableMapping() == null && inherited.getIterableMapping() != null) { if ( getIterableMapping() == null && inherited.getIterableMapping() != null) {
setIterableMapping( inherited.getIterableMapping() ); setIterableMapping( inherited.getIterableMapping() );
@ -128,7 +128,7 @@ public class MappingOptions {
} }
if ( getBeanMapping() == null && inherited.getBeanMapping() != null ) { if ( getBeanMapping() == null && inherited.getBeanMapping() != null ) {
setBeanMapping( BeanMapping.forInheritance( inherited.getBeanMapping() ) ); setBeanMapping( BeanMappingOptions.forInheritance( inherited.getBeanMapping() ) );
} }
if ( getValueMappings() == null ) { if ( getValueMappings() == null ) {
@ -179,7 +179,7 @@ public class MappingOptions {
if ( !method.isUpdateMethod() ) { if ( !method.isUpdateMethod() ) {
writeType = typeFactory.effectiveResultTypeFor( writeType = typeFactory.effectiveResultTypeFor(
writeType, writeType,
BeanMapping.builderPrismFor( method ) BeanMappingOptions.builderPrismFor( method )
); );
} }
Map<String, Accessor> writeAccessors = writeType.getPropertyWriteAccessors( cms ); Map<String, Accessor> writeAccessors = writeType.getPropertyWriteAccessors( cms );

View File

@ -13,7 +13,7 @@ import org.mapstruct.ap.internal.model.common.Accessibility;
import org.mapstruct.ap.internal.model.common.Parameter; import org.mapstruct.ap.internal.model.common.Parameter;
import org.mapstruct.ap.internal.model.common.Type; import org.mapstruct.ap.internal.model.common.Type;
import org.mapstruct.ap.internal.model.source.builtin.BuiltInMethod; import org.mapstruct.ap.internal.model.source.builtin.BuiltInMethod;
import org.mapstruct.ap.internal.util.MapperConfiguration; import org.mapstruct.ap.internal.util.MapperOptions;
/** /**
* This interface makes available common method properties and a matching method There are 2 known implementors: * This interface makes available common method properties and a matching method There are 2 known implementors:
@ -168,7 +168,7 @@ public interface Method {
* *
* @return the mapper config when this method needs to be implemented * @return the mapper config when this method needs to be implemented
*/ */
MapperConfiguration getMapperConfiguration(); MapperOptions getMapperConfiguration();
/** /**
* @return {@code true}, if the method represents a mapping lifecycle callback (Before/After mapping method) * @return {@code true}, if the method represents a mapping lifecycle callback (Before/After mapping method)
@ -185,7 +185,7 @@ public interface Method {
* *
* @return the mapping options for this method * @return the mapping options for this method
*/ */
MappingOptions getMappingOptions(); MappingMethodOptions getMappingOptions();
/** /**
* *

View File

@ -20,7 +20,7 @@ import org.mapstruct.ap.internal.model.common.Type;
import org.mapstruct.ap.internal.model.common.TypeFactory; import org.mapstruct.ap.internal.model.common.TypeFactory;
import org.mapstruct.ap.internal.prism.ObjectFactoryPrism; import org.mapstruct.ap.internal.prism.ObjectFactoryPrism;
import org.mapstruct.ap.internal.util.Executables; import org.mapstruct.ap.internal.util.Executables;
import org.mapstruct.ap.internal.util.MapperConfiguration; import org.mapstruct.ap.internal.util.MapperOptions;
import org.mapstruct.ap.internal.util.Strings; import org.mapstruct.ap.internal.util.Strings;
import static org.mapstruct.ap.internal.model.source.MappingMethodUtils.isEnumMapping; import static org.mapstruct.ap.internal.model.source.MappingMethodUtils.isEnumMapping;
@ -31,7 +31,7 @@ import static org.mapstruct.ap.internal.util.Collections.first;
* type. * type.
* <p> * <p>
* A method can either be configured by itself or by another method for the inverse mapping direction (the appropriate * A method can either be configured by itself or by another method for the inverse mapping direction (the appropriate
* setter on {@link MappingOptions} will be called in this case). * setter on {@link MappingMethodOptions} will be called in this case).
* *
* @author Gunnar Morling * @author Gunnar Morling
*/ */
@ -49,8 +49,8 @@ public class SourceMethod implements Method {
private final Type returnType; private final Type returnType;
private final Accessibility accessibility; private final Accessibility accessibility;
private final List<Type> exceptionTypes; private final List<Type> exceptionTypes;
private final MapperConfiguration config; private final MapperOptions config;
private final MappingOptions mappingOptions; private final MappingMethodOptions mappingOptions;
private final List<SourceMethod> prototypeMethods; private final List<SourceMethod> prototypeMethods;
private final Type mapperToImplement; private final Type mapperToImplement;
@ -78,12 +78,12 @@ public class SourceMethod implements Method {
private Type returnType = null; private Type returnType = null;
private List<Type> exceptionTypes; private List<Type> exceptionTypes;
private Set<Mapping> mappings; private Set<Mapping> mappings;
private IterableMapping iterableMapping = null; private IterableMappingOptions iterableMapping = null;
private MapMapping mapMapping = null; private MapMappingOptions mapMapping = null;
private BeanMapping beanMapping = null; private BeanMappingOptions beanMapping = null;
private Types typeUtils; private Types typeUtils;
private TypeFactory typeFactory = null; private TypeFactory typeFactory = null;
private MapperConfiguration mapperConfig = null; private MapperOptions mapperConfig = null;
private List<SourceMethod> prototypeMethods = Collections.emptyList(); private List<SourceMethod> prototypeMethods = Collections.emptyList();
private List<ValueMapping> valueMappings; private List<ValueMapping> valueMappings;
private ParameterProvidedMethods contextProvidedMethods; private ParameterProvidedMethods contextProvidedMethods;
@ -118,17 +118,17 @@ public class SourceMethod implements Method {
return this; return this;
} }
public Builder setIterableMapping(IterableMapping iterableMapping) { public Builder setIterableMapping(IterableMappingOptions iterableMapping) {
this.iterableMapping = iterableMapping; this.iterableMapping = iterableMapping;
return this; return this;
} }
public Builder setMapMapping(MapMapping mapMapping) { public Builder setMapMapping(MapMappingOptions mapMapping) {
this.mapMapping = mapMapping; this.mapMapping = mapMapping;
return this; return this;
} }
public Builder setBeanMapping(BeanMapping beanMapping) { public Builder setBeanMapping(BeanMappingOptions beanMapping) {
this.beanMapping = beanMapping; this.beanMapping = beanMapping;
return this; return this;
} }
@ -148,7 +148,7 @@ public class SourceMethod implements Method {
return this; return this;
} }
public Builder setMapperConfiguration(MapperConfiguration mapperConfig) { public Builder setMapperConfiguration(MapperOptions mapperConfig) {
this.mapperConfig = mapperConfig; this.mapperConfig = mapperConfig;
return this; return this;
} }
@ -174,14 +174,14 @@ public class SourceMethod implements Method {
mappings = Collections.emptySet(); mappings = Collections.emptySet();
} }
MappingOptions mappingOptions = MappingMethodOptions mappingOptions =
new MappingOptions( mappings, iterableMapping, mapMapping, beanMapping, valueMappings ); new MappingMethodOptions( mappings, iterableMapping, mapMapping, beanMapping, valueMappings );
return new SourceMethod( this, mappingOptions ); return new SourceMethod( this, mappingOptions );
} }
} }
private SourceMethod(Builder builder, MappingOptions mappingOptions) { private SourceMethod(Builder builder, MappingMethodOptions mappingOptions) {
this.declaringMapper = builder.declaringMapper; this.declaringMapper = builder.declaringMapper;
this.executable = builder.executable; this.executable = builder.executable;
this.parameters = builder.parameters; this.parameters = builder.parameters;
@ -463,7 +463,7 @@ public class SourceMethod implements Method {
} }
@Override @Override
public MappingOptions getMappingOptions() { public MappingMethodOptions getMappingOptions() {
return mappingOptions; return mappingOptions;
} }
@ -483,7 +483,7 @@ public class SourceMethod implements Method {
} }
@Override @Override
public MapperConfiguration getMapperConfiguration() { public MapperOptions getMapperConfiguration() {
return config; return config;
} }

View File

@ -16,10 +16,10 @@ import org.mapstruct.ap.internal.model.common.Accessibility;
import org.mapstruct.ap.internal.model.common.ConversionContext; import org.mapstruct.ap.internal.model.common.ConversionContext;
import org.mapstruct.ap.internal.model.common.Parameter; import org.mapstruct.ap.internal.model.common.Parameter;
import org.mapstruct.ap.internal.model.common.Type; import org.mapstruct.ap.internal.model.common.Type;
import org.mapstruct.ap.internal.model.source.MappingOptions; import org.mapstruct.ap.internal.model.source.MappingMethodOptions;
import org.mapstruct.ap.internal.model.source.Method; import org.mapstruct.ap.internal.model.source.Method;
import org.mapstruct.ap.internal.model.source.ParameterProvidedMethods; import org.mapstruct.ap.internal.model.source.ParameterProvidedMethods;
import org.mapstruct.ap.internal.util.MapperConfiguration; import org.mapstruct.ap.internal.util.MapperOptions;
import org.mapstruct.ap.internal.util.Strings; import org.mapstruct.ap.internal.util.Strings;
import static org.mapstruct.ap.internal.util.Collections.first; import static org.mapstruct.ap.internal.util.Collections.first;
@ -255,7 +255,7 @@ public abstract class BuiltInMethod implements Method {
} }
@Override @Override
public MapperConfiguration getMapperConfiguration() { public MapperOptions getMapperConfiguration() {
return null; return null;
} }
@ -270,8 +270,8 @@ public abstract class BuiltInMethod implements Method {
} }
@Override @Override
public MappingOptions getMappingOptions() { public MappingMethodOptions getMappingOptions() {
return MappingOptions.empty(); return MappingMethodOptions.empty();
} }
public BuiltInFieldReference getFieldReference() { public BuiltInFieldReference getFieldReference() {

View File

@ -24,7 +24,7 @@ import org.mapstruct.ap.internal.model.MapperReference;
import org.mapstruct.ap.internal.model.common.Type; import org.mapstruct.ap.internal.model.common.Type;
import org.mapstruct.ap.internal.model.common.TypeFactory; import org.mapstruct.ap.internal.model.common.TypeFactory;
import org.mapstruct.ap.internal.prism.InjectionStrategyPrism; import org.mapstruct.ap.internal.prism.InjectionStrategyPrism;
import org.mapstruct.ap.internal.util.MapperConfiguration; import org.mapstruct.ap.internal.util.MapperOptions;
/** /**
* An {@link ModelElementProcessor} which converts the given {@link Mapper} object into an annotation based component * An {@link ModelElementProcessor} which converts the given {@link Mapper} object into an annotation based component
@ -42,7 +42,7 @@ public abstract class AnnotationBasedComponentModelProcessor implements ModelEle
public Mapper process(ProcessorContext context, TypeElement mapperTypeElement, Mapper mapper) { public Mapper process(ProcessorContext context, TypeElement mapperTypeElement, Mapper mapper) {
this.typeFactory = context.getTypeFactory(); this.typeFactory = context.getTypeFactory();
MapperConfiguration mapperConfiguration = MapperConfiguration.getInstanceOn( mapperTypeElement ); MapperOptions mapperConfiguration = MapperOptions.getInstanceOn( mapperTypeElement );
String componentModel = mapperConfiguration.componentModel( context.getOptions() ); String componentModel = mapperConfiguration.componentModel( context.getOptions() );
InjectionStrategyPrism injectionStrategy = mapperConfiguration.getInjectionStrategy( context.getOptions() ); InjectionStrategyPrism injectionStrategy = mapperConfiguration.getInjectionStrategy( context.getOptions() );

View File

@ -40,8 +40,8 @@ import org.mapstruct.ap.internal.model.ValueMappingMethod;
import org.mapstruct.ap.internal.model.common.FormattingParameters; import org.mapstruct.ap.internal.model.common.FormattingParameters;
import org.mapstruct.ap.internal.model.common.Type; import org.mapstruct.ap.internal.model.common.Type;
import org.mapstruct.ap.internal.model.common.TypeFactory; import org.mapstruct.ap.internal.model.common.TypeFactory;
import org.mapstruct.ap.internal.model.source.BeanMapping; import org.mapstruct.ap.internal.model.source.BeanMappingOptions;
import org.mapstruct.ap.internal.model.source.MappingOptions; import org.mapstruct.ap.internal.model.source.MappingMethodOptions;
import org.mapstruct.ap.internal.model.source.Method; import org.mapstruct.ap.internal.model.source.Method;
import org.mapstruct.ap.internal.model.source.SelectionParameters; import org.mapstruct.ap.internal.model.source.SelectionParameters;
import org.mapstruct.ap.internal.model.source.SourceMethod; import org.mapstruct.ap.internal.model.source.SourceMethod;
@ -56,7 +56,7 @@ import org.mapstruct.ap.internal.prism.NullValueMappingStrategyPrism;
import org.mapstruct.ap.internal.processor.creation.MappingResolverImpl; import org.mapstruct.ap.internal.processor.creation.MappingResolverImpl;
import org.mapstruct.ap.internal.util.AccessorNamingUtils; import org.mapstruct.ap.internal.util.AccessorNamingUtils;
import org.mapstruct.ap.internal.util.FormattingMessager; import org.mapstruct.ap.internal.util.FormattingMessager;
import org.mapstruct.ap.internal.util.MapperConfiguration; import org.mapstruct.ap.internal.util.MapperOptions;
import org.mapstruct.ap.internal.util.Message; import org.mapstruct.ap.internal.util.Message;
import org.mapstruct.ap.internal.util.Strings; import org.mapstruct.ap.internal.util.Strings;
import org.mapstruct.ap.internal.version.VersionInformation; import org.mapstruct.ap.internal.version.VersionInformation;
@ -93,7 +93,7 @@ public class MapperCreationProcessor implements ModelElementProcessor<List<Sourc
this.typeFactory = context.getTypeFactory(); this.typeFactory = context.getTypeFactory();
this.accessorNaming = context.getAccessorNaming(); this.accessorNaming = context.getAccessorNaming();
MapperConfiguration mapperConfig = MapperConfiguration.getInstanceOn( mapperTypeElement ); MapperOptions mapperConfig = MapperOptions.getInstanceOn( mapperTypeElement );
List<MapperReference> mapperReferences = initReferencedMappers( mapperTypeElement, mapperConfig ); List<MapperReference> mapperReferences = initReferencedMappers( mapperTypeElement, mapperConfig );
MappingBuilderContext ctx = new MappingBuilderContext( MappingBuilderContext ctx = new MappingBuilderContext(
@ -126,7 +126,7 @@ public class MapperCreationProcessor implements ModelElementProcessor<List<Sourc
return 1000; return 1000;
} }
private List<MapperReference> initReferencedMappers(TypeElement element, MapperConfiguration mapperConfig) { private List<MapperReference> initReferencedMappers(TypeElement element, MapperOptions mapperConfig) {
List<MapperReference> result = new LinkedList<>(); List<MapperReference> result = new LinkedList<>();
List<String> variableNames = new LinkedList<>(); List<String> variableNames = new LinkedList<>();
@ -145,7 +145,7 @@ public class MapperCreationProcessor implements ModelElementProcessor<List<Sourc
return result; return result;
} }
private Mapper getMapper(TypeElement element, MapperConfiguration mapperConfig, List<SourceMethod> methods) { private Mapper getMapper(TypeElement element, MapperOptions mapperConfig, List<SourceMethod> methods) {
List<MappingMethod> mappingMethods = getMappingMethods( mapperConfig, methods ); List<MappingMethod> mappingMethods = getMappingMethods( mapperConfig, methods );
mappingMethods.addAll( mappingContext.getUsedSupportedMappings() ); mappingMethods.addAll( mappingContext.getUsedSupportedMappings() );
@ -257,7 +257,7 @@ public class MapperCreationProcessor implements ModelElementProcessor<List<Sourc
private SortedSet<Type> getExtraImports(TypeElement element) { private SortedSet<Type> getExtraImports(TypeElement element) {
SortedSet<Type> extraImports = new TreeSet<>(); SortedSet<Type> extraImports = new TreeSet<>();
MapperConfiguration mapperConfiguration = MapperConfiguration.getInstanceOn( element ); MapperOptions mapperConfiguration = MapperOptions.getInstanceOn( element );
for ( TypeMirror extraImport : mapperConfiguration.imports() ) { for ( TypeMirror extraImport : mapperConfiguration.imports() ) {
Type type = typeFactory.getType( extraImport ); Type type = typeFactory.getType( extraImport );
@ -272,7 +272,7 @@ public class MapperCreationProcessor implements ModelElementProcessor<List<Sourc
return extraImports; return extraImports;
} }
private List<MappingMethod> getMappingMethods(MapperConfiguration mapperConfig, List<SourceMethod> methods) { private List<MappingMethod> getMappingMethods(MapperOptions mapperConfig, List<SourceMethod> methods) {
List<MappingMethod> mappingMethods = new ArrayList<>(); List<MappingMethod> mappingMethods = new ArrayList<>();
for ( SourceMethod method : methods ) { for ( SourceMethod method : methods ) {
@ -282,7 +282,7 @@ public class MapperCreationProcessor implements ModelElementProcessor<List<Sourc
mergeInheritedOptions( method, mapperConfig, methods, new ArrayList<>() ); mergeInheritedOptions( method, mapperConfig, methods, new ArrayList<>() );
MappingOptions mappingOptions = method.getMappingOptions(); MappingMethodOptions mappingOptions = method.getMappingOptions();
boolean hasFactoryMethod = false; boolean hasFactoryMethod = false;
@ -360,7 +360,7 @@ public class MapperCreationProcessor implements ModelElementProcessor<List<Sourc
} }
else { else {
this.messager.note( 1, Message.BEANMAPPING_CREATE_NOTE, method ); this.messager.note( 1, Message.BEANMAPPING_CREATE_NOTE, method );
BuilderPrism builderPrism = BeanMapping.builderPrismFor( method ); BuilderPrism builderPrism = BeanMappingOptions.builderPrismFor( method );
BeanMappingMethod.Builder builder = new BeanMappingMethod.Builder(); BeanMappingMethod.Builder builder = new BeanMappingMethod.Builder();
BeanMappingMethod beanMappingMethod = builder BeanMappingMethod beanMappingMethod = builder
.mappingContext( mappingContext ) .mappingContext( mappingContext )
@ -387,7 +387,7 @@ public class MapperCreationProcessor implements ModelElementProcessor<List<Sourc
} }
private <M extends ContainerMappingMethod> M createWithElementMappingMethod(SourceMethod method, private <M extends ContainerMappingMethod> M createWithElementMappingMethod(SourceMethod method,
MappingOptions mappingOptions, ContainerMappingMethodBuilder<?, M> builder) { MappingMethodOptions mappingOptions, ContainerMappingMethodBuilder<?, M> builder) {
FormattingParameters formattingParameters = null; FormattingParameters formattingParameters = null;
SelectionParameters selectionParameters = null; SelectionParameters selectionParameters = null;
@ -408,7 +408,7 @@ public class MapperCreationProcessor implements ModelElementProcessor<List<Sourc
.build(); .build();
} }
private void mergeInheritedOptions(SourceMethod method, MapperConfiguration mapperConfig, private void mergeInheritedOptions(SourceMethod method, MapperOptions mapperConfig,
List<SourceMethod> availableMethods, List<SourceMethod> initializingMethods) { List<SourceMethod> availableMethods, List<SourceMethod> initializingMethods) {
if ( initializingMethods.contains( method ) ) { if ( initializingMethods.contains( method ) ) {
// cycle detected // cycle detected
@ -424,7 +424,7 @@ public class MapperCreationProcessor implements ModelElementProcessor<List<Sourc
initializingMethods.add( method ); initializingMethods.add( method );
MappingOptions mappingOptions = method.getMappingOptions(); MappingMethodOptions mappingOptions = method.getMappingOptions();
List<SourceMethod> applicableReversePrototypeMethods = method.getApplicableReversePrototypeMethods(); List<SourceMethod> applicableReversePrototypeMethods = method.getApplicableReversePrototypeMethods();
SourceMethod inverseTemplateMethod = SourceMethod inverseTemplateMethod =
@ -512,7 +512,7 @@ public class MapperCreationProcessor implements ModelElementProcessor<List<Sourc
*/ */
private SourceMethod getInverseTemplateMethod(List<SourceMethod> rawMethods, SourceMethod method, private SourceMethod getInverseTemplateMethod(List<SourceMethod> rawMethods, SourceMethod method,
List<SourceMethod> initializingMethods, List<SourceMethod> initializingMethods,
MapperConfiguration mapperConfig) { MapperOptions mapperConfig) {
SourceMethod resultMethod = null; SourceMethod resultMethod = null;
InheritInverseConfigurationPrism inversePrism = InheritInverseConfigurationPrism.getInstanceOn( InheritInverseConfigurationPrism inversePrism = InheritInverseConfigurationPrism.getInstanceOn(
method.getExecutable() method.getExecutable()
@ -568,7 +568,7 @@ public class MapperCreationProcessor implements ModelElementProcessor<List<Sourc
private SourceMethod extractInitializedOptions(SourceMethod resultMethod, private SourceMethod extractInitializedOptions(SourceMethod resultMethod,
List<SourceMethod> rawMethods, List<SourceMethod> rawMethods,
MapperConfiguration mapperConfig, MapperOptions mapperConfig,
List<SourceMethod> initializingMethods) { List<SourceMethod> initializingMethods) {
if ( resultMethod != null ) { if ( resultMethod != null ) {
if ( !resultMethod.getMappingOptions().isFullyInitialized() ) { if ( !resultMethod.getMappingOptions().isFullyInitialized() ) {
@ -589,7 +589,7 @@ public class MapperCreationProcessor implements ModelElementProcessor<List<Sourc
*/ */
private SourceMethod getForwardTemplateMethod(List<SourceMethod> rawMethods, SourceMethod method, private SourceMethod getForwardTemplateMethod(List<SourceMethod> rawMethods, SourceMethod method,
List<SourceMethod> initializingMethods, List<SourceMethod> initializingMethods,
MapperConfiguration mapperConfig) { MapperOptions mapperConfig) {
SourceMethod resultMethod = null; SourceMethod resultMethod = null;
InheritConfigurationPrism forwardPrism = InheritConfigurationPrism.getInstanceOn( InheritConfigurationPrism forwardPrism = InheritConfigurationPrism.getInstanceOn(
method.getExecutable() method.getExecutable()

View File

@ -15,7 +15,7 @@ import javax.tools.StandardLocation;
import org.mapstruct.ap.internal.model.GeneratedType; import org.mapstruct.ap.internal.model.GeneratedType;
import org.mapstruct.ap.internal.model.Mapper; import org.mapstruct.ap.internal.model.Mapper;
import org.mapstruct.ap.internal.model.ServicesEntry; import org.mapstruct.ap.internal.model.ServicesEntry;
import org.mapstruct.ap.internal.util.MapperConfiguration; import org.mapstruct.ap.internal.util.MapperOptions;
import org.mapstruct.ap.internal.writer.ModelWriter; import org.mapstruct.ap.internal.writer.ModelWriter;
/** /**
@ -37,7 +37,7 @@ public class MapperServiceProcessor implements ModelElementProcessor<Mapper, Vo
} }
else { else {
String componentModel = String componentModel =
MapperConfiguration.getInstanceOn( mapperTypeElement ).componentModel( context.getOptions() ); MapperOptions.getInstanceOn( mapperTypeElement ).componentModel( context.getOptions() );
spiGenerationNeeded = "default".equals( componentModel ); spiGenerationNeeded = "default".equals( componentModel );
} }

View File

@ -26,9 +26,9 @@ import javax.lang.model.util.Types;
import org.mapstruct.ap.internal.model.common.Parameter; import org.mapstruct.ap.internal.model.common.Parameter;
import org.mapstruct.ap.internal.model.common.Type; import org.mapstruct.ap.internal.model.common.Type;
import org.mapstruct.ap.internal.model.common.TypeFactory; import org.mapstruct.ap.internal.model.common.TypeFactory;
import org.mapstruct.ap.internal.model.source.BeanMapping; import org.mapstruct.ap.internal.model.source.BeanMappingOptions;
import org.mapstruct.ap.internal.model.source.IterableMapping; import org.mapstruct.ap.internal.model.source.IterableMappingOptions;
import org.mapstruct.ap.internal.model.source.MapMapping; import org.mapstruct.ap.internal.model.source.MapMappingOptions;
import org.mapstruct.ap.internal.model.source.Mapping; import org.mapstruct.ap.internal.model.source.Mapping;
import org.mapstruct.ap.internal.model.source.ParameterProvidedMethods; import org.mapstruct.ap.internal.model.source.ParameterProvidedMethods;
import org.mapstruct.ap.internal.model.source.SourceMethod; import org.mapstruct.ap.internal.model.source.SourceMethod;
@ -45,7 +45,7 @@ import org.mapstruct.ap.internal.util.AccessorNamingUtils;
import org.mapstruct.ap.internal.util.AnnotationProcessingException; import org.mapstruct.ap.internal.util.AnnotationProcessingException;
import org.mapstruct.ap.internal.util.Executables; import org.mapstruct.ap.internal.util.Executables;
import org.mapstruct.ap.internal.util.FormattingMessager; import org.mapstruct.ap.internal.util.FormattingMessager;
import org.mapstruct.ap.internal.util.MapperConfiguration; import org.mapstruct.ap.internal.util.MapperOptions;
import org.mapstruct.ap.internal.util.Message; import org.mapstruct.ap.internal.util.Message;
import static org.mapstruct.ap.internal.util.Executables.getAllEnclosedExecutableElements; import static org.mapstruct.ap.internal.util.Executables.getAllEnclosedExecutableElements;
@ -81,7 +81,7 @@ public class MethodRetrievalProcessor implements ModelElementProcessor<Void, Lis
this.messager.note( 0, Message.PROCESSING_NOTE, mapperTypeElement ); this.messager.note( 0, Message.PROCESSING_NOTE, mapperTypeElement );
MapperConfiguration mapperConfig = MapperConfiguration.getInstanceOn( mapperTypeElement ); MapperOptions mapperConfig = MapperOptions.getInstanceOn( mapperTypeElement );
if ( mapperConfig != null ) { if ( mapperConfig != null ) {
this.messager.note( 0, Message.CONFIG_NOTE, mapperConfig.getClass().getName() ); this.messager.note( 0, Message.CONFIG_NOTE, mapperConfig.getClass().getName() );
@ -104,7 +104,7 @@ public class MethodRetrievalProcessor implements ModelElementProcessor<Void, Lis
} }
private List<SourceMethod> retrievePrototypeMethods(TypeElement mapperTypeElement, private List<SourceMethod> retrievePrototypeMethods(TypeElement mapperTypeElement,
MapperConfiguration mapperConfig) { MapperOptions mapperConfig) {
if ( mapperConfig.config() == null ) { if ( mapperConfig.config() == null ) {
return Collections.emptyList(); return Collections.emptyList();
} }
@ -149,7 +149,7 @@ public class MethodRetrievalProcessor implements ModelElementProcessor<Void, Lis
* @return All mapping methods declared by the given type * @return All mapping methods declared by the given type
*/ */
private List<SourceMethod> retrieveMethods(TypeElement usedMapper, TypeElement mapperToImplement, private List<SourceMethod> retrieveMethods(TypeElement usedMapper, TypeElement mapperToImplement,
MapperConfiguration mapperConfig, List<SourceMethod> prototypeMethods) { MapperOptions mapperConfig, List<SourceMethod> prototypeMethods) {
List<SourceMethod> methods = new ArrayList<>(); List<SourceMethod> methods = new ArrayList<>();
for ( ExecutableElement executable : getAllEnclosedExecutableElements( elementUtils, usedMapper ) ) { for ( ExecutableElement executable : getAllEnclosedExecutableElements( elementUtils, usedMapper ) ) {
@ -186,7 +186,7 @@ public class MethodRetrievalProcessor implements ModelElementProcessor<Void, Lis
private SourceMethod getMethod(TypeElement usedMapper, private SourceMethod getMethod(TypeElement usedMapper,
ExecutableElement method, ExecutableElement method,
TypeElement mapperToImplement, TypeElement mapperToImplement,
MapperConfiguration mapperConfig, MapperOptions mapperConfig,
List<SourceMethod> prototypeMethods) { List<SourceMethod> prototypeMethods) {
ExecutableType methodType = typeFactory.getMethodType( (DeclaredType) usedMapper.asType(), method ); ExecutableType methodType = typeFactory.getMethodType( (DeclaredType) usedMapper.asType(), method );
@ -219,7 +219,7 @@ public class MethodRetrievalProcessor implements ModelElementProcessor<Void, Lis
private SourceMethod getMethodRequiringImplementation(ExecutableType methodType, ExecutableElement method, private SourceMethod getMethodRequiringImplementation(ExecutableType methodType, ExecutableElement method,
List<Parameter> parameters, List<Parameter> parameters,
boolean containsTargetTypeParameter, boolean containsTargetTypeParameter,
MapperConfiguration mapperConfig, MapperOptions mapperConfig,
List<SourceMethod> prototypeMethods, List<SourceMethod> prototypeMethods,
TypeElement mapperToImplement) { TypeElement mapperToImplement) {
Type returnType = typeFactory.getReturnType( methodType ); Type returnType = typeFactory.getReturnType( methodType );
@ -253,16 +253,16 @@ public class MethodRetrievalProcessor implements ModelElementProcessor<Void, Lis
.setExceptionTypes( exceptionTypes ) .setExceptionTypes( exceptionTypes )
.setMappings( getMappings( method, method, new LinkedHashSet<>(), new HashSet<>() ) ) .setMappings( getMappings( method, method, new LinkedHashSet<>(), new HashSet<>() ) )
.setIterableMapping( .setIterableMapping(
IterableMapping.fromPrism( IterableMappingOptions.fromPrism(
IterableMappingPrism.getInstanceOn( method ), IterableMappingPrism.getInstanceOn( method ),
method, method,
messager, messager,
typeUtils typeUtils
) ) ) )
.setMapMapping( .setMapMapping(
MapMapping.fromPrism( MapMappingPrism.getInstanceOn( method ), method, messager, typeUtils ) ) MapMappingOptions.fromPrism( MapMappingPrism.getInstanceOn( method ), method, messager, typeUtils ) )
.setBeanMapping( .setBeanMapping(
new BeanMapping.Builder() new BeanMappingOptions.Builder()
.beanMappingPrism( BeanMappingPrism.getInstanceOn( method ) ) .beanMappingPrism( BeanMappingPrism.getInstanceOn( method ) )
.messager( messager ) .messager( messager )
.method( method ) .method( method )
@ -280,7 +280,7 @@ public class MethodRetrievalProcessor implements ModelElementProcessor<Void, Lis
} }
private ParameterProvidedMethods retrieveContextProvidedMethods( private ParameterProvidedMethods retrieveContextProvidedMethods(
List<Parameter> contextParameters, TypeElement mapperToImplement, MapperConfiguration mapperConfig) { List<Parameter> contextParameters, TypeElement mapperToImplement, MapperOptions mapperConfig) {
ParameterProvidedMethods.Builder builder = ParameterProvidedMethods.builder(); ParameterProvidedMethods.Builder builder = ParameterProvidedMethods.builder();
for ( Parameter contextParam : contextParameters ) { for ( Parameter contextParam : contextParameters ) {