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.
|
limitations under the License.
|
||||||
|
|
||||||
-->
|
-->
|
||||||
@Override
|
@Override
|
||||||
public ${returnType.name} ${name}(<#list parameters as param><@includeModel object=param/><#if param_has_next>, </#if></#list>) {
|
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> ) {
|
if ( <#list sourceParameters as sourceParam>${sourceParam.name} == null<#if sourceParam_has_next> && </#if></#list> ) {
|
||||||
return<#if returnType.name != "void"> null</#if>;
|
return<#if returnType.name != "void"> null</#if>;
|
||||||
}
|
}
|
||||||
@ -45,4 +45,4 @@
|
|||||||
|
|
||||||
return ${resultName};
|
return ${resultName};
|
||||||
</#if>
|
</#if>
|
||||||
}
|
}
|
@ -18,4 +18,4 @@
|
|||||||
limitations under the License.
|
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.
|
limitations under the License.
|
||||||
|
|
||||||
-->
|
-->
|
||||||
@Override
|
@Override
|
||||||
public <@includeModel object=returnType/> ${name}(<#list parameters as param><@includeModel object=param/><#if param_has_next>, </#if></#list>) {
|
public <@includeModel object=returnType/> ${name}(<#list parameters as param><@includeModel object=param/><#if param_has_next>, </#if></#list>) {
|
||||||
if ( ${sourceParameter.name} == null ) {
|
if ( ${sourceParameter.name} == null ) {
|
||||||
return<#if returnType.name != "void"> null</#if>;
|
return<#if returnType.name != "void"> null</#if>;
|
||||||
}
|
}
|
||||||
@ -53,4 +53,4 @@
|
|||||||
|
|
||||||
return ${resultName};
|
return ${resultName};
|
||||||
</#if>
|
</#if>
|
||||||
}
|
}
|
@ -18,8 +18,8 @@
|
|||||||
limitations under the License.
|
limitations under the License.
|
||||||
|
|
||||||
-->
|
-->
|
||||||
@Override
|
@Override
|
||||||
public <@includeModel object=returnType /> ${name}(<#list parameters as param><@includeModel object=param/><#if param_has_next>, </#if></#list>) {
|
public <@includeModel object=returnType /> ${name}(<#list parameters as param><@includeModel object=param/><#if param_has_next>, </#if></#list>) {
|
||||||
if ( ${sourceParameter.name} == null ) {
|
if ( ${sourceParameter.name} == null ) {
|
||||||
return<#if returnType.name != "void"> null</#if>;
|
return<#if returnType.name != "void"> null</#if>;
|
||||||
}
|
}
|
||||||
@ -79,4 +79,4 @@
|
|||||||
|
|
||||||
return ${resultName};
|
return ${resultName};
|
||||||
</#if>
|
</#if>
|
||||||
}
|
}
|
@ -36,11 +36,10 @@ public class ${implementationName} implements ${interfaceName} {
|
|||||||
|
|
||||||
<@includeModel object=mapper/>
|
<@includeModel object=mapper/>
|
||||||
</#list>
|
</#list>
|
||||||
|
|
||||||
<#list mappingMethods as mappingMethod>
|
<#list mappingMethods as mappingMethod>
|
||||||
<@includeModel object=mappingMethod/>
|
|
||||||
<#if mappingMethod_has_next>
|
|
||||||
|
|
||||||
</#if>
|
|
||||||
|
<@includeModel object=mappingMethod/>
|
||||||
</#list>
|
</#list>
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -18,28 +18,28 @@
|
|||||||
limitations under the License.
|
limitations under the License.
|
||||||
|
|
||||||
-->
|
-->
|
||||||
<#-- a) invoke mapping method -->
|
<#-- a) invoke mapping method -->
|
||||||
<#if mappingMethod??>
|
<#if mappingMethod??>
|
||||||
${ext.targetBeanName}.${targetAccessorName}( <@includeModel object=mappingMethod input="${sourceBeanName}.${sourceAccessorName}()"/> );
|
${ext.targetBeanName}.${targetAccessorName}( <@includeModel object=mappingMethod input="${sourceBeanName}.${sourceAccessorName}()"/> );
|
||||||
<#-- b) simple conversion -->
|
<#-- b) simple conversion -->
|
||||||
<#elseif conversion??>
|
<#elseif conversion??>
|
||||||
<#if sourceType.primitive == false>
|
<#if sourceType.primitive == false>
|
||||||
if ( ${sourceBeanName}.${sourceAccessorName}() != null ) {
|
if ( ${sourceBeanName}.${sourceAccessorName}() != null ) {
|
||||||
<@applyConversion targetBeanName=ext.targetBeanName targetAccessorName=targetAccessorName conversion=conversion/>
|
<@applyConversion targetBeanName=ext.targetBeanName targetAccessorName=targetAccessorName conversion=conversion/>
|
||||||
}
|
}
|
||||||
<#else>
|
<#else>
|
||||||
<@applyConversion targetBeanName=ext.targetBeanName targetAccessorName=targetAccessorName conversion=conversion/>
|
<@applyConversion targetBeanName=ext.targetBeanName targetAccessorName=targetAccessorName conversion=conversion/>
|
||||||
</#if>
|
</#if>
|
||||||
<#-- c) simply set -->
|
<#-- c) simply set -->
|
||||||
<#else>
|
<#else>
|
||||||
<#if targetType.collectionType || targetType.mapType>
|
<#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}() ) );
|
${ext.targetBeanName}.${targetAccessorName}( new <#if targetType.implementationType??><@includeModel object=targetType.implementationType/><#else><@includeModel object=targetType/></#if>( ${sourceBeanName}.${sourceAccessorName}() ) );
|
||||||
}
|
}
|
||||||
<#else>
|
<#else>
|
||||||
${ext.targetBeanName}.${targetAccessorName}( ${sourceBeanName}.${sourceAccessorName}() );
|
${ext.targetBeanName}.${targetAccessorName}( ${sourceBeanName}.${sourceAccessorName}() );
|
||||||
</#if>
|
|
||||||
</#if>
|
</#if>
|
||||||
|
</#if>
|
||||||
<#macro applyConversion targetBeanName targetAccessorName conversion>
|
<#macro applyConversion targetBeanName targetAccessorName conversion>
|
||||||
<#if (conversion.exceptionTypes?size == 0) >
|
<#if (conversion.exceptionTypes?size == 0) >
|
||||||
${targetBeanName}.${targetAccessorName}( <@includeModel object=conversion/> );
|
${targetBeanName}.${targetAccessorName}( <@includeModel object=conversion/> );
|
||||||
|
Loading…
x
Reference in New Issue
Block a user