This commit is contained in:
Gunnar Morling 2014-11-24 22:33:17 +01:00
parent 4ca2b6ecf1
commit 2fde97c039
13 changed files with 164 additions and 171 deletions

View File

@ -27,7 +27,6 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Map.Entry; import java.util.Map.Entry;
import java.util.Set; import java.util.Set;
import javax.lang.model.element.ExecutableElement; import javax.lang.model.element.ExecutableElement;
import javax.tools.Diagnostic; import javax.tools.Diagnostic;
@ -40,8 +39,8 @@ import org.mapstruct.ap.model.source.Mapping;
import org.mapstruct.ap.model.source.SourceMethod; import org.mapstruct.ap.model.source.SourceMethod;
import org.mapstruct.ap.model.source.SourceReference; import org.mapstruct.ap.model.source.SourceReference;
import org.mapstruct.ap.option.ReportingPolicy; import org.mapstruct.ap.option.ReportingPolicy;
import org.mapstruct.ap.prism.NullValueMappingPrism;
import org.mapstruct.ap.prism.CollectionMappingStrategyPrism; import org.mapstruct.ap.prism.CollectionMappingStrategyPrism;
import org.mapstruct.ap.prism.NullValueMappingPrism;
import org.mapstruct.ap.util.Executables; import org.mapstruct.ap.util.Executables;
import org.mapstruct.ap.util.MapperConfig; import org.mapstruct.ap.util.MapperConfig;
import org.mapstruct.ap.util.Strings; import org.mapstruct.ap.util.Strings;
@ -183,7 +182,8 @@ public class BeanMappingMethod extends MappingMethod {
if ( targetProperty == null ) { if ( targetProperty == null ) {
ctx.getMessager().printMessage( ctx.getMessager().printMessage(
Diagnostic.Kind.ERROR, Diagnostic.Kind.ERROR,
String.format( "Unknown property \"%s\" in return type.", String.format(
"Unknown property \"%s\" in return type.",
mapping.getTargetName() mapping.getTargetName()
), ),
method.getExecutable(), method.getExecutable(),
@ -456,7 +456,6 @@ public class BeanMappingMethod extends MappingMethod {
} }
private void reportErrorForUnmappedTargetPropertiesIfRequired() { private void reportErrorForUnmappedTargetPropertiesIfRequired() {
// fetch settings from element to implement // fetch settings from element to implement

View File

@ -21,7 +21,6 @@ package org.mapstruct.ap.model;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
import javax.lang.model.type.TypeMirror; import javax.lang.model.type.TypeMirror;
import javax.tools.Diagnostic; import javax.tools.Diagnostic;

View File

@ -21,7 +21,6 @@ package org.mapstruct.ap.model;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
import javax.lang.model.type.TypeMirror; import javax.lang.model.type.TypeMirror;
import javax.tools.Diagnostic; import javax.tools.Diagnostic;

View File

@ -22,17 +22,16 @@ import javax.xml.bind.annotation.XmlElementDecl;
import net.java.dev.hickory.prism.GeneratePrism; import net.java.dev.hickory.prism.GeneratePrism;
import net.java.dev.hickory.prism.GeneratePrisms; import net.java.dev.hickory.prism.GeneratePrisms;
import org.mapstruct.DecoratedWith; import org.mapstruct.DecoratedWith;
import org.mapstruct.InheritInverseConfiguration; import org.mapstruct.InheritInverseConfiguration;
import org.mapstruct.IterableMapping; import org.mapstruct.IterableMapping;
import org.mapstruct.MapMapping; import org.mapstruct.MapMapping;
import org.mapstruct.NullValueMapping;
import org.mapstruct.Mapper; import org.mapstruct.Mapper;
import org.mapstruct.MapperConfig; import org.mapstruct.MapperConfig;
import org.mapstruct.Mapping; import org.mapstruct.Mapping;
import org.mapstruct.MappingTarget; import org.mapstruct.MappingTarget;
import org.mapstruct.Mappings; import org.mapstruct.Mappings;
import org.mapstruct.NullValueMapping;
import org.mapstruct.Qualifier; import org.mapstruct.Qualifier;
import org.mapstruct.TargetType; import org.mapstruct.TargetType;

View File

@ -22,20 +22,18 @@ import java.util.ArrayList;
import java.util.HashSet; import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
import javax.lang.model.element.AnnotationMirror; import javax.lang.model.element.AnnotationMirror;
import javax.lang.model.element.Element; import javax.lang.model.element.Element;
import javax.lang.model.type.DeclaredType; import javax.lang.model.type.DeclaredType;
import javax.lang.model.type.TypeKind; import javax.lang.model.type.TypeKind;
import javax.lang.model.type.TypeMirror; import javax.lang.model.type.TypeMirror;
import org.mapstruct.ap.prism.NullValueMappingStrategyPrism;
import org.mapstruct.ap.prism.NullValueMappingPrism;
import org.mapstruct.ap.option.ReportingPolicy; import org.mapstruct.ap.option.ReportingPolicy;
import org.mapstruct.ap.prism.CollectionMappingStrategyPrism; import org.mapstruct.ap.prism.CollectionMappingStrategyPrism;
import org.mapstruct.ap.prism.MapperConfigPrism; import org.mapstruct.ap.prism.MapperConfigPrism;
import org.mapstruct.ap.prism.MapperPrism; import org.mapstruct.ap.prism.MapperPrism;
import org.mapstruct.ap.prism.NullValueMappingPrism;
import org.mapstruct.ap.prism.NullValueMappingStrategyPrism;
import static org.mapstruct.ap.prism.CollectionMappingStrategyPrism.valueOf; import static org.mapstruct.ap.prism.CollectionMappingStrategyPrism.valueOf;

View File

@ -18,8 +18,6 @@
*/ */
package org.mapstruct.ap.test.mapnulltodefault; package org.mapstruct.ap.test.mapnulltodefault;
import static org.mapstruct.NullValueMappingStrategy.RETURN_DEFAULT;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.UUID; import java.util.UUID;
@ -32,6 +30,8 @@ import org.mapstruct.ap.test.mapnulltodefault.source.Car;
import org.mapstruct.ap.test.mapnulltodefault.target.CarDto; import org.mapstruct.ap.test.mapnulltodefault.target.CarDto;
import org.mapstruct.factory.Mappers; import org.mapstruct.factory.Mappers;
import static org.mapstruct.NullValueMappingStrategy.RETURN_DEFAULT;
@Mapper(imports = UUID.class) @Mapper(imports = UUID.class)
public interface CarMapper { public interface CarMapper {

View File

@ -23,10 +23,10 @@ import java.util.Map;
import java.util.UUID; import java.util.UUID;
import org.mapstruct.Mapper; import org.mapstruct.Mapper;
import org.mapstruct.NullValueMapping;
import org.mapstruct.NullValueMappingStrategy;
import org.mapstruct.Mapping; import org.mapstruct.Mapping;
import org.mapstruct.Mappings; import org.mapstruct.Mappings;
import org.mapstruct.NullValueMapping;
import org.mapstruct.NullValueMappingStrategy;
import org.mapstruct.ap.test.mapnulltodefault.source.Car; import org.mapstruct.ap.test.mapnulltodefault.source.Car;
import org.mapstruct.ap.test.mapnulltodefault.target.CarDto; import org.mapstruct.ap.test.mapnulltodefault.target.CarDto;
import org.mapstruct.factory.Mappers; import org.mapstruct.factory.Mappers;

View File

@ -23,10 +23,10 @@ import java.util.Map;
import java.util.UUID; import java.util.UUID;
import org.mapstruct.Mapper; import org.mapstruct.Mapper;
import org.mapstruct.NullValueMapping;
import org.mapstruct.NullValueMappingStrategy;
import org.mapstruct.Mapping; import org.mapstruct.Mapping;
import org.mapstruct.Mappings; import org.mapstruct.Mappings;
import org.mapstruct.NullValueMapping;
import org.mapstruct.NullValueMappingStrategy;
import org.mapstruct.ap.test.mapnulltodefault.source.Car; import org.mapstruct.ap.test.mapnulltodefault.source.Car;
import org.mapstruct.ap.test.mapnulltodefault.target.CarDto; import org.mapstruct.ap.test.mapnulltodefault.target.CarDto;
import org.mapstruct.factory.Mappers; import org.mapstruct.factory.Mappers;

View File

@ -22,8 +22,6 @@ import java.util.Arrays;
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 static org.fest.assertions.Assertions.assertThat;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
@ -32,6 +30,8 @@ import org.mapstruct.ap.test.mapnulltodefault.target.CarDto;
import org.mapstruct.ap.testutil.WithClasses; import org.mapstruct.ap.testutil.WithClasses;
import org.mapstruct.ap.testutil.runner.AnnotationProcessorTestRunner; import org.mapstruct.ap.testutil.runner.AnnotationProcessorTestRunner;
import static org.fest.assertions.Assertions.assertThat;
@WithClasses({ @WithClasses({
Car.class, Car.class,
CarDto.class, CarDto.class,

View File

@ -18,11 +18,10 @@
*/ */
package org.mapstruct.ap.test.mapnulltodefault; package org.mapstruct.ap.test.mapnulltodefault;
import org.mapstruct.NullValueMappingStrategy;
import org.mapstruct.MapperConfig; import org.mapstruct.MapperConfig;
import org.mapstruct.NullValueMappingStrategy;
/** /**
*
* @author Sjaak Derksen * @author Sjaak Derksen
*/ */
@MapperConfig(nullValueMappingStrategy = NullValueMappingStrategy.RETURN_DEFAULT) @MapperConfig(nullValueMappingStrategy = NullValueMappingStrategy.RETURN_DEFAULT)