mirror of
https://github.com/mapstruct/mapstruct.git
synced 2025-07-12 00:00:08 +08:00
parent
da37d40152
commit
29b82e772c
@ -0,0 +1,45 @@
|
|||||||
|
/*
|
||||||
|
* 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.bugs._2111;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.mapstruct.Mapper;
|
||||||
|
import org.mapstruct.Mapping;
|
||||||
|
import org.mapstruct.Named;
|
||||||
|
|
||||||
|
import static java.util.Collections.singletonList;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface Issue2111Mapper {
|
||||||
|
|
||||||
|
@Mapping(target = "strs", source = "ex", qualifiedByName = "wrap")
|
||||||
|
DTO map(UseExample from);
|
||||||
|
|
||||||
|
@Named("wrap")
|
||||||
|
default String mapExample(Example ex) {
|
||||||
|
return ex.name;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Named("wrap")
|
||||||
|
default <T> List<T> wrapInList(T t) {
|
||||||
|
return singletonList( t );
|
||||||
|
}
|
||||||
|
|
||||||
|
//CHECKSTYLE:OFF
|
||||||
|
class Example {
|
||||||
|
public String name;
|
||||||
|
}
|
||||||
|
|
||||||
|
class UseExample {
|
||||||
|
public Example ex;
|
||||||
|
}
|
||||||
|
|
||||||
|
class DTO {
|
||||||
|
public List<String> strs;
|
||||||
|
}
|
||||||
|
//CHECKSTYLE:ON
|
||||||
|
}
|
@ -0,0 +1,26 @@
|
|||||||
|
/*
|
||||||
|
* 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.bugs._2111;
|
||||||
|
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
import org.mapstruct.ap.testutil.IssueKey;
|
||||||
|
import org.mapstruct.ap.testutil.WithClasses;
|
||||||
|
import org.mapstruct.ap.testutil.runner.AnnotationProcessorTestRunner;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Sjaak Derksen
|
||||||
|
*/
|
||||||
|
@IssueKey("2111")
|
||||||
|
@RunWith( AnnotationProcessorTestRunner.class )
|
||||||
|
@WithClasses( Issue2111Mapper.class )
|
||||||
|
public class Issue2111Test {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void shouldCompile() {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user