#81 Formatting

This commit is contained in:
Gunnar Morling 2014-02-09 11:21:52 +01:00
parent 4bd1022b89
commit f122daec6d
30 changed files with 94 additions and 116 deletions

View File

@ -22,7 +22,6 @@ import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import javax.lang.model.element.AnnotationMirror; import javax.lang.model.element.AnnotationMirror;
import javax.lang.model.element.AnnotationValue; import javax.lang.model.element.AnnotationValue;
import javax.lang.model.element.Element; import javax.lang.model.element.Element;

View File

@ -22,7 +22,6 @@ import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import javax.lang.model.element.ExecutableElement; import javax.lang.model.element.ExecutableElement;
import javax.lang.model.element.Modifier; import javax.lang.model.element.Modifier;
@ -76,7 +75,7 @@ public class Method {
} }
public static Method forFactoryMethod(Type declaringMapper, ExecutableElement executable, public static Method forFactoryMethod(Type declaringMapper, ExecutableElement executable,
Type returnType ) { Type returnType) {
return new Method( return new Method(
declaringMapper, declaringMapper,
@ -89,8 +88,6 @@ public class Method {
); );
} }
private Method(Type declaringMapper, ExecutableElement executable, List<Parameter> parameters, Type returnType, private Method(Type declaringMapper, ExecutableElement executable, List<Parameter> parameters, Type returnType,
Map<String, List<Mapping>> mappings, IterableMapping iterableMapping, MapMapping mapMapping) { Map<String, List<Mapping>> mappings, IterableMapping iterableMapping, MapMapping mapMapping) {
this.declaringMapper = declaringMapper; this.declaringMapper = declaringMapper;

View File

@ -21,7 +21,6 @@ package org.mapstruct.ap.model.source;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import javax.lang.model.element.TypeElement; import javax.lang.model.element.TypeElement;
import javax.lang.model.element.TypeParameterElement; import javax.lang.model.element.TypeParameterElement;
import javax.lang.model.element.VariableElement; import javax.lang.model.element.VariableElement;

View File

@ -19,7 +19,6 @@
package org.mapstruct.ap.processor; package org.mapstruct.ap.processor;
import java.util.ListIterator; import java.util.ListIterator;
import javax.lang.model.element.TypeElement; import javax.lang.model.element.TypeElement;
import org.mapstruct.ap.model.Annotation; import org.mapstruct.ap.model.Annotation;

View File

@ -27,6 +27,7 @@ import java.util.LinkedList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
import javax.annotation.processing.Messager; import javax.annotation.processing.Messager;
import javax.lang.model.element.Element; import javax.lang.model.element.Element;
import javax.lang.model.element.ExecutableElement; import javax.lang.model.element.ExecutableElement;
@ -180,7 +181,7 @@ public class MapperCreationProcessor implements ModelElementProcessor<List<Metho
method.setIterableMapping( reverseMappingMethod.getIterableMapping() ); method.setIterableMapping( reverseMappingMethod.getIterableMapping() );
} }
IterableMappingMethod iterableMappingMethod IterableMappingMethod iterableMappingMethod
= getIterableMappingMethod( mapperReferences, methods, method ); = getIterableMappingMethod( mapperReferences, methods, method );
hasFactoryMethod = iterableMappingMethod.getFactoryMethod() != null; hasFactoryMethod = iterableMappingMethod.getFactoryMethod() != null;
mappingMethods.add( iterableMappingMethod ); mappingMethods.add( iterableMappingMethod );
} }
@ -222,36 +223,36 @@ public class MapperCreationProcessor implements ModelElementProcessor<List<Metho
} }
private MethodReference getFactoryMethod(List<MapperReference> mapperReferences, List<Method> methods, private MethodReference getFactoryMethod(List<MapperReference> mapperReferences, List<Method> methods,
Type returnType) { Type returnType) {
MethodReference result = null; MethodReference result = null;
for ( Method method : methods ) { for ( Method method : methods ) {
if ( !method.requiresImplementation() && !method.isIterableMapping() && !method.isMapMapping() if ( !method.requiresImplementation() && !method.isIterableMapping() && !method.isMapMapping()
&& method.getMappings().isEmpty() && method.getParameters().isEmpty() ) { && method.getMappings().isEmpty() && method.getParameters().isEmpty() ) {
if ( method.getReturnType().equals( returnType ) ) { if ( method.getReturnType().equals( returnType ) ) {
if ( result == null ) { if ( result == null ) {
MapperReference mapperReference = null; MapperReference mapperReference = null;
for ( MapperReference ref : mapperReferences ) { for ( MapperReference ref : mapperReferences ) {
if ( ref.getMapperType().equals( method.getDeclaringMapper() ) ) { if ( ref.getMapperType().equals( method.getDeclaringMapper() ) ) {
mapperReference = ref; mapperReference = ref;
break; break;
}
} }
result = new MethodReference(method, mapperReference);
} }
else {
messager.printMessage( result = new MethodReference( method, mapperReference );
Kind.ERROR, }
String.format( else {
"Ambigious factory method: \"%s\" conflicts with \"%s\".", messager.printMessage(
result, Kind.ERROR,
method String.format(
), "Ambigious factory methods: \"%s\" conflicts with \"%s\".",
method.getExecutable() result,
); method
} ),
} method.getExecutable()
} );
}
}
}
} }
return result; return result;
} }
@ -333,7 +334,7 @@ public class MapperCreationProcessor implements ModelElementProcessor<List<Metho
} }
private BeanMappingMethod getBeanMappingMethod(List<MapperReference> mapperReferences, List<Method> methods, private BeanMappingMethod getBeanMappingMethod(List<MapperReference> mapperReferences, List<Method> methods,
Method method, ReportingPolicy unmappedTargetPolicy) { Method method, ReportingPolicy unmappedTargetPolicy) {
List<PropertyMapping> propertyMappings = new ArrayList<PropertyMapping>(); List<PropertyMapping> propertyMappings = new ArrayList<PropertyMapping>();
Set<String> mappedTargetProperties = new HashSet<String>(); Set<String> mappedTargetProperties = new HashSet<String>();
@ -591,7 +592,7 @@ public class MapperCreationProcessor implements ModelElementProcessor<List<Metho
} }
private IterableMappingMethod getIterableMappingMethod(List<MapperReference> mapperReferences, List<Method> methods, private IterableMappingMethod getIterableMappingMethod(List<MapperReference> mapperReferences, List<Method> methods,
Method method) { Method method) {
Type sourceElementType = method.getSourceParameters().iterator().next().getType().getTypeParameters().get( 0 ); Type sourceElementType = method.getSourceParameters().iterator().next().getType().getTypeParameters().get( 0 );
Type targetElementType = method.getResultType().getTypeParameters().get( 0 ); Type targetElementType = method.getResultType().getTypeParameters().get( 0 );
@ -631,7 +632,7 @@ public class MapperCreationProcessor implements ModelElementProcessor<List<Metho
} }
private MapMappingMethod getMapMappingMethod(List<MapperReference> mapperReferences, List<Method> methods, private MapMappingMethod getMapMappingMethod(List<MapperReference> mapperReferences, List<Method> methods,
Method method) { Method method) {
List<Type> sourceTypeParams = method.getSourceParameters().iterator().next().getType().getTypeParameters(); List<Type> sourceTypeParams = method.getSourceParameters().iterator().next().getType().getTypeParameters();
Type sourceKeyType = sourceTypeParams.get( 0 ); Type sourceKeyType = sourceTypeParams.get( 0 );
Type sourceValueType = sourceTypeParams.get( 1 ); Type sourceValueType = sourceTypeParams.get( 1 );
@ -689,9 +690,11 @@ public class MapperCreationProcessor implements ModelElementProcessor<List<Metho
); );
} }
MethodReference factoryMethod = getFactoryMethod( mapperReferences, methods, method.getReturnType() ); MethodReference factoryMethod = getFactoryMethod( mapperReferences, methods, method.getReturnType() );
return new MapMappingMethod( method, keyMappingMethod, keyConversion, valueMappingMethod, valueConversion, return new MapMappingMethod(
factoryMethod ); method, keyMappingMethod, keyConversion, valueMappingMethod, valueConversion,
factoryMethod
);
} }
private TypeConversion getConversion(Type sourceType, Type targetType, String dateFormat, String sourceReference) { private TypeConversion getConversion(Type sourceType, Type targetType, String dateFormat, String sourceReference) {
@ -708,8 +711,8 @@ public class MapperCreationProcessor implements ModelElementProcessor<List<Metho
} }
private MethodReference getMappingMethodReference(List<MapperReference> mapperReferences, private MethodReference getMappingMethodReference(List<MapperReference> mapperReferences,
Iterable<Method> methods, Type parameterType, Iterable<Method> methods, Type parameterType,
Type returnType) { Type returnType) {
List<Method> candidatesWithMathingTargetType = new ArrayList<Method>(); List<Method> candidatesWithMathingTargetType = new ArrayList<Method>();
for ( Method method : methods ) { for ( Method method : methods ) {

View File

@ -18,13 +18,10 @@
*/ */
package org.mapstruct.ap.processor; package org.mapstruct.ap.processor;
import static javax.lang.model.util.ElementFilter.methodsIn;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import javax.annotation.processing.Messager; import javax.annotation.processing.Messager;
import javax.lang.model.element.ExecutableElement; import javax.lang.model.element.ExecutableElement;
import javax.lang.model.element.Modifier; import javax.lang.model.element.Modifier;
@ -48,6 +45,8 @@ import org.mapstruct.ap.prism.MappingPrism;
import org.mapstruct.ap.prism.MappingsPrism; import org.mapstruct.ap.prism.MappingsPrism;
import org.mapstruct.ap.util.AnnotationProcessingException; import org.mapstruct.ap.util.AnnotationProcessingException;
import static javax.lang.model.util.ElementFilter.methodsIn;
/** /**
* A {@link ModelElementProcessor} which retrieves a list of {@link Method}s * A {@link ModelElementProcessor} which retrieves a list of {@link Method}s
* representing all the mapping methods of the given bean mapper type as well as * representing all the mapping methods of the given bean mapper type as well as

View File

@ -42,4 +42,4 @@ public <@includeModel object=returnType/> ${name}(<#list parameters as param><@i
return ${resultName}; return ${resultName};
</#if> </#if>
} }

View File

@ -20,14 +20,13 @@ package org.mapstruct.ap.test.erroneous.ambiguousfactorymethod;
/** /**
* @author Sjaak Derksen * @author Sjaak Derksen
*
*/ */
public class Bar { public class Bar {
private String prop; private String prop;
private final String someTypeProp; private final String someTypeProp;
public Bar( String someTypeProp ) { public Bar(String someTypeProp) {
this.someTypeProp = someTypeProp; this.someTypeProp = someTypeProp;
} }

View File

@ -19,7 +19,6 @@
package org.mapstruct.ap.test.erroneous.ambiguousfactorymethod; package org.mapstruct.ap.test.erroneous.ambiguousfactorymethod;
import org.mapstruct.ap.test.erroneous.ambiguousfactorymethod.a.BarFactory; import org.mapstruct.ap.test.erroneous.ambiguousfactorymethod.a.BarFactory;
import org.mapstruct.ap.testutil.IssueKey; import org.mapstruct.ap.testutil.IssueKey;
import org.mapstruct.ap.testutil.MapperTestBase; import org.mapstruct.ap.testutil.MapperTestBase;
import org.mapstruct.ap.testutil.WithClasses; import org.mapstruct.ap.testutil.WithClasses;
@ -30,11 +29,12 @@ import org.testng.annotations.Test;
/** /**
* @author Sjaak Derksen * @author Sjaak Derksen
*
*/ */
@IssueKey( "81" ) @IssueKey("81")
@WithClasses( { Bar.class, Foo.class, BarFactory.class, Source.class, SourceTargetMapperAndBarFactory.class, @WithClasses({
Target.class } ) Bar.class, Foo.class, BarFactory.class, Source.class, SourceTargetMapperAndBarFactory.class,
Target.class
})
public class FactoryTest extends MapperTestBase { public class FactoryTest extends MapperTestBase {
@ -45,12 +45,12 @@ public class FactoryTest extends MapperTestBase {
diagnostics = { diagnostics = {
@Diagnostic(type = BarFactory.class, @Diagnostic(type = BarFactory.class,
kind = javax.tools.Diagnostic.Kind.ERROR, kind = javax.tools.Diagnostic.Kind.ERROR,
line = 30, line = 29,
messageRegExp = "^Ambigious factory method: \"org\\.mapstruct\\.ap\\.test\\.erroneous\\." messageRegExp = "^Ambigious factory methods: \"org\\.mapstruct\\.ap\\.test\\.erroneous\\."
+ "ambiguousfactorymethod\\.Bar createBar\\(\\)\" conflicts with " + "ambiguousfactorymethod\\.Bar createBar\\(\\)\" conflicts with "
+ "\"org\\.mapstruct\\.ap\\.test\\.erroneous\\.ambiguousfactorymethod\\.Bar " + "\"org\\.mapstruct\\.ap\\.test\\.erroneous\\.ambiguousfactorymethod\\.Bar "
+ "org\\.mapstruct\\.ap\\.test\\.erroneous\\.ambiguousfactorymethod" + "org\\.mapstruct\\.ap\\.test\\.erroneous\\.ambiguousfactorymethod"
+ "\\.a\\.BarFactory\\.createBar\\(\\)\"\\.$") + "\\.a\\.BarFactory\\.createBar\\(\\)\"\\.$")
} }
) )
public void shouldUseTwoFactoryMethods() { public void shouldUseTwoFactoryMethods() {

View File

@ -21,7 +21,6 @@ package org.mapstruct.ap.test.erroneous.ambiguousfactorymethod;
/** /**
* @author Sjaak Derksen * @author Sjaak Derksen
*
*/ */
public class Foo { public class Foo {
private String prop; private String prop;

View File

@ -21,7 +21,6 @@ package org.mapstruct.ap.test.erroneous.ambiguousfactorymethod;
/** /**
* @author Sjaak Derksen * @author Sjaak Derksen
*
*/ */
public class Source { public class Source {
@ -31,7 +30,7 @@ public class Source {
return prop; return prop;
} }
public void setProp( Foo prop ) { public void setProp(Foo prop) {
this.prop = prop; this.prop = prop;
} }
} }

View File

@ -24,18 +24,17 @@ import org.mapstruct.factory.Mappers;
/** /**
* @author Sjaak Derksen * @author Sjaak Derksen
*
*/ */
@Mapper( uses = BarFactory.class ) @Mapper(uses = BarFactory.class)
public abstract class SourceTargetMapperAndBarFactory { public abstract class SourceTargetMapperAndBarFactory {
public static final SourceTargetMapperAndBarFactory INSTANCE = public static final SourceTargetMapperAndBarFactory INSTANCE =
Mappers.getMapper( SourceTargetMapperAndBarFactory.class ); Mappers.getMapper( SourceTargetMapperAndBarFactory.class );
public abstract Target sourceToTarget(Source source); public abstract Target sourceToTarget(Source source);
public abstract Bar fooToBar(Foo foo); public abstract Bar fooToBar(Foo foo);
public Bar createBar() { public Bar createBar() {
return new Bar("BAR"); return new Bar( "BAR" );
} }
} }

View File

@ -21,7 +21,6 @@ package org.mapstruct.ap.test.erroneous.ambiguousfactorymethod;
/** /**
* @author Sjaak Derksen * @author Sjaak Derksen
*
*/ */
public class Target { public class Target {

View File

@ -22,13 +22,12 @@ import org.mapstruct.ap.test.erroneous.ambiguousfactorymethod.Bar;
/** /**
*
* @author Sjaak Derksen * @author Sjaak Derksen
*/ */
public class BarFactory { public class BarFactory {
public Bar createBar() { public Bar createBar() {
return new Bar("BAR"); return new Bar( "BAR" );
} }
} }

View File

@ -20,14 +20,13 @@ package org.mapstruct.ap.test.factories;
/** /**
* @author Sjaak Derksen * @author Sjaak Derksen
*
*/ */
public class Bar1 { public class Bar1 {
private String prop; private String prop;
private final String someTypeProp; private final String someTypeProp;
public Bar1( String someTypeProp ) { public Bar1(String someTypeProp) {
this.someTypeProp = someTypeProp; this.someTypeProp = someTypeProp;
} }

View File

@ -20,13 +20,12 @@ package org.mapstruct.ap.test.factories;
/** /**
* @author Sjaak Derksen * @author Sjaak Derksen
*
*/ */
public class Bar2 { public class Bar2 {
private String prop; private String prop;
private final String someTypeProp; private final String someTypeProp;
public Bar2( String someTypeProp ) { public Bar2(String someTypeProp) {
this.someTypeProp = someTypeProp; this.someTypeProp = someTypeProp;
} }

View File

@ -20,14 +20,13 @@ package org.mapstruct.ap.test.factories;
/** /**
* @author Sjaak Derksen * @author Sjaak Derksen
*
*/ */
public class Bar3 { public class Bar3 {
private String prop; private String prop;
private final String someTypeProp; private final String someTypeProp;
public Bar3( String someTypeProp ) { public Bar3(String someTypeProp) {
this.someTypeProp = someTypeProp; this.someTypeProp = someTypeProp;
} }

View File

@ -21,7 +21,6 @@ package org.mapstruct.ap.test.factories;
import java.util.List; import java.util.List;
/** /**
*
* @author Sjaak Derksen * @author Sjaak Derksen
*/ */
public interface CustomList<T> extends List<T> { public interface CustomList<T> extends List<T> {

View File

@ -21,14 +21,13 @@ package org.mapstruct.ap.test.factories;
import java.util.LinkedList; import java.util.LinkedList;
/** /**
*
* @author Sjaak Derksen * @author Sjaak Derksen
*/ */
public class CustomListImpl<T> extends LinkedList<T> implements CustomList<T> { public class CustomListImpl<T> extends LinkedList<T> implements CustomList<T> {
private final String typeProp; private final String typeProp;
public CustomListImpl( String typeProp ) { public CustomListImpl(String typeProp) {
this.typeProp = typeProp; this.typeProp = typeProp;
} }

View File

@ -21,7 +21,6 @@ package org.mapstruct.ap.test.factories;
import java.util.Map; import java.util.Map;
/** /**
*
* @author Sjaak Derksen * @author Sjaak Derksen
*/ */
public interface CustomMap<K, V> extends Map<K, V> { public interface CustomMap<K, V> extends Map<K, V> {

View File

@ -21,14 +21,13 @@ package org.mapstruct.ap.test.factories;
import java.util.HashMap; import java.util.HashMap;
/** /**
*
* @author Sjaak Derksen * @author Sjaak Derksen
*/ */
public class CustomMapImpl<K, V> extends HashMap<K, V> implements CustomMap<K, V> { public class CustomMapImpl<K, V> extends HashMap<K, V> implements CustomMap<K, V> {
private final String typeProp; private final String typeProp;
public CustomMapImpl( String typeProp ) { public CustomMapImpl(String typeProp) {
this.typeProp = typeProp; this.typeProp = typeProp;
} }

View File

@ -22,22 +22,24 @@ import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import org.mapstruct.ap.test.factories.a.BarFactory;
import static org.fest.assertions.Assertions.assertThat;
import org.mapstruct.ap.test.factories.a.BarFactory;
import org.mapstruct.ap.testutil.IssueKey; import org.mapstruct.ap.testutil.IssueKey;
import org.mapstruct.ap.testutil.MapperTestBase; import org.mapstruct.ap.testutil.MapperTestBase;
import org.mapstruct.ap.testutil.WithClasses; import org.mapstruct.ap.testutil.WithClasses;
import org.testng.annotations.Test; import org.testng.annotations.Test;
import static org.fest.assertions.Assertions.assertThat;
/** /**
* @author Sjaak Derksen * @author Sjaak Derksen
*
*/ */
@IssueKey( "81" ) @IssueKey("81")
@WithClasses( { Bar1.class, Foo1.class, Bar2.class, Foo2.class, Bar3.class, Foo3.class, BarFactory.class, @WithClasses({
Bar1.class, Foo1.class, Bar2.class, Foo2.class, Bar3.class, Foo3.class, BarFactory.class,
org.mapstruct.ap.test.factories.b.BarFactory.class, Source.class, SourceTargetMapperAndBar2Factory.class, org.mapstruct.ap.test.factories.b.BarFactory.class, Source.class, SourceTargetMapperAndBar2Factory.class,
Target.class, CustomList.class, CustomListImpl.class, CustomMap.class, CustomMapImpl.class } ) Target.class, CustomList.class, CustomListImpl.class, CustomMap.class, CustomMapImpl.class
})
public class FactoryTest extends MapperTestBase { public class FactoryTest extends MapperTestBase {
@Test @Test
public void shouldUseTwoFactoryMethods() { public void shouldUseTwoFactoryMethods() {
@ -46,19 +48,19 @@ public class FactoryTest extends MapperTestBase {
assertThat( target ).isNotNull(); assertThat( target ).isNotNull();
assertThat( target.getProp1() ).isNotNull(); assertThat( target.getProp1() ).isNotNull();
assertThat( target.getProp1().getProp() ).isEqualTo( "foo1" ); assertThat( target.getProp1().getProp() ).isEqualTo( "foo1" );
assertThat( target.getProp1().getSomeTypeProp()).isEqualTo( "BAR1" ); assertThat( target.getProp1().getSomeTypeProp() ).isEqualTo( "BAR1" );
assertThat( target.getProp2() ).isNotNull(); assertThat( target.getProp2() ).isNotNull();
assertThat( target.getProp2().getProp() ).isEqualTo( "foo2" ); assertThat( target.getProp2().getProp() ).isEqualTo( "foo2" );
assertThat( target.getProp2().getSomeTypeProp()).isEqualTo( "BAR2" ); assertThat( target.getProp2().getSomeTypeProp() ).isEqualTo( "BAR2" );
assertThat( target.getProp3() ).isNotNull(); assertThat( target.getProp3() ).isNotNull();
assertThat( target.getProp3().getProp() ).isEqualTo( "foo3" ); assertThat( target.getProp3().getProp() ).isEqualTo( "foo3" );
assertThat( target.getProp3().getSomeTypeProp()).isEqualTo( "BAR3" ); assertThat( target.getProp3().getSomeTypeProp() ).isEqualTo( "BAR3" );
assertThat( target.getPropList() ).isNotNull(); assertThat( target.getPropList() ).isNotNull();
assertThat( target.getPropList().get( 0 ) ).isEqualTo( "fooListEntry" ); assertThat( target.getPropList().get( 0 ) ).isEqualTo( "fooListEntry" );
assertThat( target.getPropList().getTypeProp()).isEqualTo( "CUSTOMLIST" ); assertThat( target.getPropList().getTypeProp() ).isEqualTo( "CUSTOMLIST" );
assertThat( target.getPropMap() ).isNotNull(); assertThat( target.getPropMap() ).isNotNull();
assertThat( target.getPropMap().get( "key" ) ).isEqualTo( "fooValue" ); assertThat( target.getPropMap().get( "key" ) ).isEqualTo( "fooValue" );
assertThat( target.getPropMap().getTypeProp()).isEqualTo( "CUSTOMMAP" ); assertThat( target.getPropMap().getTypeProp() ).isEqualTo( "CUSTOMMAP" );
} }
private Source createSource() { private Source createSource() {
@ -81,7 +83,7 @@ public class FactoryTest extends MapperTestBase {
source.setPropList( fooList ); source.setPropList( fooList );
Map<String, String> fooMap = new HashMap<String, String>(); Map<String, String> fooMap = new HashMap<String, String>();
fooMap.put( "key", "fooValue"); fooMap.put( "key", "fooValue" );
source.setPropMap( fooMap ); source.setPropMap( fooMap );
return source; return source;
} }

View File

@ -20,7 +20,6 @@ package org.mapstruct.ap.test.factories;
/** /**
* @author Sjaak Derksen * @author Sjaak Derksen
*
*/ */
public class Foo1 { public class Foo1 {
private String prop; private String prop;

View File

@ -20,7 +20,6 @@ package org.mapstruct.ap.test.factories;
/** /**
* @author Sjaak Derksen * @author Sjaak Derksen
*
*/ */
public class Foo2 { public class Foo2 {
private String prop; private String prop;

View File

@ -20,7 +20,6 @@ package org.mapstruct.ap.test.factories;
/** /**
* @author Sjaak Derksen * @author Sjaak Derksen
*
*/ */
public class Foo3 { public class Foo3 {
private String prop; private String prop;

View File

@ -23,7 +23,6 @@ import java.util.Map;
/** /**
* @author Sjaak Derksen * @author Sjaak Derksen
*
*/ */
public class Source { public class Source {
@ -37,7 +36,7 @@ public class Source {
return prop1; return prop1;
} }
public void setProp1( Foo1 prop1 ) { public void setProp1(Foo1 prop1) {
this.prop1 = prop1; this.prop1 = prop1;
} }
@ -45,7 +44,7 @@ public class Source {
return prop2; return prop2;
} }
public void setProp2( Foo2 prop2 ) { public void setProp2(Foo2 prop2) {
this.prop2 = prop2; this.prop2 = prop2;
} }
@ -53,7 +52,7 @@ public class Source {
return prop3; return prop3;
} }
public void setProp3( Foo3 prop3 ) { public void setProp3(Foo3 prop3) {
this.prop3 = prop3; this.prop3 = prop3;
} }
@ -61,7 +60,7 @@ public class Source {
return propList; return propList;
} }
public void setPropList( List<String> propList ) { public void setPropList(List<String> propList) {
this.propList = propList; this.propList = propList;
} }
@ -69,7 +68,7 @@ public class Source {
return propMap; return propMap;
} }
public void setPropMap( Map<String, String> propMap ) { public void setPropMap(Map<String, String> propMap) {
this.propMap = propMap; this.propMap = propMap;
} }

View File

@ -20,18 +20,18 @@ package org.mapstruct.ap.test.factories;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import org.mapstruct.ap.test.factories.a.BarFactory;
import org.mapstruct.Mapper; import org.mapstruct.Mapper;
import org.mapstruct.ap.test.factories.a.BarFactory;
import org.mapstruct.factory.Mappers; import org.mapstruct.factory.Mappers;
/** /**
* @author Sjaak Derksen * @author Sjaak Derksen
*
*/ */
@Mapper( uses = { BarFactory.class, org.mapstruct.ap.test.factories.b.BarFactory.class } ) @Mapper(uses = { BarFactory.class, org.mapstruct.ap.test.factories.b.BarFactory.class })
public abstract class SourceTargetMapperAndBar2Factory { public abstract class SourceTargetMapperAndBar2Factory {
public static final SourceTargetMapperAndBar2Factory INSTANCE = public static final SourceTargetMapperAndBar2Factory INSTANCE =
Mappers.getMapper( SourceTargetMapperAndBar2Factory.class ); Mappers.getMapper( SourceTargetMapperAndBar2Factory.class );
public abstract Target sourceToTarget(Source source); public abstract Target sourceToTarget(Source source);
@ -46,14 +46,14 @@ public abstract class SourceTargetMapperAndBar2Factory {
public abstract CustomMap<String, String> customMapToMap(Map<String, String> list); public abstract CustomMap<String, String> customMapToMap(Map<String, String> list);
public Bar2 createBar2() { public Bar2 createBar2() {
return new Bar2("BAR2"); return new Bar2( "BAR2" );
} }
public CustomList<String> createCustomList() { public CustomList<String> createCustomList() {
return new CustomListImpl<String>("CUSTOMLIST"); return new CustomListImpl<String>( "CUSTOMLIST" );
} }
public CustomMap<String, String> createCustomMap() { public CustomMap<String, String> createCustomMap() {
return new CustomMapImpl<String, String>("CUSTOMMAP"); return new CustomMapImpl<String, String>( "CUSTOMMAP" );
} }
} }

View File

@ -20,7 +20,6 @@ package org.mapstruct.ap.test.factories;
/** /**
* @author Sjaak Derksen * @author Sjaak Derksen
*
*/ */
public class Target { public class Target {
@ -42,7 +41,7 @@ public class Target {
return prop2; return prop2;
} }
public void setProp2( Bar2 prop2 ) { public void setProp2(Bar2 prop2) {
this.prop2 = prop2; this.prop2 = prop2;
} }
@ -50,7 +49,7 @@ public class Target {
return prop3; return prop3;
} }
public void setProp3( Bar3 prop3 ) { public void setProp3(Bar3 prop3) {
this.prop3 = prop3; this.prop3 = prop3;
} }
@ -58,7 +57,7 @@ public class Target {
return propList; return propList;
} }
public void setPropList( CustomList<String> propList ) { public void setPropList(CustomList<String> propList) {
this.propList = propList; this.propList = propList;
} }
@ -66,7 +65,7 @@ public class Target {
return propMap; return propMap;
} }
public void setPropMap( CustomMap<String, String> propMap ) { public void setPropMap(CustomMap<String, String> propMap) {
this.propMap = propMap; this.propMap = propMap;
} }

View File

@ -21,13 +21,12 @@ package org.mapstruct.ap.test.factories.a;
import org.mapstruct.ap.test.factories.Bar1; import org.mapstruct.ap.test.factories.Bar1;
/** /**
*
* @author Sjaak Derksen * @author Sjaak Derksen
*/ */
public class BarFactory { public class BarFactory {
public Bar1 createBar1() { public Bar1 createBar1() {
return new Bar1("BAR1"); return new Bar1( "BAR1" );
} }
} }

View File

@ -21,13 +21,12 @@ package org.mapstruct.ap.test.factories.b;
import org.mapstruct.ap.test.factories.Bar3; import org.mapstruct.ap.test.factories.Bar3;
/** /**
*
* @author Sjaak Derksen * @author Sjaak Derksen
*/ */
public class BarFactory { public class BarFactory {
public Bar3 createBar3() { public Bar3 createBar3() {
return new Bar3("BAR3"); return new Bar3( "BAR3" );
} }
} }