mirror of
https://github.com/mapstruct/mapstruct.git
synced 2025-07-12 00:00:08 +08:00
#64 Removing superfluous indentations from templates; Each template can start with an indentation of 0 as it will be correctly indented automatically later on
This commit is contained in:
parent
4a0141fb4b
commit
3e8ba36774
@ -18,8 +18,8 @@
|
||||
limitations under the License.
|
||||
|
||||
-->
|
||||
@Override
|
||||
public ${returnType.name} ${name}(<#list parameters as param><@includeModel object=param/><#if param_has_next>, </#if></#list>) {
|
||||
@Override
|
||||
public ${returnType.name} ${name}(<#list parameters as param><@includeModel object=param/><#if param_has_next>, </#if></#list>) {
|
||||
if ( <#list sourceParameters as sourceParam>${sourceParam.name} == null<#if sourceParam_has_next> && </#if></#list> ) {
|
||||
return<#if returnType.name != "void"> null</#if>;
|
||||
}
|
||||
@ -45,4 +45,4 @@
|
||||
|
||||
return ${resultName};
|
||||
</#if>
|
||||
}
|
||||
}
|
@ -18,4 +18,4 @@
|
||||
limitations under the License.
|
||||
|
||||
-->
|
||||
private final ${mapperType.name} ${variableName} = new ${mapperType.name}();
|
||||
private final ${mapperType.name} ${variableName} = new ${mapperType.name}();
|
@ -18,8 +18,8 @@
|
||||
limitations under the License.
|
||||
|
||||
-->
|
||||
@Override
|
||||
public <@includeModel object=returnType/> ${name}(<#list parameters as param><@includeModel object=param/><#if param_has_next>, </#if></#list>) {
|
||||
@Override
|
||||
public <@includeModel object=returnType/> ${name}(<#list parameters as param><@includeModel object=param/><#if param_has_next>, </#if></#list>) {
|
||||
if ( ${sourceParameter.name} == null ) {
|
||||
return<#if returnType.name != "void"> null</#if>;
|
||||
}
|
||||
@ -53,4 +53,4 @@
|
||||
|
||||
return ${resultName};
|
||||
</#if>
|
||||
}
|
||||
}
|
@ -18,8 +18,8 @@
|
||||
limitations under the License.
|
||||
|
||||
-->
|
||||
@Override
|
||||
public <@includeModel object=returnType /> ${name}(<#list parameters as param><@includeModel object=param/><#if param_has_next>, </#if></#list>) {
|
||||
@Override
|
||||
public <@includeModel object=returnType /> ${name}(<#list parameters as param><@includeModel object=param/><#if param_has_next>, </#if></#list>) {
|
||||
if ( ${sourceParameter.name} == null ) {
|
||||
return<#if returnType.name != "void"> null</#if>;
|
||||
}
|
||||
@ -79,4 +79,4 @@
|
||||
|
||||
return ${resultName};
|
||||
</#if>
|
||||
}
|
||||
}
|
@ -36,11 +36,10 @@ public class ${implementationName} implements ${interfaceName} {
|
||||
|
||||
<@includeModel object=mapper/>
|
||||
</#list>
|
||||
|
||||
<#list mappingMethods as mappingMethod>
|
||||
<@includeModel object=mappingMethod/>
|
||||
<#if mappingMethod_has_next>
|
||||
|
||||
</#if>
|
||||
|
||||
<@includeModel object=mappingMethod/>
|
||||
</#list>
|
||||
|
||||
}
|
||||
|
@ -18,28 +18,28 @@
|
||||
limitations under the License.
|
||||
|
||||
-->
|
||||
<#-- a) invoke mapping method -->
|
||||
<#if mappingMethod??>
|
||||
${ext.targetBeanName}.${targetAccessorName}( <@includeModel object=mappingMethod input="${sourceBeanName}.${sourceAccessorName}()"/> );
|
||||
<#-- b) simple conversion -->
|
||||
<#elseif conversion??>
|
||||
<#-- a) invoke mapping method -->
|
||||
<#if mappingMethod??>
|
||||
${ext.targetBeanName}.${targetAccessorName}( <@includeModel object=mappingMethod input="${sourceBeanName}.${sourceAccessorName}()"/> );
|
||||
<#-- b) simple conversion -->
|
||||
<#elseif conversion??>
|
||||
<#if sourceType.primitive == false>
|
||||
if ( ${sourceBeanName}.${sourceAccessorName}() != null ) {
|
||||
if ( ${sourceBeanName}.${sourceAccessorName}() != null ) {
|
||||
<@applyConversion targetBeanName=ext.targetBeanName targetAccessorName=targetAccessorName conversion=conversion/>
|
||||
}
|
||||
}
|
||||
<#else>
|
||||
<@applyConversion targetBeanName=ext.targetBeanName targetAccessorName=targetAccessorName conversion=conversion/>
|
||||
<@applyConversion targetBeanName=ext.targetBeanName targetAccessorName=targetAccessorName conversion=conversion/>
|
||||
</#if>
|
||||
<#-- c) simply set -->
|
||||
<#else>
|
||||
<#-- c) simply set -->
|
||||
<#else>
|
||||
<#if targetType.collectionType || targetType.mapType>
|
||||
if ( ${sourceBeanName}.${sourceAccessorName}() != null ) {
|
||||
if ( ${sourceBeanName}.${sourceAccessorName}() != null ) {
|
||||
${ext.targetBeanName}.${targetAccessorName}( new <#if targetType.implementationType??><@includeModel object=targetType.implementationType/><#else><@includeModel object=targetType/></#if>( ${sourceBeanName}.${sourceAccessorName}() ) );
|
||||
}
|
||||
}
|
||||
<#else>
|
||||
${ext.targetBeanName}.${targetAccessorName}( ${sourceBeanName}.${sourceAccessorName}() );
|
||||
</#if>
|
||||
${ext.targetBeanName}.${targetAccessorName}( ${sourceBeanName}.${sourceAccessorName}() );
|
||||
</#if>
|
||||
</#if>
|
||||
<#macro applyConversion targetBeanName targetAccessorName conversion>
|
||||
<#if (conversion.exceptionTypes?size == 0) >
|
||||
${targetBeanName}.${targetAccessorName}( <@includeModel object=conversion/> );
|
||||
|
Loading…
x
Reference in New Issue
Block a user