#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.Type;
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}
@ -52,7 +52,7 @@ public class CreateDecimalFormat extends HelperMethod {
}
@Override
public MappingOptions getMappingOptions() {
return MappingOptions.empty();
public MappingMethodOptions getMappingOptions() {
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.source.MappingMethodUtils;
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;
/**
@ -60,7 +60,7 @@ class AbstractBaseBuilder<B extends AbstractBaseBuilder<B>> {
}
private boolean isDisableSubMappingMethodsGeneration() {
MapperConfiguration configuration = MapperConfiguration.getInstanceOn( ctx.getMapperTypeElement() );
MapperOptions configuration = MapperOptions.getInstanceOn( ctx.getMapperTypeElement() );
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.SourceRHS;
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 static org.mapstruct.ap.internal.model.ForgedMethod.forElementMapping;
@ -58,7 +58,7 @@ public abstract class AbstractMappingMethodBuilder<B extends AbstractMappingMeth
return createForgedAssignment(
sourceRHS,
ctx.getTypeFactory()
.builderTypeFor( targetType, BeanMapping.builderPrismFor( method ) ),
.builderTypeFor( targetType, BeanMappingOptions.builderPrismFor( method ) ),
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.dependency.GraphAnalyzer;
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.MappingOptions;
import org.mapstruct.ap.internal.model.source.MappingMethodOptions;
import org.mapstruct.ap.internal.model.source.Method;
import org.mapstruct.ap.internal.model.source.SelectionParameters;
import org.mapstruct.ap.internal.model.source.SourceMethod;
import org.mapstruct.ap.internal.prism.CollectionMappingStrategyPrism;
import org.mapstruct.ap.internal.prism.NullValueMappingStrategyPrism;
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.Strings;
import org.mapstruct.ap.internal.util.accessor.Accessor;
@ -121,7 +121,7 @@ public class BeanMappingMethod extends NormalTypeMappingMethod {
public BeanMappingMethod build() {
BeanMapping beanMapping = method.getMappingOptions().getBeanMapping();
BeanMappingOptions beanMapping = method.getMappingOptions().getBeanMapping();
SelectionParameters selectionParameters = beanMapping != null ? beanMapping.getSelectionParameters() : null;
/* 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() ) {
return ReportingPolicyPrism.IGNORE;
}
MappingOptions mappingOptions = method.getMappingOptions();
MappingMethodOptions mappingOptions = method.getMappingOptions();
if ( mappingOptions.getBeanMapping() != null &&
mappingOptions.getBeanMapping().getReportingPolicy() != null ) {
return mappingOptions.getBeanMapping().getReportingPolicy();
}
MapperConfiguration mapperSettings = MapperConfiguration.getInstanceOn( ctx.getMapperTypeElement() );
MapperOptions mapperSettings = MapperOptions.getInstanceOn( ctx.getMapperTypeElement() );
return mapperSettings.unmappedTargetPolicy( ctx.getOptions() );
}
@ -917,7 +917,7 @@ public class BeanMappingMethod extends NormalTypeMappingMethod {
if ( mappingReferences.isForForgedMethods() ) {
return ReportingPolicyPrism.IGNORE;
}
MapperConfiguration mapperSettings = MapperConfiguration.getInstanceOn( ctx.getMapperTypeElement() );
MapperOptions mapperSettings = MapperOptions.getInstanceOn( ctx.getMapperTypeElement() );
return mapperSettings.unmappedSourcePolicy();
}

View File

@ -9,7 +9,7 @@ import java.util.Collection;
import javax.lang.model.element.ExecutableElement;
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.prism.BuilderPrism;
import org.mapstruct.ap.internal.util.Message;
@ -35,7 +35,7 @@ public class BuilderFinisherMethodResolver {
return null;
}
BuilderPrism builderMapping = BeanMapping.builderPrismFor( method );
BuilderPrism builderMapping = BeanMappingOptions.builderPrismFor( method );
if ( builderMapping == null && buildMethods.size() == 1 ) {
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.Parameter;
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.source.Method;
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;
/**
@ -323,7 +323,7 @@ public class ForgedMethod implements Method {
}
@Override
public MapperConfiguration getMapperConfiguration() {
public MapperOptions getMapperConfiguration() {
return basedOn.getMapperConfiguration();
}
@ -343,7 +343,7 @@ public class ForgedMethod implements Method {
}
@Override
public MappingOptions getMappingOptions() {
public MappingMethodOptions 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.source.Method;
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;
/**
@ -238,7 +238,7 @@ public abstract class HelperMethod implements Method {
}
@Override
public MapperConfiguration getMapperConfiguration() {
public MapperOptions getMapperConfiguration() {
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.SourceRHS;
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.source.Method;
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.NullValueMappingStrategyPrism;
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.NativeTypes;
import org.mapstruct.ap.internal.util.Strings;
@ -111,7 +111,7 @@ public class PropertyMapping extends ModelElement {
public T targetWriteAccessor(Accessor targetWriteAccessor) {
this.targetWriteAccessor = targetWriteAccessor;
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.targetWriteAccessorType = targetWriteAccessor.getAccessorType();
return (T) this;
@ -230,8 +230,8 @@ public class PropertyMapping extends ModelElement {
public PropertyMapping build() {
MapperConfiguration mapperConfiguration = method.getMapperConfiguration();
BeanMapping beanMapping = method.getMappingOptions().getBeanMapping();
MapperOptions mapperConfiguration = method.getMapperConfiguration();
BeanMappingOptions beanMapping = method.getMappingOptions().getBeanMapping();
// null value check strategy (determine true value based on hierarchy)
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.Type;
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.Method;
import org.mapstruct.ap.internal.prism.BuilderPrism;
@ -203,7 +203,7 @@ public class TargetReference extends AbstractReference {
);
}
else {
BuilderPrism builderPrism = BeanMapping.builderPrismFor( method );
BuilderPrism builderPrism = BeanMappingOptions.builderPrismFor( method );
builderType = typeFactory.builderTypeFor( nextType, builderPrism );
propertyEntry = PropertyEntry.forTargetReference( fullName,
targetReadAccessor,
@ -271,7 +271,7 @@ public class TargetReference extends AbstractReference {
return type;
}
else {
BuilderPrism builderPrism = BeanMapping.builderPrismFor( method );
BuilderPrism builderPrism = BeanMappingOptions.builderPrismFor( method );
return typeFactory.effectiveResultTypeFor( type, builderPrism );
}
}

View File

@ -28,7 +28,7 @@ import org.mapstruct.ap.internal.util.Message;
*
* @author Sjaak Derksen
*/
public class BeanMapping {
public class BeanMappingOptions {
private final SelectionParameters selectionParameters;
private final NullValueMappingStrategyPrism nullValueMappingStrategy;
@ -48,8 +48,8 @@ public class BeanMapping {
*
* @return new mapping
*/
public static BeanMapping forInheritance(BeanMapping beanMapping) {
return new BeanMapping(
public static BeanMappingOptions forInheritance(BeanMappingOptions beanMapping) {
return new BeanMappingOptions(
SelectionParameters.forInheritance( beanMapping.selectionParameters ),
beanMapping.nullValueMappingStrategy,
beanMapping.nullValuePropertyMappingStrategy,
@ -95,7 +95,7 @@ public class BeanMapping {
return this;
}
public BeanMapping build() {
public BeanMappingOptions build() {
if ( prism == 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?
return new BeanMapping(
return new BeanMappingOptions(
cmp,
nullValueMappingStrategy,
nullValuePropertyMappingStrategy,
@ -162,7 +162,7 @@ public class BeanMapping {
}
}
private BeanMapping(SelectionParameters selectionParameters, NullValueMappingStrategyPrism nvms,
private BeanMappingOptions(SelectionParameters selectionParameters, NullValueMappingStrategyPrism nvms,
NullValuePropertyMappingStrategyPrism nvpms, NullValueCheckStrategyPrism nvcs,
ReportingPolicyPrism reportingPolicy, boolean ignoreByDefault,
List<String> ignoreUnmappedSourceProperties, BuilderPrism builder,

View File

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

View File

@ -21,7 +21,7 @@ import org.mapstruct.ap.internal.util.Message;
*
* @author Gunnar Morling
*/
public class MapMapping {
public class MapMappingOptions {
private final SelectionParameters keySelectionParameters;
private final SelectionParameters valueSelectionParameters;
@ -30,7 +30,7 @@ public class MapMapping {
private final AnnotationMirror mirror;
private final NullValueMappingStrategyPrism nullValueMappingStrategy;
public static MapMapping fromPrism(MapMappingPrism mapMapping, ExecutableElement method,
public static MapMappingOptions fromPrism(MapMappingPrism mapMapping, ExecutableElement method,
FormattingMessager messager, Types typeUtils) {
if ( mapMapping == null ) {
return null;
@ -89,7 +89,7 @@ public class MapMapping {
method
);
return new MapMapping(
return new MapMappingOptions(
keyFormatting,
keySelection,
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,
NullValueMappingStrategyPrism nvms ) {
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
*/
package org.mapstruct.ap.internal.util;
package org.mapstruct.ap.internal.model.source;
import java.util.ArrayList;
import java.util.LinkedHashSet;
@ -36,17 +36,17 @@ import org.mapstruct.ap.internal.prism.ReportingPolicyPrism;
*
* @author Sjaak Derksen
*/
public class MapperConfiguration {
public class MapperOptions {
private final MapperPrism mapperPrism;
private final MapperConfigPrism mapperConfigPrism;
private final DeclaredType config;
public static MapperConfiguration getInstanceOn(Element e) {
return new MapperConfiguration( MapperPrism.getInstanceOn( e ) );
public static MapperOptions getInstanceOn(Element e) {
return new MapperOptions( MapperPrism.getInstanceOn( e ) );
}
private MapperConfiguration(MapperPrism mapperPrism) {
private MapperOptions(MapperPrism mapperPrism) {
this.mapperPrism = mapperPrism;
if ( mapperPrism.values.config() != null ) {

View File

@ -24,8 +24,8 @@ import static org.mapstruct.ap.internal.model.source.Mapping.getMappingTargetNam
*
* @author Andreas Gudian
*/
public class MappingOptions {
private static final MappingOptions EMPTY = new MappingOptions( Collections.emptySet(),
public class MappingMethodOptions {
private static final MappingMethodOptions EMPTY = new MappingMethodOptions( Collections.emptySet(),
null,
null,
null,
@ -33,14 +33,14 @@ public class MappingOptions {
);
private Set<Mapping> mappings;
private IterableMapping iterableMapping;
private MapMapping mapMapping;
private BeanMapping beanMapping;
private IterableMappingOptions iterableMapping;
private MapMappingOptions mapMapping;
private BeanMappingOptions beanMapping;
private List<ValueMapping> valueMappings;
private boolean fullyInitialized;
public MappingOptions(Set<Mapping> mappings, IterableMapping iterableMapping, MapMapping mapMapping,
BeanMapping beanMapping, List<ValueMapping> valueMappings ) {
public MappingMethodOptions(Set<Mapping> mappings, IterableMappingOptions iterableMapping, MapMappingOptions mapMapping,
BeanMappingOptions beanMapping, List<ValueMapping> valueMappings ) {
this.mappings = mappings;
this.iterableMapping = iterableMapping;
this.mapMapping = mapMapping;
@ -53,7 +53,7 @@ public class MappingOptions {
*
* @return empty mapping options
*/
public static MappingOptions empty() {
public static MappingMethodOptions empty() {
return EMPTY;
}
@ -65,15 +65,15 @@ public class MappingOptions {
return mappings;
}
public IterableMapping getIterableMapping() {
public IterableMappingOptions getIterableMapping() {
return iterableMapping;
}
public MapMapping getMapMapping() {
public MapMappingOptions getMapMapping() {
return mapMapping;
}
public BeanMapping getBeanMapping() {
public BeanMappingOptions getBeanMapping() {
return beanMapping;
}
@ -81,15 +81,15 @@ public class MappingOptions {
return valueMappings;
}
public void setIterableMapping(IterableMapping iterableMapping) {
public void setIterableMapping(IterableMappingOptions iterableMapping) {
this.iterableMapping = iterableMapping;
}
public void setMapMapping(MapMapping mapMapping) {
public void setMapMapping(MapMappingOptions mapMapping) {
this.mapMapping = mapMapping;
}
public void setBeanMapping(BeanMapping beanMapping) {
public void setBeanMapping(BeanMappingOptions beanMapping) {
this.beanMapping = beanMapping;
}
@ -117,7 +117,7 @@ public class MappingOptions {
* @param method the source method
*/
public void applyInheritedOptions(SourceMethod templateMethod, boolean isInverse, SourceMethod method ) {
MappingOptions inherited = templateMethod.getMappingOptions();
MappingMethodOptions inherited = templateMethod.getMappingOptions();
if ( null != inherited ) {
if ( getIterableMapping() == null && inherited.getIterableMapping() != null) {
setIterableMapping( inherited.getIterableMapping() );
@ -128,7 +128,7 @@ public class MappingOptions {
}
if ( getBeanMapping() == null && inherited.getBeanMapping() != null ) {
setBeanMapping( BeanMapping.forInheritance( inherited.getBeanMapping() ) );
setBeanMapping( BeanMappingOptions.forInheritance( inherited.getBeanMapping() ) );
}
if ( getValueMappings() == null ) {
@ -179,7 +179,7 @@ public class MappingOptions {
if ( !method.isUpdateMethod() ) {
writeType = typeFactory.effectiveResultTypeFor(
writeType,
BeanMapping.builderPrismFor( method )
BeanMappingOptions.builderPrismFor( method )
);
}
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.Type;
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:
@ -168,7 +168,7 @@ public interface Method {
*
* @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)
@ -185,7 +185,7 @@ public interface 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.prism.ObjectFactoryPrism;
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 static org.mapstruct.ap.internal.model.source.MappingMethodUtils.isEnumMapping;
@ -31,7 +31,7 @@ import static org.mapstruct.ap.internal.util.Collections.first;
* type.
* <p>
* 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
*/
@ -49,8 +49,8 @@ public class SourceMethod implements Method {
private final Type returnType;
private final Accessibility accessibility;
private final List<Type> exceptionTypes;
private final MapperConfiguration config;
private final MappingOptions mappingOptions;
private final MapperOptions config;
private final MappingMethodOptions mappingOptions;
private final List<SourceMethod> prototypeMethods;
private final Type mapperToImplement;
@ -78,12 +78,12 @@ public class SourceMethod implements Method {
private Type returnType = null;
private List<Type> exceptionTypes;
private Set<Mapping> mappings;
private IterableMapping iterableMapping = null;
private MapMapping mapMapping = null;
private BeanMapping beanMapping = null;
private IterableMappingOptions iterableMapping = null;
private MapMappingOptions mapMapping = null;
private BeanMappingOptions beanMapping = null;
private Types typeUtils;
private TypeFactory typeFactory = null;
private MapperConfiguration mapperConfig = null;
private MapperOptions mapperConfig = null;
private List<SourceMethod> prototypeMethods = Collections.emptyList();
private List<ValueMapping> valueMappings;
private ParameterProvidedMethods contextProvidedMethods;
@ -118,17 +118,17 @@ public class SourceMethod implements Method {
return this;
}
public Builder setIterableMapping(IterableMapping iterableMapping) {
public Builder setIterableMapping(IterableMappingOptions iterableMapping) {
this.iterableMapping = iterableMapping;
return this;
}
public Builder setMapMapping(MapMapping mapMapping) {
public Builder setMapMapping(MapMappingOptions mapMapping) {
this.mapMapping = mapMapping;
return this;
}
public Builder setBeanMapping(BeanMapping beanMapping) {
public Builder setBeanMapping(BeanMappingOptions beanMapping) {
this.beanMapping = beanMapping;
return this;
}
@ -148,7 +148,7 @@ public class SourceMethod implements Method {
return this;
}
public Builder setMapperConfiguration(MapperConfiguration mapperConfig) {
public Builder setMapperConfiguration(MapperOptions mapperConfig) {
this.mapperConfig = mapperConfig;
return this;
}
@ -174,14 +174,14 @@ public class SourceMethod implements Method {
mappings = Collections.emptySet();
}
MappingOptions mappingOptions =
new MappingOptions( mappings, iterableMapping, mapMapping, beanMapping, valueMappings );
MappingMethodOptions mappingOptions =
new MappingMethodOptions( mappings, iterableMapping, mapMapping, beanMapping, valueMappings );
return new SourceMethod( this, mappingOptions );
}
}
private SourceMethod(Builder builder, MappingOptions mappingOptions) {
private SourceMethod(Builder builder, MappingMethodOptions mappingOptions) {
this.declaringMapper = builder.declaringMapper;
this.executable = builder.executable;
this.parameters = builder.parameters;
@ -463,7 +463,7 @@ public class SourceMethod implements Method {
}
@Override
public MappingOptions getMappingOptions() {
public MappingMethodOptions getMappingOptions() {
return mappingOptions;
}
@ -483,7 +483,7 @@ public class SourceMethod implements Method {
}
@Override
public MapperConfiguration getMapperConfiguration() {
public MapperOptions getMapperConfiguration() {
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.Parameter;
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.ParameterProvidedMethods;
import org.mapstruct.ap.internal.util.MapperConfiguration;
import org.mapstruct.ap.internal.util.MapperOptions;
import org.mapstruct.ap.internal.util.Strings;
import static org.mapstruct.ap.internal.util.Collections.first;
@ -255,7 +255,7 @@ public abstract class BuiltInMethod implements Method {
}
@Override
public MapperConfiguration getMapperConfiguration() {
public MapperOptions getMapperConfiguration() {
return null;
}
@ -270,8 +270,8 @@ public abstract class BuiltInMethod implements Method {
}
@Override
public MappingOptions getMappingOptions() {
return MappingOptions.empty();
public MappingMethodOptions getMappingOptions() {
return MappingMethodOptions.empty();
}
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.TypeFactory;
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
@ -42,7 +42,7 @@ public abstract class AnnotationBasedComponentModelProcessor implements ModelEle
public Mapper process(ProcessorContext context, TypeElement mapperTypeElement, Mapper mapper) {
this.typeFactory = context.getTypeFactory();
MapperConfiguration mapperConfiguration = MapperConfiguration.getInstanceOn( mapperTypeElement );
MapperOptions mapperConfiguration = MapperOptions.getInstanceOn( mapperTypeElement );
String componentModel = mapperConfiguration.componentModel( 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.Type;
import org.mapstruct.ap.internal.model.common.TypeFactory;
import org.mapstruct.ap.internal.model.source.BeanMapping;
import org.mapstruct.ap.internal.model.source.MappingOptions;
import org.mapstruct.ap.internal.model.source.BeanMappingOptions;
import org.mapstruct.ap.internal.model.source.MappingMethodOptions;
import org.mapstruct.ap.internal.model.source.Method;
import org.mapstruct.ap.internal.model.source.SelectionParameters;
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.util.AccessorNamingUtils;
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.Strings;
import org.mapstruct.ap.internal.version.VersionInformation;
@ -93,7 +93,7 @@ public class MapperCreationProcessor implements ModelElementProcessor<List<Sourc
this.typeFactory = context.getTypeFactory();
this.accessorNaming = context.getAccessorNaming();
MapperConfiguration mapperConfig = MapperConfiguration.getInstanceOn( mapperTypeElement );
MapperOptions mapperConfig = MapperOptions.getInstanceOn( mapperTypeElement );
List<MapperReference> mapperReferences = initReferencedMappers( mapperTypeElement, mapperConfig );
MappingBuilderContext ctx = new MappingBuilderContext(
@ -126,7 +126,7 @@ public class MapperCreationProcessor implements ModelElementProcessor<List<Sourc
return 1000;
}
private List<MapperReference> initReferencedMappers(TypeElement element, MapperConfiguration mapperConfig) {
private List<MapperReference> initReferencedMappers(TypeElement element, MapperOptions mapperConfig) {
List<MapperReference> result = new LinkedList<>();
List<String> variableNames = new LinkedList<>();
@ -145,7 +145,7 @@ public class MapperCreationProcessor implements ModelElementProcessor<List<Sourc
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 );
mappingMethods.addAll( mappingContext.getUsedSupportedMappings() );
@ -257,7 +257,7 @@ public class MapperCreationProcessor implements ModelElementProcessor<List<Sourc
private SortedSet<Type> getExtraImports(TypeElement element) {
SortedSet<Type> extraImports = new TreeSet<>();
MapperConfiguration mapperConfiguration = MapperConfiguration.getInstanceOn( element );
MapperOptions mapperConfiguration = MapperOptions.getInstanceOn( element );
for ( TypeMirror extraImport : mapperConfiguration.imports() ) {
Type type = typeFactory.getType( extraImport );
@ -272,7 +272,7 @@ public class MapperCreationProcessor implements ModelElementProcessor<List<Sourc
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<>();
for ( SourceMethod method : methods ) {
@ -282,7 +282,7 @@ public class MapperCreationProcessor implements ModelElementProcessor<List<Sourc
mergeInheritedOptions( method, mapperConfig, methods, new ArrayList<>() );
MappingOptions mappingOptions = method.getMappingOptions();
MappingMethodOptions mappingOptions = method.getMappingOptions();
boolean hasFactoryMethod = false;
@ -360,7 +360,7 @@ public class MapperCreationProcessor implements ModelElementProcessor<List<Sourc
}
else {
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 beanMappingMethod = builder
.mappingContext( mappingContext )
@ -387,7 +387,7 @@ public class MapperCreationProcessor implements ModelElementProcessor<List<Sourc
}
private <M extends ContainerMappingMethod> M createWithElementMappingMethod(SourceMethod method,
MappingOptions mappingOptions, ContainerMappingMethodBuilder<?, M> builder) {
MappingMethodOptions mappingOptions, ContainerMappingMethodBuilder<?, M> builder) {
FormattingParameters formattingParameters = null;
SelectionParameters selectionParameters = null;
@ -408,7 +408,7 @@ public class MapperCreationProcessor implements ModelElementProcessor<List<Sourc
.build();
}
private void mergeInheritedOptions(SourceMethod method, MapperConfiguration mapperConfig,
private void mergeInheritedOptions(SourceMethod method, MapperOptions mapperConfig,
List<SourceMethod> availableMethods, List<SourceMethod> initializingMethods) {
if ( initializingMethods.contains( method ) ) {
// cycle detected
@ -424,7 +424,7 @@ public class MapperCreationProcessor implements ModelElementProcessor<List<Sourc
initializingMethods.add( method );
MappingOptions mappingOptions = method.getMappingOptions();
MappingMethodOptions mappingOptions = method.getMappingOptions();
List<SourceMethod> applicableReversePrototypeMethods = method.getApplicableReversePrototypeMethods();
SourceMethod inverseTemplateMethod =
@ -512,7 +512,7 @@ public class MapperCreationProcessor implements ModelElementProcessor<List<Sourc
*/
private SourceMethod getInverseTemplateMethod(List<SourceMethod> rawMethods, SourceMethod method,
List<SourceMethod> initializingMethods,
MapperConfiguration mapperConfig) {
MapperOptions mapperConfig) {
SourceMethod resultMethod = null;
InheritInverseConfigurationPrism inversePrism = InheritInverseConfigurationPrism.getInstanceOn(
method.getExecutable()
@ -568,7 +568,7 @@ public class MapperCreationProcessor implements ModelElementProcessor<List<Sourc
private SourceMethod extractInitializedOptions(SourceMethod resultMethod,
List<SourceMethod> rawMethods,
MapperConfiguration mapperConfig,
MapperOptions mapperConfig,
List<SourceMethod> initializingMethods) {
if ( resultMethod != null ) {
if ( !resultMethod.getMappingOptions().isFullyInitialized() ) {
@ -589,7 +589,7 @@ public class MapperCreationProcessor implements ModelElementProcessor<List<Sourc
*/
private SourceMethod getForwardTemplateMethod(List<SourceMethod> rawMethods, SourceMethod method,
List<SourceMethod> initializingMethods,
MapperConfiguration mapperConfig) {
MapperOptions mapperConfig) {
SourceMethod resultMethod = null;
InheritConfigurationPrism forwardPrism = InheritConfigurationPrism.getInstanceOn(
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.Mapper;
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;
/**
@ -37,7 +37,7 @@ public class MapperServiceProcessor implements ModelElementProcessor<Mapper, Vo
}
else {
String componentModel =
MapperConfiguration.getInstanceOn( mapperTypeElement ).componentModel( context.getOptions() );
MapperOptions.getInstanceOn( mapperTypeElement ).componentModel( context.getOptions() );
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.Type;
import org.mapstruct.ap.internal.model.common.TypeFactory;
import org.mapstruct.ap.internal.model.source.BeanMapping;
import org.mapstruct.ap.internal.model.source.IterableMapping;
import org.mapstruct.ap.internal.model.source.MapMapping;
import org.mapstruct.ap.internal.model.source.BeanMappingOptions;
import org.mapstruct.ap.internal.model.source.IterableMappingOptions;
import org.mapstruct.ap.internal.model.source.MapMappingOptions;
import org.mapstruct.ap.internal.model.source.Mapping;
import org.mapstruct.ap.internal.model.source.ParameterProvidedMethods;
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.Executables;
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 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 );
MapperConfiguration mapperConfig = MapperConfiguration.getInstanceOn( mapperTypeElement );
MapperOptions mapperConfig = MapperOptions.getInstanceOn( mapperTypeElement );
if ( mapperConfig != null ) {
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,
MapperConfiguration mapperConfig) {
MapperOptions mapperConfig) {
if ( mapperConfig.config() == null ) {
return Collections.emptyList();
}
@ -149,7 +149,7 @@ public class MethodRetrievalProcessor implements ModelElementProcessor<Void, Lis
* @return All mapping methods declared by the given type
*/
private List<SourceMethod> retrieveMethods(TypeElement usedMapper, TypeElement mapperToImplement,
MapperConfiguration mapperConfig, List<SourceMethod> prototypeMethods) {
MapperOptions mapperConfig, List<SourceMethod> prototypeMethods) {
List<SourceMethod> methods = new ArrayList<>();
for ( ExecutableElement executable : getAllEnclosedExecutableElements( elementUtils, usedMapper ) ) {
@ -186,7 +186,7 @@ public class MethodRetrievalProcessor implements ModelElementProcessor<Void, Lis
private SourceMethod getMethod(TypeElement usedMapper,
ExecutableElement method,
TypeElement mapperToImplement,
MapperConfiguration mapperConfig,
MapperOptions mapperConfig,
List<SourceMethod> prototypeMethods) {
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,
List<Parameter> parameters,
boolean containsTargetTypeParameter,
MapperConfiguration mapperConfig,
MapperOptions mapperConfig,
List<SourceMethod> prototypeMethods,
TypeElement mapperToImplement) {
Type returnType = typeFactory.getReturnType( methodType );
@ -253,16 +253,16 @@ public class MethodRetrievalProcessor implements ModelElementProcessor<Void, Lis
.setExceptionTypes( exceptionTypes )
.setMappings( getMappings( method, method, new LinkedHashSet<>(), new HashSet<>() ) )
.setIterableMapping(
IterableMapping.fromPrism(
IterableMappingOptions.fromPrism(
IterableMappingPrism.getInstanceOn( method ),
method,
messager,
typeUtils
) )
.setMapMapping(
MapMapping.fromPrism( MapMappingPrism.getInstanceOn( method ), method, messager, typeUtils ) )
MapMappingOptions.fromPrism( MapMappingPrism.getInstanceOn( method ), method, messager, typeUtils ) )
.setBeanMapping(
new BeanMapping.Builder()
new BeanMappingOptions.Builder()
.beanMappingPrism( BeanMappingPrism.getInstanceOn( method ) )
.messager( messager )
.method( method )
@ -280,7 +280,7 @@ public class MethodRetrievalProcessor implements ModelElementProcessor<Void, Lis
}
private ParameterProvidedMethods retrieveContextProvidedMethods(
List<Parameter> contextParameters, TypeElement mapperToImplement, MapperConfiguration mapperConfig) {
List<Parameter> contextParameters, TypeElement mapperToImplement, MapperOptions mapperConfig) {
ParameterProvidedMethods.Builder builder = ParameterProvidedMethods.builder();
for ( Parameter contextParam : contextParameters ) {