mirror of
https://github.com/mapstruct/mapstruct.git
synced 2025-07-12 00:00:08 +08:00
#1104 use unmapped target policy for forged name based mappings
This commit is contained in:
parent
e154452d53
commit
9881a8803c
@ -674,52 +674,71 @@ public class BeanMappingMethod extends NormalTypeMappingMethod {
|
||||
// fetch settings from element to implement
|
||||
ReportingPolicyPrism unmappedTargetPolicy = getUnmappedTargetPolicy();
|
||||
|
||||
//we handle automapping forged methods differently than the usual source ones. in
|
||||
if ( method instanceof ForgedMethod && ( (ForgedMethod) method ).isForgedNamedBased() ) {
|
||||
|
||||
ForgedMethod forgedMethod = (ForgedMethod) this.method;
|
||||
if ( targetProperties.isEmpty() || !unprocessedTargetProperties.isEmpty() ) {
|
||||
|
||||
if ( forgedMethod.getHistory() == null ) {
|
||||
Type sourceType = this.method.getParameters().get( 0 ).getType();
|
||||
Type targetType = this.method.getReturnType();
|
||||
ctx.getMessager().printMessage(
|
||||
this.method.getExecutable(),
|
||||
Message.PROPERTYMAPPING_FORGED_MAPPING_NOT_FOUND,
|
||||
sourceType,
|
||||
targetType,
|
||||
targetType,
|
||||
sourceType
|
||||
);
|
||||
}
|
||||
else {
|
||||
ForgedMethodHistory history = forgedMethod.getHistory();
|
||||
ctx.getMessager().printMessage(
|
||||
this.method.getExecutable(),
|
||||
Message.PROPERTYMAPPING_MAPPING_NOT_FOUND,
|
||||
history.createSourcePropertyErrorMessage(),
|
||||
history.getTargetType(),
|
||||
history.createTargetPropertyName(),
|
||||
history.getTargetType(),
|
||||
history.getSourceType()
|
||||
);
|
||||
}
|
||||
|
||||
if ( method instanceof ForgedMethod && targetProperties.isEmpty() ) {
|
||||
//TODO until we solve 1140 we report this error when the target properties are empty
|
||||
ForgedMethod forgedMethod = (ForgedMethod) method;
|
||||
if ( forgedMethod.getHistory() == null ) {
|
||||
Type sourceType = this.method.getParameters().get( 0 ).getType();
|
||||
Type targetType = this.method.getReturnType();
|
||||
ctx.getMessager().printMessage(
|
||||
this.method.getExecutable(),
|
||||
Message.PROPERTYMAPPING_FORGED_MAPPING_NOT_FOUND,
|
||||
sourceType,
|
||||
targetType,
|
||||
targetType,
|
||||
sourceType
|
||||
);
|
||||
}
|
||||
else {
|
||||
ForgedMethodHistory history = forgedMethod.getHistory();
|
||||
ctx.getMessager().printMessage(
|
||||
this.method.getExecutable(),
|
||||
Message.PROPERTYMAPPING_MAPPING_NOT_FOUND,
|
||||
history.createSourcePropertyErrorMessage(),
|
||||
history.getTargetType(),
|
||||
history.createTargetPropertyName(),
|
||||
history.getTargetType(),
|
||||
history.getSourceType()
|
||||
);
|
||||
}
|
||||
}
|
||||
else if ( !unprocessedTargetProperties.isEmpty() && unmappedTargetPolicy.requiresReport() ) {
|
||||
|
||||
Message msg = unmappedTargetPolicy.getDiagnosticKind() == Diagnostic.Kind.ERROR ?
|
||||
Message.BEANMAPPING_UNMAPPED_TARGETS_ERROR : Message.BEANMAPPING_UNMAPPED_TARGETS_WARNING;
|
||||
|
||||
ctx.getMessager().printMessage(
|
||||
method.getExecutable(),
|
||||
msg,
|
||||
Object[] args = new Object[] {
|
||||
MessageFormat.format(
|
||||
"{0,choice,1#property|1<properties}: \"{1}\"",
|
||||
unprocessedTargetProperties.size(),
|
||||
Strings.join( unprocessedTargetProperties.keySet(), ", " )
|
||||
)
|
||||
};
|
||||
if ( method instanceof ForgedMethod ) {
|
||||
msg = unmappedTargetPolicy.getDiagnosticKind() == Diagnostic.Kind.ERROR ?
|
||||
Message.BEANMAPPING_UNMAPPED_FORGED_TARGETS_ERROR :
|
||||
Message.BEANMAPPING_UNMAPPED_FORGED_TARGETS_WARNING;
|
||||
String sourceErrorMessage = method.getParameters().get( 0 ).getType().toString();
|
||||
String targetErrorMessage = method.getReturnType().toString();
|
||||
if ( ( (ForgedMethod) method ).getHistory() != null ) {
|
||||
ForgedMethodHistory history = ( (ForgedMethod) method ).getHistory();
|
||||
sourceErrorMessage = history.createSourcePropertyErrorMessage();
|
||||
targetErrorMessage = MessageFormat.format(
|
||||
"\"{0} {1}\"",
|
||||
history.getTargetType(),
|
||||
history.createTargetPropertyName()
|
||||
);
|
||||
}
|
||||
args = new Object[] {
|
||||
args[0],
|
||||
sourceErrorMessage,
|
||||
targetErrorMessage
|
||||
};
|
||||
}
|
||||
|
||||
ctx.getMessager().printMessage(
|
||||
method.getExecutable(),
|
||||
msg,
|
||||
args
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -37,6 +37,8 @@ public enum Message {
|
||||
BEANMAPPING_SEVERAL_POSSIBLE_TARGET_ACCESSORS( "Found several matching getters for property \"%s\"." ),
|
||||
BEANMAPPING_UNMAPPED_TARGETS_WARNING( "Unmapped target %s.", Diagnostic.Kind.WARNING ),
|
||||
BEANMAPPING_UNMAPPED_TARGETS_ERROR( "Unmapped target %s." ),
|
||||
BEANMAPPING_UNMAPPED_FORGED_TARGETS_WARNING( "Unmapped target %s. Mapping from %s to %s.", Diagnostic.Kind.WARNING ),
|
||||
BEANMAPPING_UNMAPPED_FORGED_TARGETS_ERROR( "Unmapped target %s. Mapping from %s to %s." ),
|
||||
BEANMAPPING_CYCLE_BETWEEN_PROPERTIES( "Cycle(s) between properties given via dependsOn(): %s." ),
|
||||
BEANMAPPING_UNKNOWN_PROPERTY_IN_DEPENDS_ON( "\"%s\" is no property of the method return type." ),
|
||||
|
||||
|
@ -27,10 +27,10 @@ import org.mapstruct.factory.Mappers;
|
||||
* @author Sjaak Derksen
|
||||
*/
|
||||
@Mapper
|
||||
public abstract class ErroneousAbstractSourceTargetMapperPrivate extends SourceTargetmapperPrivateBase {
|
||||
public abstract class AbstractSourceTargetMapperPrivate extends SourceTargetmapperPrivateBase {
|
||||
|
||||
public static final ErroneousAbstractSourceTargetMapperPrivate INSTANCE =
|
||||
Mappers.getMapper( ErroneousAbstractSourceTargetMapperPrivate.class );
|
||||
public static final AbstractSourceTargetMapperPrivate INSTANCE =
|
||||
Mappers.getMapper( AbstractSourceTargetMapperPrivate.class );
|
||||
|
||||
@Mapping(source = "referencedSource", target = "referencedTarget")
|
||||
public abstract Target toTarget(Source source);
|
@ -18,6 +18,7 @@
|
||||
*/
|
||||
package org.mapstruct.ap.test.accessibility.referenced;
|
||||
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mapstruct.ap.test.accessibility.referenced.a.ReferencedMapperDefaultOther;
|
||||
@ -27,6 +28,7 @@ import org.mapstruct.ap.testutil.compilation.annotation.CompilationResult;
|
||||
import org.mapstruct.ap.testutil.compilation.annotation.Diagnostic;
|
||||
import org.mapstruct.ap.testutil.compilation.annotation.ExpectedCompilationOutcome;
|
||||
import org.mapstruct.ap.testutil.runner.AnnotationProcessorTestRunner;
|
||||
import org.mapstruct.ap.testutil.runner.GeneratedSource;
|
||||
|
||||
/**
|
||||
* Test for different accessibility modifiers
|
||||
@ -37,21 +39,26 @@ import org.mapstruct.ap.testutil.runner.AnnotationProcessorTestRunner;
|
||||
@RunWith( AnnotationProcessorTestRunner.class )
|
||||
public class ReferencedAccessibilityTest {
|
||||
|
||||
@Rule
|
||||
public final GeneratedSource generatedSource = new GeneratedSource();
|
||||
|
||||
@Test
|
||||
@IssueKey( "206" )
|
||||
@WithClasses( { ErroneousSourceTargetMapperPrivate.class, ReferencedMapperPrivate.class } )
|
||||
@IssueKey("206")
|
||||
@WithClasses({ SourceTargetMapperPrivate.class, ReferencedMapperPrivate.class })
|
||||
@ExpectedCompilationOutcome(
|
||||
value = CompilationResult.FAILED,
|
||||
diagnostics = {
|
||||
@Diagnostic( type = ErroneousSourceTargetMapperPrivate.class,
|
||||
kind = javax.tools.Diagnostic.Kind.ERROR,
|
||||
line = 35,
|
||||
messageRegExp = "Can't map property \"org\\.mapstruct\\.ap\\.test\\.accessibility\\."
|
||||
+ "referenced\\.ReferencedSource referencedSource\" to \"org\\.mapstruct\\."
|
||||
+ "ap\\.test\\.accessibility\\.referenced\\.ReferencedTarget referencedTarget\"" )
|
||||
}
|
||||
value = CompilationResult.SUCCEEDED,
|
||||
diagnostics = {
|
||||
@Diagnostic(type = SourceTargetMapperPrivate.class,
|
||||
kind = javax.tools.Diagnostic.Kind.WARNING,
|
||||
line = 35,
|
||||
messageRegExp = "Unmapped target property: \"bar\"\\. Mapping from property \"org\\.mapstruct\\.ap\\" +
|
||||
".test\\.accessibility\\.referenced\\.ReferencedSource referencedSource\" to \"org\\.mapstruct\\" +
|
||||
".ap\\.test\\.accessibility\\.referenced\\.ReferencedTarget referencedTarget\"")
|
||||
}
|
||||
)
|
||||
public void shouldNotBeAbleToAccessPrivateMethodInReferenced() throws Exception { }
|
||||
public void shouldNotBeAbleToAccessPrivateMethodInReferenced() throws Exception {
|
||||
generatedSource.addComparisonToFixtureFor( SourceTargetMapperPrivate.class );
|
||||
}
|
||||
|
||||
@Test
|
||||
@IssueKey( "206" )
|
||||
@ -64,20 +71,22 @@ public class ReferencedAccessibilityTest {
|
||||
public void shouldBeAbleToAccessProtectedMethodInReferencedInSamePackage() throws Exception { }
|
||||
|
||||
@Test
|
||||
@IssueKey( "206" )
|
||||
@WithClasses( { ErroneousSourceTargetMapperDefaultOther.class, ReferencedMapperDefaultOther.class } )
|
||||
@IssueKey("206")
|
||||
@WithClasses({ SourceTargetMapperDefaultOther.class, ReferencedMapperDefaultOther.class })
|
||||
@ExpectedCompilationOutcome(
|
||||
value = CompilationResult.FAILED,
|
||||
diagnostics = {
|
||||
@Diagnostic( type = ErroneousSourceTargetMapperDefaultOther.class,
|
||||
kind = javax.tools.Diagnostic.Kind.ERROR,
|
||||
line = 37,
|
||||
messageRegExp = "Can't map property \"org\\.mapstruct\\.ap\\.test\\.accessibility\\."
|
||||
+ "referenced\\.ReferencedSource referencedSource\" to \"org\\.mapstruct\\."
|
||||
+ "ap\\.test\\.accessibility\\.referenced\\.ReferencedTarget referencedTarget\"" )
|
||||
}
|
||||
value = CompilationResult.SUCCEEDED,
|
||||
diagnostics = {
|
||||
@Diagnostic(type = SourceTargetMapperDefaultOther.class,
|
||||
kind = javax.tools.Diagnostic.Kind.WARNING,
|
||||
line = 37,
|
||||
messageRegExp = "Unmapped target property: \"bar\"\\. Mapping from property \"org\\.mapstruct\\.ap\\" +
|
||||
".test\\.accessibility\\.referenced\\.ReferencedSource referencedSource\" to \"org\\.mapstruct\\" +
|
||||
".ap\\.test\\.accessibility\\.referenced\\.ReferencedTarget referencedTarget\"")
|
||||
}
|
||||
)
|
||||
public void shouldNotBeAbleToAccessDefaultMethodInReferencedInOtherPackage() throws Exception { }
|
||||
public void shouldNotBeAbleToAccessDefaultMethodInReferencedInOtherPackage() throws Exception {
|
||||
generatedSource.addComparisonToFixtureFor( SourceTargetMapperDefaultOther.class );
|
||||
}
|
||||
|
||||
@Test
|
||||
@IssueKey( "206" )
|
||||
@ -85,18 +94,20 @@ public class ReferencedAccessibilityTest {
|
||||
public void shouldBeAbleToAccessProtectedMethodInBase() throws Exception { }
|
||||
|
||||
@Test
|
||||
@IssueKey( "206" )
|
||||
@WithClasses( { ErroneousAbstractSourceTargetMapperPrivate.class, SourceTargetmapperPrivateBase.class } )
|
||||
@IssueKey("206")
|
||||
@WithClasses({ AbstractSourceTargetMapperPrivate.class, SourceTargetmapperPrivateBase.class })
|
||||
@ExpectedCompilationOutcome(
|
||||
value = CompilationResult.FAILED,
|
||||
diagnostics = {
|
||||
@Diagnostic( type = ErroneousAbstractSourceTargetMapperPrivate.class,
|
||||
kind = javax.tools.Diagnostic.Kind.ERROR,
|
||||
line = 36,
|
||||
messageRegExp = "Can't map property \"org\\.mapstruct\\.ap\\.test\\.accessibility\\."
|
||||
+ "referenced\\.ReferencedSource referencedSource\" to \"org\\.mapstruct\\."
|
||||
+ "ap\\.test\\.accessibility\\.referenced\\.ReferencedTarget referencedTarget\"" )
|
||||
}
|
||||
value = CompilationResult.SUCCEEDED,
|
||||
diagnostics = {
|
||||
@Diagnostic(type = AbstractSourceTargetMapperPrivate.class,
|
||||
kind = javax.tools.Diagnostic.Kind.WARNING,
|
||||
line = 36,
|
||||
messageRegExp = "Unmapped target property: \"bar\"\\. Mapping from property \"org\\.mapstruct\\.ap\\" +
|
||||
".test\\.accessibility\\.referenced\\.ReferencedSource referencedSource\" to \"org\\.mapstruct\\" +
|
||||
".ap\\.test\\.accessibility\\.referenced\\.ReferencedTarget referencedTarget\"")
|
||||
}
|
||||
)
|
||||
public void shouldNotBeAbleToAccessPrivateMethodInBase() throws Exception { }
|
||||
public void shouldNotBeAbleToAccessPrivateMethodInBase() throws Exception {
|
||||
generatedSource.addComparisonToFixtureFor( AbstractSourceTargetMapperPrivate.class );
|
||||
}
|
||||
}
|
||||
|
@ -28,10 +28,10 @@ import org.mapstruct.factory.Mappers;
|
||||
* @author Sjaak Derksen
|
||||
*/
|
||||
@Mapper(uses = ReferencedMapperDefaultOther.class)
|
||||
public interface ErroneousSourceTargetMapperDefaultOther {
|
||||
public interface SourceTargetMapperDefaultOther {
|
||||
|
||||
ErroneousSourceTargetMapperDefaultOther INSTANCE =
|
||||
Mappers.getMapper( ErroneousSourceTargetMapperDefaultOther.class );
|
||||
SourceTargetMapperDefaultOther INSTANCE =
|
||||
Mappers.getMapper( SourceTargetMapperDefaultOther.class );
|
||||
|
||||
@Mapping(source = "referencedSource", target = "referencedTarget")
|
||||
Target toTarget(Source source);
|
@ -27,9 +27,9 @@ import org.mapstruct.factory.Mappers;
|
||||
* @author Sjaak Derksen
|
||||
*/
|
||||
@Mapper(uses = ReferencedMapperPrivate.class)
|
||||
public interface ErroneousSourceTargetMapperPrivate {
|
||||
public interface SourceTargetMapperPrivate {
|
||||
|
||||
ErroneousSourceTargetMapperPrivate INSTANCE = Mappers.getMapper( ErroneousSourceTargetMapperPrivate.class );
|
||||
SourceTargetMapperPrivate INSTANCE = Mappers.getMapper( SourceTargetMapperPrivate.class );
|
||||
|
||||
@Mapping(source = "referencedSource", target = "referencedTarget")
|
||||
Target toTarget(Source source);
|
@ -21,40 +21,58 @@ package org.mapstruct.ap.test.nestedbeans;
|
||||
import org.junit.Test;
|
||||
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mapstruct.ap.test.nestedbeans.erroneous.Computer;
|
||||
import org.mapstruct.ap.test.nestedbeans.erroneous.ComputerDto;
|
||||
import org.mapstruct.ap.test.nestedbeans.erroneous.Dictionary;
|
||||
import org.mapstruct.ap.test.nestedbeans.erroneous.DictionaryDto;
|
||||
import org.mapstruct.ap.test.nestedbeans.erroneous.ForeignWord;
|
||||
import org.mapstruct.ap.test.nestedbeans.erroneous.ForeignWordDto;
|
||||
import org.mapstruct.ap.test.nestedbeans.erroneous.Cat;
|
||||
import org.mapstruct.ap.test.nestedbeans.erroneous.CatDto;
|
||||
import org.mapstruct.ap.test.nestedbeans.erroneous.Info;
|
||||
import org.mapstruct.ap.test.nestedbeans.erroneous.InfoDto;
|
||||
import org.mapstruct.ap.test.nestedbeans.erroneous.RoofTypeMapper;
|
||||
import org.mapstruct.ap.test.nestedbeans.erroneous.UnmappableCollectionElementPropertyMapper;
|
||||
import org.mapstruct.ap.test.nestedbeans.erroneous.UnmappableDeepListMapper;
|
||||
import org.mapstruct.ap.test.nestedbeans.erroneous.UnmappableDeepMapKeyMapper;
|
||||
import org.mapstruct.ap.test.nestedbeans.erroneous.UnmappableDeepMapValueMapper;
|
||||
import org.mapstruct.ap.test.nestedbeans.erroneous.UnmappableEnumMapper;
|
||||
import org.mapstruct.ap.test.nestedbeans.erroneous.UnmappableValuePropertyMapper;
|
||||
import org.mapstruct.ap.test.nestedbeans.erroneous.UserDto;
|
||||
import org.mapstruct.ap.test.nestedbeans.erroneous.User;
|
||||
import org.mapstruct.ap.test.nestedbeans.erroneous.WheelDto;
|
||||
import org.mapstruct.ap.test.nestedbeans.erroneous.Wheel;
|
||||
import org.mapstruct.ap.test.nestedbeans.erroneous.Car;
|
||||
import org.mapstruct.ap.test.nestedbeans.erroneous.CarDto;
|
||||
import org.mapstruct.ap.test.nestedbeans.erroneous.ExternalRoofType;
|
||||
import org.mapstruct.ap.test.nestedbeans.erroneous.House;
|
||||
import org.mapstruct.ap.test.nestedbeans.erroneous.HouseDto;
|
||||
import org.mapstruct.ap.test.nestedbeans.erroneous.Color;
|
||||
import org.mapstruct.ap.test.nestedbeans.erroneous.ColorDto;
|
||||
import org.mapstruct.ap.test.nestedbeans.erroneous.Roof;
|
||||
import org.mapstruct.ap.test.nestedbeans.erroneous.RoofType;
|
||||
import org.mapstruct.ap.test.nestedbeans.erroneous.RoofDto;
|
||||
import org.mapstruct.ap.test.nestedbeans.erroneous.UnmappableDeepNestingMapper;
|
||||
import org.mapstruct.ap.test.nestedbeans.erroneous.Word;
|
||||
import org.mapstruct.ap.test.nestedbeans.erroneous.WordDto;
|
||||
import org.mapstruct.ap.test.nestedbeans.unmappable.BaseCollectionElementPropertyMapper;
|
||||
import org.mapstruct.ap.test.nestedbeans.unmappable.BaseDeepListMapper;
|
||||
import org.mapstruct.ap.test.nestedbeans.unmappable.BaseDeepMapKeyMapper;
|
||||
import org.mapstruct.ap.test.nestedbeans.unmappable.BaseDeepMapValueMapper;
|
||||
import org.mapstruct.ap.test.nestedbeans.unmappable.BaseDeepNestingMapper;
|
||||
import org.mapstruct.ap.test.nestedbeans.unmappable.BaseValuePropertyMapper;
|
||||
import org.mapstruct.ap.test.nestedbeans.unmappable.Computer;
|
||||
import org.mapstruct.ap.test.nestedbeans.unmappable.ComputerDto;
|
||||
import org.mapstruct.ap.test.nestedbeans.unmappable.Dictionary;
|
||||
import org.mapstruct.ap.test.nestedbeans.unmappable.DictionaryDto;
|
||||
import org.mapstruct.ap.test.nestedbeans.unmappable.ForeignWord;
|
||||
import org.mapstruct.ap.test.nestedbeans.unmappable.ForeignWordDto;
|
||||
import org.mapstruct.ap.test.nestedbeans.unmappable.Cat;
|
||||
import org.mapstruct.ap.test.nestedbeans.unmappable.CatDto;
|
||||
import org.mapstruct.ap.test.nestedbeans.unmappable.Info;
|
||||
import org.mapstruct.ap.test.nestedbeans.unmappable.InfoDto;
|
||||
import org.mapstruct.ap.test.nestedbeans.unmappable.RoofTypeMapper;
|
||||
import org.mapstruct.ap.test.nestedbeans.unmappable.erroneous.UnmappableCollectionElementPropertyMapper;
|
||||
import org.mapstruct.ap.test.nestedbeans.unmappable.erroneous.UnmappableDeepListMapper;
|
||||
import org.mapstruct.ap.test.nestedbeans.unmappable.erroneous.UnmappableDeepMapKeyMapper;
|
||||
import org.mapstruct.ap.test.nestedbeans.unmappable.erroneous.UnmappableDeepMapValueMapper;
|
||||
import org.mapstruct.ap.test.nestedbeans.unmappable.erroneous.UnmappableEnumMapper;
|
||||
import org.mapstruct.ap.test.nestedbeans.unmappable.erroneous.UnmappableValuePropertyMapper;
|
||||
import org.mapstruct.ap.test.nestedbeans.unmappable.ignore.UnmappableIgnoreCollectionElementPropertyMapper;
|
||||
import org.mapstruct.ap.test.nestedbeans.unmappable.ignore.UnmappableIgnoreDeepListMapper;
|
||||
import org.mapstruct.ap.test.nestedbeans.unmappable.ignore.UnmappableIgnoreDeepMapKeyMapper;
|
||||
import org.mapstruct.ap.test.nestedbeans.unmappable.ignore.UnmappableIgnoreDeepMapValueMapper;
|
||||
import org.mapstruct.ap.test.nestedbeans.unmappable.ignore.UnmappableIgnoreDeepNestingMapper;
|
||||
import org.mapstruct.ap.test.nestedbeans.unmappable.ignore.UnmappableIgnoreValuePropertyMapper;
|
||||
import org.mapstruct.ap.test.nestedbeans.unmappable.warn.UnmappableWarnCollectionElementPropertyMapper;
|
||||
import org.mapstruct.ap.test.nestedbeans.unmappable.warn.UnmappableWarnDeepListMapper;
|
||||
import org.mapstruct.ap.test.nestedbeans.unmappable.warn.UnmappableWarnDeepMapKeyMapper;
|
||||
import org.mapstruct.ap.test.nestedbeans.unmappable.warn.UnmappableWarnDeepMapValueMapper;
|
||||
import org.mapstruct.ap.test.nestedbeans.unmappable.warn.UnmappableWarnDeepNestingMapper;
|
||||
import org.mapstruct.ap.test.nestedbeans.unmappable.warn.UnmappableWarnValuePropertyMapper;
|
||||
import org.mapstruct.ap.test.nestedbeans.unmappable.UserDto;
|
||||
import org.mapstruct.ap.test.nestedbeans.unmappable.User;
|
||||
import org.mapstruct.ap.test.nestedbeans.unmappable.WheelDto;
|
||||
import org.mapstruct.ap.test.nestedbeans.unmappable.Wheel;
|
||||
import org.mapstruct.ap.test.nestedbeans.unmappable.Car;
|
||||
import org.mapstruct.ap.test.nestedbeans.unmappable.CarDto;
|
||||
import org.mapstruct.ap.test.nestedbeans.unmappable.ExternalRoofType;
|
||||
import org.mapstruct.ap.test.nestedbeans.unmappable.House;
|
||||
import org.mapstruct.ap.test.nestedbeans.unmappable.HouseDto;
|
||||
import org.mapstruct.ap.test.nestedbeans.unmappable.Color;
|
||||
import org.mapstruct.ap.test.nestedbeans.unmappable.ColorDto;
|
||||
import org.mapstruct.ap.test.nestedbeans.unmappable.Roof;
|
||||
import org.mapstruct.ap.test.nestedbeans.unmappable.RoofType;
|
||||
import org.mapstruct.ap.test.nestedbeans.unmappable.RoofDto;
|
||||
import org.mapstruct.ap.test.nestedbeans.unmappable.erroneous.UnmappableDeepNestingMapper;
|
||||
import org.mapstruct.ap.test.nestedbeans.unmappable.Word;
|
||||
import org.mapstruct.ap.test.nestedbeans.unmappable.WordDto;
|
||||
import org.mapstruct.ap.testutil.WithClasses;
|
||||
import org.mapstruct.ap.testutil.compilation.annotation.CompilationResult;
|
||||
import org.mapstruct.ap.testutil.compilation.annotation.Diagnostic;
|
||||
@ -69,7 +87,13 @@ import org.mapstruct.ap.testutil.runner.AnnotationProcessorTestRunner;
|
||||
Dictionary.class, DictionaryDto.class, Word.class, WordDto.class,
|
||||
ForeignWord.class, ForeignWordDto.class,
|
||||
Computer.class, ComputerDto.class,
|
||||
Cat.class, CatDto.class, Info.class, InfoDto.class
|
||||
Cat.class, CatDto.class, Info.class, InfoDto.class,
|
||||
BaseCollectionElementPropertyMapper.class,
|
||||
BaseDeepListMapper.class,
|
||||
BaseDeepMapKeyMapper.class,
|
||||
BaseDeepMapValueMapper.class,
|
||||
BaseDeepNestingMapper.class,
|
||||
BaseValuePropertyMapper.class
|
||||
})
|
||||
@RunWith(AnnotationProcessorTestRunner.class)
|
||||
public class DottedErrorMessageTest {
|
||||
@ -86,12 +110,11 @@ public class DottedErrorMessageTest {
|
||||
@ExpectedCompilationOutcome(
|
||||
value = CompilationResult.FAILED,
|
||||
diagnostics = {
|
||||
@Diagnostic(type = UnmappableDeepNestingMapper.class,
|
||||
@Diagnostic(type = BaseDeepNestingMapper.class,
|
||||
kind = javax.tools.Diagnostic.Kind.ERROR,
|
||||
line = 26,
|
||||
messageRegExp = "Can't map " + PROPERTY +
|
||||
" \".*Color house\\.roof\\.color\" to \".*house\\.roof\\.color\"\\. " +
|
||||
"Consider to declare/implement a mapping method: \".*ColorDto map\\(.*Color value\\)\"\\.")
|
||||
line = 23,
|
||||
messageRegExp = "Unmapped target property: \"rgb\"\\. Mapping from " + PROPERTY +
|
||||
" \".*Color house\\.roof\\.color\" to \".*ColorDto house\\.roof\\.color\"\\.")
|
||||
}
|
||||
)
|
||||
public void testDeepNestedBeans() {
|
||||
@ -104,12 +127,11 @@ public class DottedErrorMessageTest {
|
||||
@ExpectedCompilationOutcome(
|
||||
value = CompilationResult.FAILED,
|
||||
diagnostics = {
|
||||
@Diagnostic(type = UnmappableDeepListMapper.class,
|
||||
@Diagnostic(type = BaseDeepListMapper.class,
|
||||
kind = javax.tools.Diagnostic.Kind.ERROR,
|
||||
line = 26,
|
||||
messageRegExp = "Can't map " + COLLECTION_ELEMENT +
|
||||
" \".*Wheel car\\.wheels\" to \".*car\\.wheels\"\\. " +
|
||||
"Consider to declare/implement a mapping method: \".*WheelDto map\\(.*Wheel value\\)\"\\.")
|
||||
line = 23,
|
||||
messageRegExp = "Unmapped target property: \"left\"\\. Mapping from " + COLLECTION_ELEMENT +
|
||||
" \".*Wheel car\\.wheels\" to \".*WheelDto car\\.wheels\"\\.")
|
||||
}
|
||||
)
|
||||
public void testIterables() {
|
||||
@ -122,12 +144,11 @@ public class DottedErrorMessageTest {
|
||||
@ExpectedCompilationOutcome(
|
||||
value = CompilationResult.FAILED,
|
||||
diagnostics = {
|
||||
@Diagnostic(type = UnmappableDeepMapKeyMapper.class,
|
||||
@Diagnostic(type = BaseDeepMapKeyMapper.class,
|
||||
kind = javax.tools.Diagnostic.Kind.ERROR,
|
||||
line = 26,
|
||||
messageRegExp = "Can't map " + MAP_KEY +
|
||||
" \".*Word dictionary\\.wordMap\\{:key\\}\" to \".*dictionary\\.wordMap\\{:key\\}\"\\. " +
|
||||
"Consider to declare/implement a mapping method: \".*WordDto map\\(.*Word value\\)\"\\.")
|
||||
line = 23,
|
||||
messageRegExp = "Unmapped target property: \"pronunciation\"\\. Mapping from " + MAP_KEY +
|
||||
" \".*Word dictionary\\.wordMap\\{:key\\}\" to \".*WordDto dictionary\\.wordMap\\{:key\\}\"\\.")
|
||||
}
|
||||
)
|
||||
public void testMapKeys() {
|
||||
@ -140,14 +161,12 @@ public class DottedErrorMessageTest {
|
||||
@ExpectedCompilationOutcome(
|
||||
value = CompilationResult.FAILED,
|
||||
diagnostics = {
|
||||
@Diagnostic(type = UnmappableDeepMapValueMapper.class,
|
||||
@Diagnostic(type = BaseDeepMapValueMapper.class,
|
||||
kind = javax.tools.Diagnostic.Kind.ERROR,
|
||||
line = 26,
|
||||
messageRegExp = "Can't map " + MAP_VALUE +
|
||||
line = 23,
|
||||
messageRegExp = "Unmapped target property: \"pronunciation\"\\. Mapping from " + MAP_VALUE +
|
||||
" \".*ForeignWord dictionary\\.wordMap\\{:value\\}\" " +
|
||||
"to \".*dictionary\\.wordMap\\{:value\\}\"\\. " +
|
||||
"Consider to declare/implement a mapping method: " +
|
||||
"\".*ForeignWordDto map\\(.*ForeignWord value\\)\"\\.")
|
||||
"to \".*ForeignWordDto dictionary\\.wordMap\\{:value\\}\"\\.")
|
||||
}
|
||||
)
|
||||
public void testMapValues() {
|
||||
@ -160,12 +179,11 @@ public class DottedErrorMessageTest {
|
||||
@ExpectedCompilationOutcome(
|
||||
value = CompilationResult.FAILED,
|
||||
diagnostics = {
|
||||
@Diagnostic(type = UnmappableCollectionElementPropertyMapper.class,
|
||||
@Diagnostic(type = BaseCollectionElementPropertyMapper.class,
|
||||
kind = javax.tools.Diagnostic.Kind.ERROR,
|
||||
line = 26,
|
||||
messageRegExp = "Can't map " + PROPERTY +
|
||||
" \".*Info computers\\[\\].info\" to \".*computers\\[\\].info\"\\. " +
|
||||
"Consider to declare/implement a mapping method: \".*InfoDto map\\(.*Info value\\)\"\\.")
|
||||
line = 23,
|
||||
messageRegExp = "Unmapped target property: \"color\"\\. Mapping from " + PROPERTY +
|
||||
" \".*Info computers\\[\\].info\" to \".*InfoDto computers\\[\\].info\"\\.")
|
||||
}
|
||||
)
|
||||
public void testCollectionElementProperty() {
|
||||
@ -178,12 +196,11 @@ public class DottedErrorMessageTest {
|
||||
@ExpectedCompilationOutcome(
|
||||
value = CompilationResult.FAILED,
|
||||
diagnostics = {
|
||||
@Diagnostic(type = UnmappableValuePropertyMapper.class,
|
||||
@Diagnostic(type = BaseValuePropertyMapper.class,
|
||||
kind = javax.tools.Diagnostic.Kind.ERROR,
|
||||
line = 26,
|
||||
messageRegExp = "Can't map " + PROPERTY +
|
||||
" \".*Info catNameMap\\{:value\\}.info\" to \".*catNameMap\\{:value\\}.info\"\\. " +
|
||||
"Consider to declare/implement a mapping method: \".*InfoDto map\\(.*Info value\\)\"\\.")
|
||||
line = 23,
|
||||
messageRegExp = "Unmapped target property: \"color\"\\. Mapping from " + PROPERTY +
|
||||
" \".*Info catNameMap\\{:value\\}.info\" to \".*InfoDto catNameMap\\{:value\\}.info\"\\.")
|
||||
}
|
||||
)
|
||||
public void testMapValueProperty() {
|
||||
@ -198,7 +215,7 @@ public class DottedErrorMessageTest {
|
||||
diagnostics = {
|
||||
@Diagnostic(type = UnmappableEnumMapper.class,
|
||||
kind = javax.tools.Diagnostic.Kind.ERROR,
|
||||
line = 26,
|
||||
line = 38,
|
||||
messageRegExp = "The following constants from the property \".*RoofType house\\.roof\\.type\" enum " +
|
||||
"have no corresponding constant in the \".*ExternalRoofType house\\.roof\\.type\" enum and must " +
|
||||
"be be mapped via adding additional mappings: NORMAL\\."
|
||||
@ -207,4 +224,67 @@ public class DottedErrorMessageTest {
|
||||
)
|
||||
public void testMapEnumProperty() {
|
||||
}
|
||||
|
||||
@Test
|
||||
@WithClasses({
|
||||
UnmappableWarnDeepNestingMapper.class,
|
||||
UnmappableWarnDeepListMapper.class,
|
||||
UnmappableWarnDeepMapKeyMapper.class,
|
||||
UnmappableWarnDeepMapValueMapper.class,
|
||||
UnmappableWarnCollectionElementPropertyMapper.class,
|
||||
UnmappableWarnValuePropertyMapper.class
|
||||
})
|
||||
@ExpectedCompilationOutcome(
|
||||
value = CompilationResult.SUCCEEDED,
|
||||
diagnostics = {
|
||||
@Diagnostic(type = BaseDeepNestingMapper.class,
|
||||
kind = javax.tools.Diagnostic.Kind.WARNING,
|
||||
line = 23,
|
||||
messageRegExp = "Unmapped target property: \"rgb\"\\. Mapping from " + PROPERTY +
|
||||
" \".*Color house\\.roof\\.color\" to \".*ColorDto house\\.roof\\.color\"\\."),
|
||||
@Diagnostic(type = BaseDeepListMapper.class,
|
||||
kind = javax.tools.Diagnostic.Kind.WARNING,
|
||||
line = 23,
|
||||
messageRegExp = "Unmapped target property: \"left\"\\. Mapping from " + COLLECTION_ELEMENT +
|
||||
" \".*Wheel car\\.wheels\" to \".*WheelDto car\\.wheels\"\\."),
|
||||
@Diagnostic(type = BaseDeepMapKeyMapper.class,
|
||||
kind = javax.tools.Diagnostic.Kind.WARNING,
|
||||
line = 23,
|
||||
messageRegExp = "Unmapped target property: \"pronunciation\"\\. Mapping from " + MAP_KEY +
|
||||
" \".*Word dictionary\\.wordMap\\{:key\\}\" to \".*WordDto dictionary\\.wordMap\\{:key\\}\"\\."),
|
||||
@Diagnostic(type = BaseDeepMapValueMapper.class,
|
||||
kind = javax.tools.Diagnostic.Kind.WARNING,
|
||||
line = 23,
|
||||
messageRegExp = "Unmapped target property: \"pronunciation\"\\. Mapping from " + MAP_VALUE +
|
||||
" \".*ForeignWord dictionary\\.wordMap\\{:value\\}\" " +
|
||||
"to \".*ForeignWordDto dictionary\\.wordMap\\{:value\\}\"\\."),
|
||||
@Diagnostic(type = BaseCollectionElementPropertyMapper.class,
|
||||
kind = javax.tools.Diagnostic.Kind.WARNING,
|
||||
line = 23,
|
||||
messageRegExp = "Unmapped target property: \"color\"\\. Mapping from " + PROPERTY +
|
||||
" \".*Info computers\\[\\].info\" to \".*InfoDto computers\\[\\].info\"\\."),
|
||||
@Diagnostic(type = BaseValuePropertyMapper.class,
|
||||
kind = javax.tools.Diagnostic.Kind.WARNING,
|
||||
line = 23,
|
||||
messageRegExp = "Unmapped target property: \"color\"\\. Mapping from " + PROPERTY +
|
||||
" \".*Info catNameMap\\{:value\\}.info\" to \".*InfoDto catNameMap\\{:value\\}.info\"\\.")
|
||||
}
|
||||
)
|
||||
public void testWarnUnmappedTargetProperties() {
|
||||
}
|
||||
|
||||
@Test
|
||||
@WithClasses({
|
||||
UnmappableIgnoreDeepNestingMapper.class,
|
||||
UnmappableIgnoreDeepListMapper.class,
|
||||
UnmappableIgnoreDeepMapKeyMapper.class,
|
||||
UnmappableIgnoreDeepMapValueMapper.class,
|
||||
UnmappableIgnoreCollectionElementPropertyMapper.class,
|
||||
UnmappableIgnoreValuePropertyMapper.class
|
||||
})
|
||||
@ExpectedCompilationOutcome(
|
||||
value = CompilationResult.SUCCEEDED
|
||||
)
|
||||
public void testIgnoreUnmappedTargetProperties() {
|
||||
}
|
||||
}
|
||||
|
@ -16,14 +16,11 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.mapstruct.ap.test.nestedbeans.erroneous;
|
||||
package org.mapstruct.ap.test.nestedbeans.unmappable;
|
||||
|
||||
import org.mapstruct.Mapper;
|
||||
public abstract class BaseCollectionElementPropertyMapper {
|
||||
|
||||
@Mapper(uses = RoofTypeMapper.class)
|
||||
public abstract class UnmappableCollectionElementPropertyMapper {
|
||||
|
||||
abstract UserDto userToUserDto(User user);
|
||||
public abstract UserDto userToUserDto(User user);
|
||||
|
||||
public HouseDto map(House house) {
|
||||
return new HouseDto();
|
@ -16,14 +16,11 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.mapstruct.ap.test.nestedbeans.erroneous;
|
||||
package org.mapstruct.ap.test.nestedbeans.unmappable;
|
||||
|
||||
import org.mapstruct.Mapper;
|
||||
public abstract class BaseDeepListMapper {
|
||||
|
||||
@Mapper(uses = RoofTypeMapper.class)
|
||||
public abstract class UnmappableDeepListMapper {
|
||||
|
||||
abstract UserDto userToUserDto(User user);
|
||||
public abstract UserDto userToUserDto(User user);
|
||||
|
||||
public HouseDto map(House house) {
|
||||
return new HouseDto();
|
@ -16,14 +16,11 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.mapstruct.ap.test.nestedbeans.erroneous;
|
||||
package org.mapstruct.ap.test.nestedbeans.unmappable;
|
||||
|
||||
import org.mapstruct.Mapper;
|
||||
public abstract class BaseDeepMapKeyMapper {
|
||||
|
||||
@Mapper(uses = RoofTypeMapper.class)
|
||||
public abstract class UnmappableDeepMapKeyMapper {
|
||||
|
||||
abstract UserDto userToUserDto(User user);
|
||||
public abstract UserDto userToUserDto(User user);
|
||||
|
||||
public CarDto map(Car carDto) {
|
||||
return new CarDto();
|
@ -16,14 +16,11 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.mapstruct.ap.test.nestedbeans.erroneous;
|
||||
package org.mapstruct.ap.test.nestedbeans.unmappable;
|
||||
|
||||
import org.mapstruct.Mapper;
|
||||
public abstract class BaseDeepMapValueMapper {
|
||||
|
||||
@Mapper(uses = RoofTypeMapper.class)
|
||||
public abstract class UnmappableDeepMapValueMapper {
|
||||
|
||||
abstract UserDto userToUserDto(User user);
|
||||
public abstract UserDto userToUserDto(User user);
|
||||
|
||||
public CarDto map(Car carDto) {
|
||||
return new CarDto();
|
@ -16,14 +16,11 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.mapstruct.ap.test.nestedbeans.erroneous;
|
||||
package org.mapstruct.ap.test.nestedbeans.unmappable;
|
||||
|
||||
import org.mapstruct.Mapper;
|
||||
public abstract class BaseDeepNestingMapper {
|
||||
|
||||
@Mapper(uses = RoofTypeMapper.class)
|
||||
public abstract class UnmappableDeepNestingMapper {
|
||||
|
||||
abstract UserDto userToUserDto(User user);
|
||||
public abstract UserDto userToUserDto(User user);
|
||||
|
||||
public CarDto map(Car carDto) {
|
||||
return new CarDto();
|
@ -16,14 +16,11 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.mapstruct.ap.test.nestedbeans.erroneous;
|
||||
package org.mapstruct.ap.test.nestedbeans.unmappable;
|
||||
|
||||
import org.mapstruct.Mapper;
|
||||
public abstract class BaseValuePropertyMapper {
|
||||
|
||||
@Mapper(uses = RoofTypeMapper.class)
|
||||
public abstract class UnmappableValuePropertyMapper {
|
||||
|
||||
abstract UserDto userToUserDto(User user);
|
||||
public abstract UserDto userToUserDto(User user);
|
||||
|
||||
public HouseDto map(House house) {
|
||||
return new HouseDto();
|
@ -16,7 +16,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.mapstruct.ap.test.nestedbeans.erroneous;
|
||||
package org.mapstruct.ap.test.nestedbeans.unmappable;
|
||||
|
||||
import java.util.List;
|
||||
|
@ -16,7 +16,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.mapstruct.ap.test.nestedbeans.erroneous;
|
||||
package org.mapstruct.ap.test.nestedbeans.unmappable;
|
||||
|
||||
import java.util.List;
|
||||
|
@ -16,7 +16,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.mapstruct.ap.test.nestedbeans.erroneous;
|
||||
package org.mapstruct.ap.test.nestedbeans.unmappable;
|
||||
|
||||
public class Cat {
|
||||
|
@ -16,7 +16,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.mapstruct.ap.test.nestedbeans.erroneous;
|
||||
package org.mapstruct.ap.test.nestedbeans.unmappable;
|
||||
|
||||
public class CatDto {
|
||||
|
@ -16,7 +16,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.mapstruct.ap.test.nestedbeans.erroneous;
|
||||
package org.mapstruct.ap.test.nestedbeans.unmappable;
|
||||
|
||||
public class Color {
|
||||
private String cmyk;
|
@ -16,7 +16,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.mapstruct.ap.test.nestedbeans.erroneous;
|
||||
package org.mapstruct.ap.test.nestedbeans.unmappable;
|
||||
|
||||
public class ColorDto {
|
||||
private String rgb;
|
@ -16,7 +16,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.mapstruct.ap.test.nestedbeans.erroneous;
|
||||
package org.mapstruct.ap.test.nestedbeans.unmappable;
|
||||
|
||||
public class Computer {
|
||||
|
@ -16,7 +16,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.mapstruct.ap.test.nestedbeans.erroneous;
|
||||
package org.mapstruct.ap.test.nestedbeans.unmappable;
|
||||
|
||||
public class ComputerDto {
|
||||
|
@ -16,7 +16,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.mapstruct.ap.test.nestedbeans.erroneous;
|
||||
package org.mapstruct.ap.test.nestedbeans.unmappable;
|
||||
|
||||
import java.util.Map;
|
||||
|
@ -16,7 +16,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.mapstruct.ap.test.nestedbeans.erroneous;
|
||||
package org.mapstruct.ap.test.nestedbeans.unmappable;
|
||||
|
||||
import java.util.Map;
|
||||
|
@ -16,7 +16,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.mapstruct.ap.test.nestedbeans.erroneous;
|
||||
package org.mapstruct.ap.test.nestedbeans.unmappable;
|
||||
|
||||
|
||||
/**
|
@ -16,7 +16,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.mapstruct.ap.test.nestedbeans.erroneous;
|
||||
package org.mapstruct.ap.test.nestedbeans.unmappable;
|
||||
|
||||
public class ForeignWord {
|
||||
|
@ -16,7 +16,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.mapstruct.ap.test.nestedbeans.erroneous;
|
||||
package org.mapstruct.ap.test.nestedbeans.unmappable;
|
||||
|
||||
public class ForeignWordDto {
|
||||
private String pronunciation;
|
@ -16,7 +16,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.mapstruct.ap.test.nestedbeans.erroneous;
|
||||
package org.mapstruct.ap.test.nestedbeans.unmappable;
|
||||
|
||||
public class House {
|
||||
|
@ -16,7 +16,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.mapstruct.ap.test.nestedbeans.erroneous;
|
||||
package org.mapstruct.ap.test.nestedbeans.unmappable;
|
||||
|
||||
public class HouseDto {
|
||||
|
@ -16,7 +16,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.mapstruct.ap.test.nestedbeans.erroneous;
|
||||
package org.mapstruct.ap.test.nestedbeans.unmappable;
|
||||
|
||||
public class Info {
|
||||
private String size;
|
@ -16,7 +16,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.mapstruct.ap.test.nestedbeans.erroneous;
|
||||
package org.mapstruct.ap.test.nestedbeans.unmappable;
|
||||
|
||||
public class InfoDto {
|
||||
private String color;
|
@ -16,7 +16,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.mapstruct.ap.test.nestedbeans.erroneous;
|
||||
package org.mapstruct.ap.test.nestedbeans.unmappable;
|
||||
|
||||
public class Roof {
|
||||
private Color color;
|
@ -16,7 +16,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.mapstruct.ap.test.nestedbeans.erroneous;
|
||||
package org.mapstruct.ap.test.nestedbeans.unmappable;
|
||||
|
||||
public class RoofDto {
|
||||
private ColorDto color;
|
@ -16,7 +16,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.mapstruct.ap.test.nestedbeans.erroneous;
|
||||
package org.mapstruct.ap.test.nestedbeans.unmappable;
|
||||
|
||||
|
||||
/**
|
@ -16,7 +16,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.mapstruct.ap.test.nestedbeans.erroneous;
|
||||
package org.mapstruct.ap.test.nestedbeans.unmappable;
|
||||
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.ValueMapping;
|
@ -16,7 +16,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.mapstruct.ap.test.nestedbeans.erroneous;
|
||||
package org.mapstruct.ap.test.nestedbeans.unmappable;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
@ -16,7 +16,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.mapstruct.ap.test.nestedbeans.erroneous;
|
||||
package org.mapstruct.ap.test.nestedbeans.unmappable;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
@ -16,7 +16,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.mapstruct.ap.test.nestedbeans.erroneous;
|
||||
package org.mapstruct.ap.test.nestedbeans.unmappable;
|
||||
|
||||
public class Wheel {
|
||||
private boolean front;
|
@ -16,7 +16,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.mapstruct.ap.test.nestedbeans.erroneous;
|
||||
package org.mapstruct.ap.test.nestedbeans.unmappable;
|
||||
|
||||
public class WheelDto {
|
||||
private boolean front;
|
@ -16,7 +16,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.mapstruct.ap.test.nestedbeans.erroneous;
|
||||
package org.mapstruct.ap.test.nestedbeans.unmappable;
|
||||
|
||||
public class Word {
|
||||
|
@ -16,7 +16,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.mapstruct.ap.test.nestedbeans.erroneous;
|
||||
package org.mapstruct.ap.test.nestedbeans.unmappable;
|
||||
|
||||
public class WordDto {
|
||||
private String pronunciation;
|
@ -0,0 +1,28 @@
|
||||
/**
|
||||
* Copyright 2012-2017 Gunnar Morling (http://www.gunnarmorling.de/)
|
||||
* and/or other contributors as indicated by the @authors tag. See the
|
||||
* copyright.txt file in the distribution for a full listing of all
|
||||
* contributors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.mapstruct.ap.test.nestedbeans.unmappable.erroneous;
|
||||
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.ReportingPolicy;
|
||||
import org.mapstruct.ap.test.nestedbeans.unmappable.BaseCollectionElementPropertyMapper;
|
||||
import org.mapstruct.ap.test.nestedbeans.unmappable.RoofTypeMapper;
|
||||
|
||||
@Mapper(uses = RoofTypeMapper.class, unmappedTargetPolicy = ReportingPolicy.ERROR)
|
||||
public abstract class UnmappableCollectionElementPropertyMapper extends BaseCollectionElementPropertyMapper {
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
/**
|
||||
* Copyright 2012-2017 Gunnar Morling (http://www.gunnarmorling.de/)
|
||||
* and/or other contributors as indicated by the @authors tag. See the
|
||||
* copyright.txt file in the distribution for a full listing of all
|
||||
* contributors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.mapstruct.ap.test.nestedbeans.unmappable.erroneous;
|
||||
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.ReportingPolicy;
|
||||
import org.mapstruct.ap.test.nestedbeans.unmappable.BaseDeepListMapper;
|
||||
import org.mapstruct.ap.test.nestedbeans.unmappable.RoofTypeMapper;
|
||||
|
||||
@Mapper(uses = RoofTypeMapper.class, unmappedTargetPolicy = ReportingPolicy.ERROR)
|
||||
public abstract class UnmappableDeepListMapper extends BaseDeepListMapper {
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
/**
|
||||
* Copyright 2012-2017 Gunnar Morling (http://www.gunnarmorling.de/)
|
||||
* and/or other contributors as indicated by the @authors tag. See the
|
||||
* copyright.txt file in the distribution for a full listing of all
|
||||
* contributors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.mapstruct.ap.test.nestedbeans.unmappable.erroneous;
|
||||
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.ReportingPolicy;
|
||||
import org.mapstruct.ap.test.nestedbeans.unmappable.BaseDeepMapKeyMapper;
|
||||
import org.mapstruct.ap.test.nestedbeans.unmappable.RoofTypeMapper;
|
||||
|
||||
@Mapper(uses = RoofTypeMapper.class, unmappedTargetPolicy = ReportingPolicy.ERROR)
|
||||
public abstract class UnmappableDeepMapKeyMapper extends BaseDeepMapKeyMapper {
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
/**
|
||||
* Copyright 2012-2017 Gunnar Morling (http://www.gunnarmorling.de/)
|
||||
* and/or other contributors as indicated by the @authors tag. See the
|
||||
* copyright.txt file in the distribution for a full listing of all
|
||||
* contributors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.mapstruct.ap.test.nestedbeans.unmappable.erroneous;
|
||||
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.ReportingPolicy;
|
||||
import org.mapstruct.ap.test.nestedbeans.unmappable.BaseDeepMapValueMapper;
|
||||
import org.mapstruct.ap.test.nestedbeans.unmappable.RoofTypeMapper;
|
||||
|
||||
@Mapper(uses = RoofTypeMapper.class, unmappedTargetPolicy = ReportingPolicy.ERROR)
|
||||
public abstract class UnmappableDeepMapValueMapper extends BaseDeepMapValueMapper {
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
/**
|
||||
* Copyright 2012-2017 Gunnar Morling (http://www.gunnarmorling.de/)
|
||||
* and/or other contributors as indicated by the @authors tag. See the
|
||||
* copyright.txt file in the distribution for a full listing of all
|
||||
* contributors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.mapstruct.ap.test.nestedbeans.unmappable.erroneous;
|
||||
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.ReportingPolicy;
|
||||
import org.mapstruct.ap.test.nestedbeans.unmappable.BaseDeepNestingMapper;
|
||||
import org.mapstruct.ap.test.nestedbeans.unmappable.RoofTypeMapper;
|
||||
|
||||
@Mapper(uses = RoofTypeMapper.class, unmappedTargetPolicy = ReportingPolicy.ERROR)
|
||||
public abstract class UnmappableDeepNestingMapper extends BaseDeepNestingMapper {
|
||||
}
|
@ -16,9 +16,21 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.mapstruct.ap.test.nestedbeans.erroneous;
|
||||
package org.mapstruct.ap.test.nestedbeans.unmappable.erroneous;
|
||||
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.ap.test.nestedbeans.unmappable.Car;
|
||||
import org.mapstruct.ap.test.nestedbeans.unmappable.CarDto;
|
||||
import org.mapstruct.ap.test.nestedbeans.unmappable.Cat;
|
||||
import org.mapstruct.ap.test.nestedbeans.unmappable.CatDto;
|
||||
import org.mapstruct.ap.test.nestedbeans.unmappable.Color;
|
||||
import org.mapstruct.ap.test.nestedbeans.unmappable.ColorDto;
|
||||
import org.mapstruct.ap.test.nestedbeans.unmappable.Computer;
|
||||
import org.mapstruct.ap.test.nestedbeans.unmappable.ComputerDto;
|
||||
import org.mapstruct.ap.test.nestedbeans.unmappable.Dictionary;
|
||||
import org.mapstruct.ap.test.nestedbeans.unmappable.DictionaryDto;
|
||||
import org.mapstruct.ap.test.nestedbeans.unmappable.User;
|
||||
import org.mapstruct.ap.test.nestedbeans.unmappable.UserDto;
|
||||
|
||||
@Mapper
|
||||
public abstract class UnmappableEnumMapper {
|
@ -0,0 +1,28 @@
|
||||
/**
|
||||
* Copyright 2012-2017 Gunnar Morling (http://www.gunnarmorling.de/)
|
||||
* and/or other contributors as indicated by the @authors tag. See the
|
||||
* copyright.txt file in the distribution for a full listing of all
|
||||
* contributors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.mapstruct.ap.test.nestedbeans.unmappable.erroneous;
|
||||
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.ReportingPolicy;
|
||||
import org.mapstruct.ap.test.nestedbeans.unmappable.BaseValuePropertyMapper;
|
||||
import org.mapstruct.ap.test.nestedbeans.unmappable.RoofTypeMapper;
|
||||
|
||||
@Mapper(uses = RoofTypeMapper.class, unmappedTargetPolicy = ReportingPolicy.ERROR)
|
||||
public abstract class UnmappableValuePropertyMapper extends BaseValuePropertyMapper {
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
/**
|
||||
* Copyright 2012-2017 Gunnar Morling (http://www.gunnarmorling.de/)
|
||||
* and/or other contributors as indicated by the @authors tag. See the
|
||||
* copyright.txt file in the distribution for a full listing of all
|
||||
* contributors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.mapstruct.ap.test.nestedbeans.unmappable.ignore;
|
||||
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.ReportingPolicy;
|
||||
import org.mapstruct.ap.test.nestedbeans.unmappable.BaseCollectionElementPropertyMapper;
|
||||
import org.mapstruct.ap.test.nestedbeans.unmappable.RoofTypeMapper;
|
||||
|
||||
@Mapper(uses = RoofTypeMapper.class, unmappedTargetPolicy = ReportingPolicy.IGNORE)
|
||||
public abstract class UnmappableIgnoreCollectionElementPropertyMapper extends BaseCollectionElementPropertyMapper {
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
/**
|
||||
* Copyright 2012-2017 Gunnar Morling (http://www.gunnarmorling.de/)
|
||||
* and/or other contributors as indicated by the @authors tag. See the
|
||||
* copyright.txt file in the distribution for a full listing of all
|
||||
* contributors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.mapstruct.ap.test.nestedbeans.unmappable.ignore;
|
||||
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.ReportingPolicy;
|
||||
import org.mapstruct.ap.test.nestedbeans.unmappable.BaseDeepListMapper;
|
||||
import org.mapstruct.ap.test.nestedbeans.unmappable.RoofTypeMapper;
|
||||
|
||||
@Mapper(uses = RoofTypeMapper.class, unmappedTargetPolicy = ReportingPolicy.IGNORE)
|
||||
public abstract class UnmappableIgnoreDeepListMapper extends BaseDeepListMapper {
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
/**
|
||||
* Copyright 2012-2017 Gunnar Morling (http://www.gunnarmorling.de/)
|
||||
* and/or other contributors as indicated by the @authors tag. See the
|
||||
* copyright.txt file in the distribution for a full listing of all
|
||||
* contributors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.mapstruct.ap.test.nestedbeans.unmappable.ignore;
|
||||
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.ReportingPolicy;
|
||||
import org.mapstruct.ap.test.nestedbeans.unmappable.BaseDeepMapKeyMapper;
|
||||
import org.mapstruct.ap.test.nestedbeans.unmappable.RoofTypeMapper;
|
||||
|
||||
@Mapper(uses = RoofTypeMapper.class, unmappedTargetPolicy = ReportingPolicy.IGNORE)
|
||||
public abstract class UnmappableIgnoreDeepMapKeyMapper extends BaseDeepMapKeyMapper {
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
/**
|
||||
* Copyright 2012-2017 Gunnar Morling (http://www.gunnarmorling.de/)
|
||||
* and/or other contributors as indicated by the @authors tag. See the
|
||||
* copyright.txt file in the distribution for a full listing of all
|
||||
* contributors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.mapstruct.ap.test.nestedbeans.unmappable.ignore;
|
||||
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.ReportingPolicy;
|
||||
import org.mapstruct.ap.test.nestedbeans.unmappable.BaseDeepMapValueMapper;
|
||||
import org.mapstruct.ap.test.nestedbeans.unmappable.RoofTypeMapper;
|
||||
|
||||
@Mapper(uses = RoofTypeMapper.class, unmappedTargetPolicy = ReportingPolicy.IGNORE)
|
||||
public abstract class UnmappableIgnoreDeepMapValueMapper extends BaseDeepMapValueMapper {
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
/**
|
||||
* Copyright 2012-2017 Gunnar Morling (http://www.gunnarmorling.de/)
|
||||
* and/or other contributors as indicated by the @authors tag. See the
|
||||
* copyright.txt file in the distribution for a full listing of all
|
||||
* contributors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.mapstruct.ap.test.nestedbeans.unmappable.ignore;
|
||||
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.ReportingPolicy;
|
||||
import org.mapstruct.ap.test.nestedbeans.unmappable.BaseDeepNestingMapper;
|
||||
import org.mapstruct.ap.test.nestedbeans.unmappable.RoofTypeMapper;
|
||||
|
||||
@Mapper(uses = RoofTypeMapper.class, unmappedTargetPolicy = ReportingPolicy.IGNORE)
|
||||
public abstract class UnmappableIgnoreDeepNestingMapper extends BaseDeepNestingMapper {
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
/**
|
||||
* Copyright 2012-2017 Gunnar Morling (http://www.gunnarmorling.de/)
|
||||
* and/or other contributors as indicated by the @authors tag. See the
|
||||
* copyright.txt file in the distribution for a full listing of all
|
||||
* contributors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.mapstruct.ap.test.nestedbeans.unmappable.ignore;
|
||||
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.ReportingPolicy;
|
||||
import org.mapstruct.ap.test.nestedbeans.unmappable.BaseValuePropertyMapper;
|
||||
import org.mapstruct.ap.test.nestedbeans.unmappable.RoofTypeMapper;
|
||||
|
||||
@Mapper(uses = RoofTypeMapper.class, unmappedTargetPolicy = ReportingPolicy.IGNORE)
|
||||
public abstract class UnmappableIgnoreValuePropertyMapper extends BaseValuePropertyMapper {
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
/**
|
||||
* Copyright 2012-2017 Gunnar Morling (http://www.gunnarmorling.de/)
|
||||
* and/or other contributors as indicated by the @authors tag. See the
|
||||
* copyright.txt file in the distribution for a full listing of all
|
||||
* contributors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.mapstruct.ap.test.nestedbeans.unmappable.warn;
|
||||
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.ap.test.nestedbeans.unmappable.BaseCollectionElementPropertyMapper;
|
||||
import org.mapstruct.ap.test.nestedbeans.unmappable.RoofTypeMapper;
|
||||
|
||||
@Mapper(uses = RoofTypeMapper.class)
|
||||
public abstract class UnmappableWarnCollectionElementPropertyMapper extends BaseCollectionElementPropertyMapper {
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
/**
|
||||
* Copyright 2012-2017 Gunnar Morling (http://www.gunnarmorling.de/)
|
||||
* and/or other contributors as indicated by the @authors tag. See the
|
||||
* copyright.txt file in the distribution for a full listing of all
|
||||
* contributors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.mapstruct.ap.test.nestedbeans.unmappable.warn;
|
||||
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.ap.test.nestedbeans.unmappable.BaseDeepListMapper;
|
||||
import org.mapstruct.ap.test.nestedbeans.unmappable.RoofTypeMapper;
|
||||
|
||||
@Mapper(uses = RoofTypeMapper.class)
|
||||
public abstract class UnmappableWarnDeepListMapper extends BaseDeepListMapper {
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
/**
|
||||
* Copyright 2012-2017 Gunnar Morling (http://www.gunnarmorling.de/)
|
||||
* and/or other contributors as indicated by the @authors tag. See the
|
||||
* copyright.txt file in the distribution for a full listing of all
|
||||
* contributors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.mapstruct.ap.test.nestedbeans.unmappable.warn;
|
||||
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.ap.test.nestedbeans.unmappable.BaseDeepMapKeyMapper;
|
||||
import org.mapstruct.ap.test.nestedbeans.unmappable.RoofTypeMapper;
|
||||
|
||||
@Mapper(uses = RoofTypeMapper.class)
|
||||
public abstract class UnmappableWarnDeepMapKeyMapper extends BaseDeepMapKeyMapper {
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
/**
|
||||
* Copyright 2012-2017 Gunnar Morling (http://www.gunnarmorling.de/)
|
||||
* and/or other contributors as indicated by the @authors tag. See the
|
||||
* copyright.txt file in the distribution for a full listing of all
|
||||
* contributors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.mapstruct.ap.test.nestedbeans.unmappable.warn;
|
||||
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.ap.test.nestedbeans.unmappable.BaseDeepMapValueMapper;
|
||||
import org.mapstruct.ap.test.nestedbeans.unmappable.RoofTypeMapper;
|
||||
|
||||
@Mapper(uses = RoofTypeMapper.class)
|
||||
public abstract class UnmappableWarnDeepMapValueMapper extends BaseDeepMapValueMapper {
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
/**
|
||||
* Copyright 2012-2017 Gunnar Morling (http://www.gunnarmorling.de/)
|
||||
* and/or other contributors as indicated by the @authors tag. See the
|
||||
* copyright.txt file in the distribution for a full listing of all
|
||||
* contributors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.mapstruct.ap.test.nestedbeans.unmappable.warn;
|
||||
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.ap.test.nestedbeans.unmappable.BaseDeepNestingMapper;
|
||||
import org.mapstruct.ap.test.nestedbeans.unmappable.RoofTypeMapper;
|
||||
|
||||
@Mapper(uses = RoofTypeMapper.class)
|
||||
public abstract class UnmappableWarnDeepNestingMapper extends BaseDeepNestingMapper {
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
/**
|
||||
* Copyright 2012-2017 Gunnar Morling (http://www.gunnarmorling.de/)
|
||||
* and/or other contributors as indicated by the @authors tag. See the
|
||||
* copyright.txt file in the distribution for a full listing of all
|
||||
* contributors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.mapstruct.ap.test.nestedbeans.unmappable.warn;
|
||||
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.ap.test.nestedbeans.unmappable.BaseValuePropertyMapper;
|
||||
import org.mapstruct.ap.test.nestedbeans.unmappable.RoofTypeMapper;
|
||||
|
||||
@Mapper(uses = RoofTypeMapper.class)
|
||||
public abstract class UnmappableWarnValuePropertyMapper extends BaseValuePropertyMapper {
|
||||
}
|
@ -29,9 +29,9 @@ import org.mapstruct.factory.Mappers;
|
||||
* @author Sjaak Derksen
|
||||
*/
|
||||
@Mapper( uses = DepartmentEntityFactory.class )
|
||||
public interface ErroneousCompanyMapper1 {
|
||||
public interface CompanyMapper1 {
|
||||
|
||||
ErroneousCompanyMapper1 INSTANCE = Mappers.getMapper( ErroneousCompanyMapper1.class );
|
||||
CompanyMapper1 INSTANCE = Mappers.getMapper( CompanyMapper1.class );
|
||||
|
||||
void toCompanyEntity(UnmappableCompanyDto dto, @MappingTarget CompanyEntity entity);
|
||||
|
@ -190,21 +190,23 @@ public class UpdateMethodsTest {
|
||||
|
||||
@Test
|
||||
@WithClasses( {
|
||||
ErroneousCompanyMapper1.class,
|
||||
CompanyMapper1.class,
|
||||
DepartmentInBetween.class,
|
||||
UnmappableCompanyDto.class,
|
||||
UnmappableDepartmentDto.class
|
||||
|
||||
} )
|
||||
@ExpectedCompilationOutcome(
|
||||
value = CompilationResult.FAILED,
|
||||
value = CompilationResult.SUCCEEDED,
|
||||
diagnostics = {
|
||||
@Diagnostic(type = ErroneousCompanyMapper1.class,
|
||||
kind = javax.tools.Diagnostic.Kind.ERROR,
|
||||
@Diagnostic(type = CompanyMapper1.class,
|
||||
kind = javax.tools.Diagnostic.Kind.WARNING,
|
||||
line = 36,
|
||||
messageRegExp = "Can't map property \".*UnmappableDepartmentDto department\" to \".*DepartmentEntity " +
|
||||
"department.")
|
||||
messageRegExp = "Unmapped target property: \"employees\"\\. Mapping from property \"" +
|
||||
".*UnmappableDepartmentDto department\" to \".*DepartmentEntity department.")
|
||||
}
|
||||
)
|
||||
public void testShouldFailOnTwoNestedUpdateMethods() { }
|
||||
public void testShouldNotUseTwoNestedUpdateMethods() {
|
||||
generatedSource.addComparisonToFixtureFor( CompanyMapper1.class );
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,52 @@
|
||||
/**
|
||||
* Copyright 2012-2017 Gunnar Morling (http://www.gunnarmorling.de/)
|
||||
* and/or other contributors as indicated by the @authors tag. See the
|
||||
* copyright.txt file in the distribution for a full listing of all
|
||||
* contributors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.mapstruct.ap.test.accessibility.referenced;
|
||||
|
||||
import javax.annotation.Generated;
|
||||
|
||||
@Generated(
|
||||
value = "org.mapstruct.ap.MappingProcessor",
|
||||
date = "2017-03-13T22:39:43+0100",
|
||||
comments = "version: , compiler: javac, environment: Java 1.8.0_121 (Oracle Corporation)"
|
||||
)
|
||||
public class AbstractSourceTargetMapperPrivateImpl extends AbstractSourceTargetMapperPrivate {
|
||||
|
||||
@Override
|
||||
public Target toTarget(Source source) {
|
||||
if ( source == null ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
Target target = new Target();
|
||||
|
||||
target.setReferencedTarget( referencedSourceToReferencedTarget( source.getReferencedSource() ) );
|
||||
|
||||
return target;
|
||||
}
|
||||
|
||||
protected ReferencedTarget referencedSourceToReferencedTarget(ReferencedSource referencedSource) {
|
||||
if ( referencedSource == null ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
ReferencedTarget referencedTarget = new ReferencedTarget();
|
||||
|
||||
return referencedTarget;
|
||||
}
|
||||
}
|
@ -0,0 +1,52 @@
|
||||
/**
|
||||
* Copyright 2012-2017 Gunnar Morling (http://www.gunnarmorling.de/)
|
||||
* and/or other contributors as indicated by the @authors tag. See the
|
||||
* copyright.txt file in the distribution for a full listing of all
|
||||
* contributors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.mapstruct.ap.test.accessibility.referenced;
|
||||
|
||||
import javax.annotation.Generated;
|
||||
|
||||
@Generated(
|
||||
value = "org.mapstruct.ap.MappingProcessor",
|
||||
date = "2017-03-13T22:39:39+0100",
|
||||
comments = "version: , compiler: javac, environment: Java 1.8.0_121 (Oracle Corporation)"
|
||||
)
|
||||
public class SourceTargetMapperDefaultOtherImpl implements SourceTargetMapperDefaultOther {
|
||||
|
||||
@Override
|
||||
public Target toTarget(Source source) {
|
||||
if ( source == null ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
Target target = new Target();
|
||||
|
||||
target.setReferencedTarget( referencedSourceToReferencedTarget( source.getReferencedSource() ) );
|
||||
|
||||
return target;
|
||||
}
|
||||
|
||||
protected ReferencedTarget referencedSourceToReferencedTarget(ReferencedSource referencedSource) {
|
||||
if ( referencedSource == null ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
ReferencedTarget referencedTarget = new ReferencedTarget();
|
||||
|
||||
return referencedTarget;
|
||||
}
|
||||
}
|
@ -0,0 +1,52 @@
|
||||
/**
|
||||
* Copyright 2012-2017 Gunnar Morling (http://www.gunnarmorling.de/)
|
||||
* and/or other contributors as indicated by the @authors tag. See the
|
||||
* copyright.txt file in the distribution for a full listing of all
|
||||
* contributors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.mapstruct.ap.test.accessibility.referenced;
|
||||
|
||||
import javax.annotation.Generated;
|
||||
|
||||
@Generated(
|
||||
value = "org.mapstruct.ap.MappingProcessor",
|
||||
date = "2017-03-13T22:39:36+0100",
|
||||
comments = "version: , compiler: javac, environment: Java 1.8.0_121 (Oracle Corporation)"
|
||||
)
|
||||
public class SourceTargetMapperPrivateImpl implements SourceTargetMapperPrivate {
|
||||
|
||||
@Override
|
||||
public Target toTarget(Source source) {
|
||||
if ( source == null ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
Target target = new Target();
|
||||
|
||||
target.setReferencedTarget( referencedSourceToReferencedTarget( source.getReferencedSource() ) );
|
||||
|
||||
return target;
|
||||
}
|
||||
|
||||
protected ReferencedTarget referencedSourceToReferencedTarget(ReferencedSource referencedSource) {
|
||||
if ( referencedSource == null ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
ReferencedTarget referencedTarget = new ReferencedTarget();
|
||||
|
||||
return referencedTarget;
|
||||
}
|
||||
}
|
@ -0,0 +1,133 @@
|
||||
/**
|
||||
* Copyright 2012-2017 Gunnar Morling (http://www.gunnarmorling.de/)
|
||||
* and/or other contributors as indicated by the @authors tag. See the
|
||||
* copyright.txt file in the distribution for a full listing of all
|
||||
* contributors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.mapstruct.ap.test.updatemethods;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import javax.annotation.Generated;
|
||||
|
||||
@Generated(
|
||||
value = "org.mapstruct.ap.MappingProcessor",
|
||||
date = "2017-03-13T22:32:15+0100",
|
||||
comments = "version: , compiler: javac, environment: Java 1.8.0_121 (Oracle Corporation)"
|
||||
)
|
||||
public class CompanyMapper1Impl implements CompanyMapper1 {
|
||||
|
||||
private final DepartmentEntityFactory departmentEntityFactory = new DepartmentEntityFactory();
|
||||
|
||||
@Override
|
||||
public void toCompanyEntity(UnmappableCompanyDto dto, CompanyEntity entity) {
|
||||
if ( dto == null ) {
|
||||
return;
|
||||
}
|
||||
|
||||
entity.setName( dto.getName() );
|
||||
if ( dto.getDepartment() != null ) {
|
||||
if ( entity.getDepartment() == null ) {
|
||||
entity.setDepartment( departmentEntityFactory.createDepartmentEntity() );
|
||||
}
|
||||
unmappableDepartmentDtoToDepartmentEntity( dto.getDepartment(), entity.getDepartment() );
|
||||
}
|
||||
else {
|
||||
entity.setDepartment( null );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void toInBetween(UnmappableDepartmentDto dto, DepartmentInBetween entity) {
|
||||
if ( dto == null ) {
|
||||
return;
|
||||
}
|
||||
|
||||
entity.setName( dto.getName() );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void toDepartmentEntity(DepartmentInBetween dto, DepartmentEntity entity) {
|
||||
if ( dto == null ) {
|
||||
return;
|
||||
}
|
||||
|
||||
entity.setName( dto.getName() );
|
||||
}
|
||||
|
||||
protected SecretaryEntity secretaryDtoToSecretaryEntity(SecretaryDto secretaryDto) {
|
||||
if ( secretaryDto == null ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
SecretaryEntity secretaryEntity = new SecretaryEntity();
|
||||
|
||||
secretaryEntity.setName( secretaryDto.getName() );
|
||||
|
||||
return secretaryEntity;
|
||||
}
|
||||
|
||||
protected EmployeeEntity employeeDtoToEmployeeEntity(EmployeeDto employeeDto) {
|
||||
if ( employeeDto == null ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
EmployeeEntity employeeEntity = new EmployeeEntity();
|
||||
|
||||
employeeEntity.setName( employeeDto.getName() );
|
||||
|
||||
return employeeEntity;
|
||||
}
|
||||
|
||||
protected Map<SecretaryEntity, EmployeeEntity> secretaryDtoEmployeeDtoMapToSecretaryEntityEmployeeEntityMap(Map<SecretaryDto, EmployeeDto> map) {
|
||||
if ( map == null ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
Map<SecretaryEntity, EmployeeEntity> map1 = new HashMap<SecretaryEntity, EmployeeEntity>();
|
||||
|
||||
for ( java.util.Map.Entry<SecretaryDto, EmployeeDto> entry : map.entrySet() ) {
|
||||
SecretaryEntity key = secretaryDtoToSecretaryEntity( entry.getKey() );
|
||||
EmployeeEntity value = employeeDtoToEmployeeEntity( entry.getValue() );
|
||||
map1.put( key, value );
|
||||
}
|
||||
|
||||
return map1;
|
||||
}
|
||||
|
||||
protected void unmappableDepartmentDtoToDepartmentEntity(UnmappableDepartmentDto unmappableDepartmentDto, DepartmentEntity mappingTarget) {
|
||||
if ( unmappableDepartmentDto == null ) {
|
||||
return;
|
||||
}
|
||||
|
||||
mappingTarget.setName( unmappableDepartmentDto.getName() );
|
||||
if ( mappingTarget.getSecretaryToEmployee() != null ) {
|
||||
Map<SecretaryEntity, EmployeeEntity> map = secretaryDtoEmployeeDtoMapToSecretaryEntityEmployeeEntityMap( unmappableDepartmentDto.getSecretaryToEmployee() );
|
||||
if ( map != null ) {
|
||||
mappingTarget.getSecretaryToEmployee().clear();
|
||||
mappingTarget.getSecretaryToEmployee().putAll( map );
|
||||
}
|
||||
else {
|
||||
mappingTarget.setSecretaryToEmployee( null );
|
||||
}
|
||||
}
|
||||
else {
|
||||
Map<SecretaryEntity, EmployeeEntity> map = secretaryDtoEmployeeDtoMapToSecretaryEntityEmployeeEntityMap( unmappableDepartmentDto.getSecretaryToEmployee() );
|
||||
if ( map != null ) {
|
||||
mappingTarget.setSecretaryToEmployee( map );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user