mirror of
https://github.com/mapstruct/mapstruct.git
synced 2025-07-12 00:00:08 +08:00
#81, remove isHasFactoryMethod construction in the Freemarker template in favour for the '??'
This commit is contained in:
parent
8bdec6405d
commit
b456cc8b6b
@ -39,13 +39,11 @@ public class BeanMappingMethod extends MappingMethod {
|
|||||||
|
|
||||||
private final List<PropertyMapping> propertyMappings;
|
private final List<PropertyMapping> propertyMappings;
|
||||||
private final FactoryMethod factoryMethod;
|
private final FactoryMethod factoryMethod;
|
||||||
private final boolean hasFactoryMethod;
|
|
||||||
|
|
||||||
public BeanMappingMethod(Method method, List<PropertyMapping> propertyMappings, FactoryMethod factoryMethod) {
|
public BeanMappingMethod(Method method, List<PropertyMapping> propertyMappings, FactoryMethod factoryMethod) {
|
||||||
super( method );
|
super( method );
|
||||||
this.propertyMappings = propertyMappings;
|
this.propertyMappings = propertyMappings;
|
||||||
this.factoryMethod = factoryMethod;
|
this.factoryMethod = factoryMethod;
|
||||||
this.hasFactoryMethod = factoryMethod != null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<PropertyMapping> getPropertyMappings() {
|
public List<PropertyMapping> getPropertyMappings() {
|
||||||
@ -64,7 +62,6 @@ public class BeanMappingMethod extends MappingMethod {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return mappingsByParameter;
|
return mappingsByParameter;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -79,10 +76,6 @@ public class BeanMappingMethod extends MappingMethod {
|
|||||||
return types;
|
return types;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isHasFactoryMethod() {
|
|
||||||
return this.hasFactoryMethod;
|
|
||||||
}
|
|
||||||
|
|
||||||
public FactoryMethod getFactoryMethod() {
|
public FactoryMethod getFactoryMethod() {
|
||||||
return this.factoryMethod;
|
return this.factoryMethod;
|
||||||
}
|
}
|
||||||
|
@ -25,7 +25,7 @@ public <@includeModel object=returnType/> ${name}(<#list parameters as param><@i
|
|||||||
}
|
}
|
||||||
|
|
||||||
<#if !existingInstanceMapping>
|
<#if !existingInstanceMapping>
|
||||||
${resultType.name} ${resultName} = <#if hasFactoryMethod><@includeModel object=factoryMethod/><#else>new ${resultType.name}()</#if>;
|
${resultType.name} ${resultName} = <#if factoryMethod??><@includeModel object=factoryMethod/><#else>new ${resultType.name}()</#if>;
|
||||||
</#if>
|
</#if>
|
||||||
<#if (sourceParameters?size > 1)>
|
<#if (sourceParameters?size > 1)>
|
||||||
<#list sourceParameters as sourceParam>
|
<#list sourceParameters as sourceParam>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user