mirror of
https://github.com/mapstruct/mapstruct.git
synced 2025-07-12 00:00:08 +08:00
parent
b6a3aa1512
commit
0a69492983
@ -15,7 +15,7 @@
|
|||||||
<#if static><@includeModel object=providingParameter.type/><#else>${providingParameter.name}</#if>.<@methodCall/>
|
<#if static><@includeModel object=providingParameter.type/><#else>${providingParameter.name}</#if>.<@methodCall/>
|
||||||
<#-- method is referenced java8 static method in the mapper to implement (interface) -->
|
<#-- method is referenced java8 static method in the mapper to implement (interface) -->
|
||||||
<#elseif static>
|
<#elseif static>
|
||||||
<@includeModel object=definingType/>.<@methodCall/>
|
<@includeModel object=definingType raw=true/>.<@methodCall/>
|
||||||
<#elseif constructor>
|
<#elseif constructor>
|
||||||
new <@includeModel object=definingType/><#if (parameterBindings?size > 0)>( <@arguments/> )<#else>()</#if>
|
new <@includeModel object=definingType/><#if (parameterBindings?size > 0)>( <@arguments/> )<#else>()</#if>
|
||||||
<#elseif methodChaining>
|
<#elseif methodChaining>
|
||||||
|
@ -0,0 +1,48 @@
|
|||||||
|
/*
|
||||||
|
* Copyright MapStruct Authors.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*/
|
||||||
|
package org.mapstruct.ap.test.selection.generics;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.mapstruct.Mapper;
|
||||||
|
import org.mapstruct.Mapping;
|
||||||
|
import org.mapstruct.Named;
|
||||||
|
import org.mapstruct.factory.Mappers;
|
||||||
|
|
||||||
|
public interface GenericMapperBase<T> {
|
||||||
|
|
||||||
|
T toDto(Map<String, Property> prop);
|
||||||
|
|
||||||
|
@Named( "StringArrayToString" )
|
||||||
|
static String stringArrayToString(Property property) {
|
||||||
|
return "converted";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class Property {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
class ProjectDto {
|
||||||
|
private String productionSite;
|
||||||
|
|
||||||
|
public void setProductionSite(String productionSite) {
|
||||||
|
this.productionSite = productionSite;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getProductionSite() {
|
||||||
|
return productionSite;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
interface ProjectMapper extends GenericMapperBase<ProjectDto> {
|
||||||
|
ProjectMapper INSTANCE = Mappers.getMapper( ProjectMapper.class );
|
||||||
|
|
||||||
|
@Mapping( target = "productionSite", source = "productionSite", qualifiedByName = "StringArrayToString" )
|
||||||
|
@Override
|
||||||
|
ProjectDto toDto(Map<String, Property> projectProp);
|
||||||
|
}
|
@ -0,0 +1,25 @@
|
|||||||
|
/*
|
||||||
|
* Copyright MapStruct Authors.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*/
|
||||||
|
package org.mapstruct.ap.test.selection.generics;
|
||||||
|
|
||||||
|
import org.mapstruct.ap.testutil.IssueKey;
|
||||||
|
import org.mapstruct.ap.testutil.ProcessorTest;
|
||||||
|
import org.mapstruct.ap.testutil.WithClasses;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Ben Zegveld
|
||||||
|
*/
|
||||||
|
@WithClasses( {
|
||||||
|
GenericMapperBase.class
|
||||||
|
} )
|
||||||
|
@IssueKey( "2755" )
|
||||||
|
class GenericMapperBaseTest {
|
||||||
|
|
||||||
|
@ProcessorTest
|
||||||
|
void generatesCompilableCode() {
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user