mirror of
https://github.com/mapstruct/mapstruct.git
synced 2025-07-12 00:00:08 +08:00
#1057 Add reproducer tests
This commit is contained in:
parent
8dbcc43a8e
commit
bdbee40dcf
@ -0,0 +1,281 @@
|
||||
/**
|
||||
* 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.mixed;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mapstruct.ap.test.nestedbeans.mixed._target.FishDto;
|
||||
import org.mapstruct.ap.test.nestedbeans.mixed._target.FishTankDto;
|
||||
import org.mapstruct.ap.test.nestedbeans.mixed._target.FishTankWithNestedDocumentDto;
|
||||
import org.mapstruct.ap.test.nestedbeans.mixed._target.MaterialDto;
|
||||
import org.mapstruct.ap.test.nestedbeans.mixed._target.MaterialTypeDto;
|
||||
import org.mapstruct.ap.test.nestedbeans.mixed._target.OrnamentDto;
|
||||
import org.mapstruct.ap.test.nestedbeans.mixed._target.WaterPlantDto;
|
||||
import org.mapstruct.ap.test.nestedbeans.mixed._target.WaterQualityDto;
|
||||
import org.mapstruct.ap.test.nestedbeans.mixed._target.WaterQualityOrganisationDto;
|
||||
import org.mapstruct.ap.test.nestedbeans.mixed._target.WaterQualityReportDto;
|
||||
import org.mapstruct.ap.test.nestedbeans.mixed._target.WaterQualityWithDocumentDto;
|
||||
import org.mapstruct.ap.test.nestedbeans.mixed.source.Fish;
|
||||
import org.mapstruct.ap.test.nestedbeans.mixed.source.FishTank;
|
||||
import org.mapstruct.ap.test.nestedbeans.mixed.source.Interior;
|
||||
import org.mapstruct.ap.test.nestedbeans.mixed.source.MaterialType;
|
||||
import org.mapstruct.ap.test.nestedbeans.mixed.source.Ornament;
|
||||
import org.mapstruct.ap.test.nestedbeans.mixed.source.WaterPlant;
|
||||
import org.mapstruct.ap.test.nestedbeans.mixed.source.WaterQuality;
|
||||
import org.mapstruct.ap.test.nestedbeans.mixed.source.WaterQualityReport;
|
||||
import org.mapstruct.ap.testutil.IssueKey;
|
||||
import org.mapstruct.ap.testutil.WithClasses;
|
||||
import org.mapstruct.ap.testutil.runner.AnnotationProcessorTestRunner;
|
||||
import org.mapstruct.ap.testutil.runner.GeneratedSource;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Sjaak Derksen
|
||||
*/
|
||||
@WithClasses({
|
||||
FishDto.class,
|
||||
FishTankDto.class,
|
||||
WaterPlantDto.class,
|
||||
MaterialDto.class,
|
||||
MaterialTypeDto.class,
|
||||
OrnamentDto.class,
|
||||
WaterQualityDto.class,
|
||||
WaterQualityReportDto.class,
|
||||
WaterQualityOrganisationDto.class,
|
||||
Fish.class,
|
||||
FishTank.class,
|
||||
WaterPlant.class,
|
||||
MaterialType.class,
|
||||
Interior.class,
|
||||
Ornament.class,
|
||||
WaterQuality.class,
|
||||
WaterQualityReport.class,
|
||||
FishTankWithNestedDocumentDto.class,
|
||||
WaterQualityWithDocumentDto.class,
|
||||
FishTankMapper.class,
|
||||
FishTankMapperConstant.class,
|
||||
FishTankMapperExpression.class,
|
||||
FishTankMapperWithDocument.class
|
||||
})
|
||||
@IssueKey("1057")
|
||||
@RunWith(AnnotationProcessorTestRunner.class)
|
||||
public class AutomappingAndNestedTest {
|
||||
|
||||
@Rule
|
||||
public GeneratedSource generatedSource = new GeneratedSource().addComparisonToFixtureFor(
|
||||
FishTankMapperConstant.class
|
||||
);
|
||||
|
||||
@Test
|
||||
public void shouldAutomapAndHandleSourceAndTargetPropertyNesting() {
|
||||
|
||||
// -- prepare
|
||||
FishTank source = createFishTank();
|
||||
|
||||
// -- action
|
||||
FishTankDto target = FishTankMapper.INSTANCE.map( source );
|
||||
|
||||
// -- result
|
||||
assertThat( target.getName() ).isEqualTo( source.getName() );
|
||||
|
||||
// fish and fishDto can be automapped
|
||||
assertThat( target.getFish() ).isNotNull();
|
||||
assertThat( target.getFish().getKind() ).isEqualTo( source.getFish().getType() );
|
||||
assertThat( target.getFish().getName() ).isNull();
|
||||
|
||||
// automapping takes care of mapping property "waterPlant".
|
||||
assertThat( target.getPlant() ).isNotNull();
|
||||
assertThat( target.getPlant().getKind() ).isEqualTo( source.getPlant().getKind() );
|
||||
|
||||
// ornament (nested asymetric source)
|
||||
assertThat( target.getOrnament() ).isNotNull();
|
||||
assertThat( target.getOrnament().getType() ).isEqualTo( source.getInterior().getOrnament().getType() );
|
||||
|
||||
// material (nested asymetric target)
|
||||
assertThat( target.getMaterial() ).isNotNull();
|
||||
assertThat( target.getMaterial().getManufacturer() ).isNull();
|
||||
assertThat( target.getMaterial().getMaterialType() ).isNotNull();
|
||||
assertThat( target.getMaterial().getMaterialType().getType() ).isEqualTo( source.getMaterial().getType() );
|
||||
|
||||
// first symetric then asymetric
|
||||
assertThat( target.getQuality() ).isNotNull();
|
||||
assertThat( target.getQuality().getReport() ).isNotNull();
|
||||
assertThat( target.getQuality().getReport().getVerdict() )
|
||||
.isEqualTo( source.getQuality().getReport().getVerdict() );
|
||||
assertThat( target.getQuality().getReport().getOrganisation().getApproval() ).isNull();
|
||||
assertThat( target.getQuality().getReport().getOrganisation() ).isNotNull();
|
||||
assertThat( target.getQuality().getReport().getOrganisation().getName() )
|
||||
.isEqualTo( source.getQuality().getReport().getOrganisationName() );
|
||||
}
|
||||
|
||||
@Test
|
||||
public void shouldAutomapAndHandleSourceAndTargetPropertyNestingReverse() {
|
||||
|
||||
// -- prepare
|
||||
FishTank source = createFishTank();
|
||||
|
||||
// -- action
|
||||
FishTankDto target = FishTankMapper.INSTANCE.map( source );
|
||||
FishTank source2 = FishTankMapper.INSTANCE.map( target );
|
||||
|
||||
// -- result
|
||||
assertThat( source2.getName() ).isEqualTo( source.getName() );
|
||||
|
||||
// fish
|
||||
assertThat( source2.getFish() ).isNotNull();
|
||||
assertThat( source2.getFish().getType() ).isEqualTo( source.getFish().getType() );
|
||||
|
||||
// interior, designer will not be mapped (asymetric) to target. Here it shows.
|
||||
assertThat( source2.getInterior() ).isNotNull();
|
||||
assertThat( source2.getInterior().getDesigner() ).isNull();
|
||||
assertThat( source2.getInterior().getOrnament() ).isNotNull();
|
||||
assertThat( source2.getInterior().getOrnament().getType() )
|
||||
.isEqualTo( source.getInterior().getOrnament().getType() );
|
||||
|
||||
// material
|
||||
assertThat( source2.getMaterial() ).isNotNull();
|
||||
assertThat( source2.getMaterial().getType() ).isEqualTo( source.getMaterial().getType() );
|
||||
|
||||
// plant
|
||||
assertThat( source2.getPlant().getKind() ).isEqualTo( source.getPlant().getKind() );
|
||||
|
||||
// quality
|
||||
assertThat( source2.getQuality().getReport() ).isNotNull();
|
||||
assertThat( source2.getQuality().getReport().getOrganisationName() )
|
||||
.isEqualTo( source.getQuality().getReport().getOrganisationName() );
|
||||
assertThat( source2.getQuality().getReport().getVerdict() )
|
||||
.isEqualTo( source.getQuality().getReport().getVerdict() );
|
||||
}
|
||||
|
||||
@Test
|
||||
public void shouldAutomapAndHandleSourceAndTargetPropertyNestingAndConstant() {
|
||||
|
||||
// -- prepare
|
||||
FishTank source = createFishTank();
|
||||
|
||||
// -- action
|
||||
FishTankDto target = FishTankMapperConstant.INSTANCE.map( source );
|
||||
|
||||
// -- result
|
||||
|
||||
// fixed value
|
||||
assertThat( target.getFish().getName() ).isEqualTo( "Nemo" );
|
||||
|
||||
// automapping takes care of mapping property "waterPlant".
|
||||
assertThat( target.getPlant() ).isNotNull();
|
||||
assertThat( target.getPlant().getKind() ).isEqualTo( source.getPlant().getKind() );
|
||||
|
||||
// non-nested and constant
|
||||
assertThat( target.getMaterial() ).isNotNull();
|
||||
assertThat( target.getMaterial().getManufacturer() ).isEqualTo( "MMM" );
|
||||
assertThat( target.getMaterial().getMaterialType() ).isNotNull();
|
||||
assertThat( target.getMaterial().getMaterialType().getType() ).isEqualTo( source.getMaterial().getType() );
|
||||
|
||||
assertThat( target.getOrnament() ).isNull();
|
||||
assertThat( target.getQuality() ).isNull();
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void shouldAutomapAndHandleSourceAndTargetPropertyNestingAndExpresion() {
|
||||
|
||||
// -- prepare
|
||||
FishTank source = createFishTank();
|
||||
|
||||
// -- action
|
||||
FishTankDto target = FishTankMapperExpression.INSTANCE.map( source );
|
||||
|
||||
// -- result
|
||||
assertThat( target.getFish().getName() ).isEqualTo( "Jaws" );
|
||||
|
||||
assertThat( target.getMaterial() ).isNull();
|
||||
assertThat( target.getOrnament() ).isNull();
|
||||
assertThat( target.getPlant() ).isNull();
|
||||
|
||||
assertThat( target.getQuality() ).isNotNull();
|
||||
assertThat( target.getQuality().getReport() ).isNotNull();
|
||||
assertThat( target.getQuality().getReport().getVerdict() )
|
||||
.isEqualTo( source.getQuality().getReport().getVerdict() );
|
||||
assertThat( target.getQuality().getReport().getOrganisation() ).isNotNull();
|
||||
assertThat( target.getQuality().getReport().getOrganisation().getApproval() ).isNull();
|
||||
assertThat( target.getQuality().getReport().getOrganisation().getName() ).isEqualTo( "Dunno" );
|
||||
}
|
||||
|
||||
@Test
|
||||
public void shouldAutomapIntermediateLevelAndMapConstant() {
|
||||
|
||||
// -- prepare
|
||||
FishTank source = createFishTank();
|
||||
|
||||
// -- action
|
||||
FishTankWithNestedDocumentDto target = FishTankMapperWithDocument.INSTANCE.map( source );
|
||||
|
||||
// -- result
|
||||
assertThat( target.getFish().getName() ).isEqualTo( "Jaws" );
|
||||
|
||||
assertThat( target.getMaterial() ).isNull();
|
||||
assertThat( target.getOrnament() ).isNull();
|
||||
assertThat( target.getPlant() ).isNull();
|
||||
|
||||
assertThat( target.getQuality() ).isNotNull();
|
||||
assertThat( target.getQuality().getDocument() ).isNotNull();
|
||||
assertThat( target.getQuality().getDocument().getVerdict() )
|
||||
.isEqualTo( source.getQuality().getReport().getVerdict() );
|
||||
assertThat( target.getQuality().getDocument().getOrganisation() ).isNotNull();
|
||||
assertThat( target.getQuality().getDocument().getOrganisation().getApproval() ).isNull();
|
||||
assertThat( target.getQuality().getDocument().getOrganisation().getName() ).isEqualTo( "NoIdeaInc" );
|
||||
}
|
||||
|
||||
private FishTank createFishTank() {
|
||||
FishTank fishTank = new FishTank();
|
||||
|
||||
Fish fish = new Fish();
|
||||
fish.setType( "Carp" );
|
||||
|
||||
WaterPlant waterplant = new WaterPlant();
|
||||
waterplant.setKind( "Water Hyacinth" );
|
||||
|
||||
Interior interior = new Interior();
|
||||
interior.setDesigner( "MrVeryFamous" );
|
||||
Ornament ornament = new Ornament();
|
||||
ornament.setType( "castle" );
|
||||
interior.setOrnament( ornament );
|
||||
|
||||
WaterQuality quality = new WaterQuality();
|
||||
WaterQualityReport report = new WaterQualityReport();
|
||||
report.setVerdict( "PASSED" );
|
||||
report.setOrganisationName( "ACME" );
|
||||
quality.setReport( report );
|
||||
|
||||
MaterialType materialType = new MaterialType();
|
||||
materialType.setType( "myMaterialType" );
|
||||
|
||||
fishTank.setName( "MyLittleFishTank" );
|
||||
fishTank.setFish( fish );
|
||||
fishTank.setPlant( waterplant );
|
||||
fishTank.setInterior( interior );
|
||||
fishTank.setMaterial( materialType );
|
||||
fishTank.setQuality( quality );
|
||||
|
||||
return fishTank;
|
||||
}
|
||||
}
|
@ -0,0 +1,59 @@
|
||||
/**
|
||||
* 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.mixed;
|
||||
|
||||
import org.mapstruct.InheritInverseConfiguration;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.Mapping;
|
||||
import org.mapstruct.Mappings;
|
||||
import org.mapstruct.ap.test.nestedbeans.mixed._target.FishTankDto;
|
||||
import org.mapstruct.ap.test.nestedbeans.mixed.source.FishTank;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Sjaak Derksen
|
||||
*/
|
||||
@Mapper
|
||||
public interface FishTankMapper {
|
||||
|
||||
FishTankMapper INSTANCE = Mappers.getMapper( FishTankMapper.class );
|
||||
|
||||
@Mappings({
|
||||
@Mapping(target = "fish.kind", source = "fish.type"),
|
||||
@Mapping(target = "fish.name", ignore = true),
|
||||
@Mapping(target = "ornament", source = "interior.ornament"),
|
||||
@Mapping(target = "material.materialType", source = "material"),
|
||||
@Mapping(target = "quality.report.organisation.name", source = "quality.report.organisationName")
|
||||
})
|
||||
FishTankDto map( FishTank source );
|
||||
|
||||
@Mappings({
|
||||
@Mapping(target = "fish.kind", source = "source.fish.type"),
|
||||
@Mapping(target = "fish.name", ignore = true),
|
||||
@Mapping(target = "ornament", source = "source.interior.ornament"),
|
||||
@Mapping(target = "material.materialType", source = "source.material"),
|
||||
@Mapping(target = "quality.report.organisation.name", source = "source.quality.report.organisationName")
|
||||
})
|
||||
FishTankDto mapAsWell( FishTank source );
|
||||
|
||||
@InheritInverseConfiguration( name = "map" )
|
||||
FishTank map( FishTankDto source );
|
||||
|
||||
}
|
@ -0,0 +1,47 @@
|
||||
/**
|
||||
* 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.mixed;
|
||||
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.Mapping;
|
||||
import org.mapstruct.Mappings;
|
||||
import org.mapstruct.ap.test.nestedbeans.mixed._target.FishTankDto;
|
||||
import org.mapstruct.ap.test.nestedbeans.mixed.source.FishTank;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Sjaak Derksen
|
||||
*/
|
||||
@Mapper
|
||||
public interface FishTankMapperConstant {
|
||||
|
||||
FishTankMapperConstant INSTANCE = Mappers.getMapper( FishTankMapperConstant.class );
|
||||
|
||||
@Mappings({
|
||||
@Mapping(target = "fish.kind", source = "fish.type"),
|
||||
@Mapping(target = "fish.name", constant = "Nemo"),
|
||||
@Mapping(target = "ornament", ignore = true ),
|
||||
@Mapping(target = "material.materialType", source = "material"),
|
||||
@Mapping(target = "material.manufacturer", constant = "MMM" ),
|
||||
@Mapping(target = "quality", ignore = true)
|
||||
})
|
||||
FishTankDto map( FishTank source );
|
||||
|
||||
}
|
@ -0,0 +1,47 @@
|
||||
/**
|
||||
* 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.mixed;
|
||||
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.Mapping;
|
||||
import org.mapstruct.Mappings;
|
||||
import org.mapstruct.ap.test.nestedbeans.mixed._target.FishTankDto;
|
||||
import org.mapstruct.ap.test.nestedbeans.mixed.source.FishTank;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Sjaak Derksen
|
||||
*/
|
||||
@Mapper
|
||||
public interface FishTankMapperExpression {
|
||||
|
||||
FishTankMapperExpression INSTANCE = Mappers.getMapper( FishTankMapperExpression.class );
|
||||
|
||||
@Mappings({
|
||||
@Mapping(target = "fish.kind", source = "fish.type"),
|
||||
@Mapping(target = "fish.name", expression = "java(\"Jaws\")"),
|
||||
@Mapping(target = "plant", ignore = true ),
|
||||
@Mapping(target = "ornament", ignore = true ),
|
||||
@Mapping(target = "material", ignore = true),
|
||||
@Mapping(target = "quality.report.organisation.name", expression = "java(\"Dunno\")" )
|
||||
})
|
||||
FishTankDto map( FishTank source );
|
||||
|
||||
}
|
@ -0,0 +1,48 @@
|
||||
/**
|
||||
* 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.mixed;
|
||||
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.Mapping;
|
||||
import org.mapstruct.Mappings;
|
||||
import org.mapstruct.ap.test.nestedbeans.mixed._target.FishTankWithNestedDocumentDto;
|
||||
import org.mapstruct.ap.test.nestedbeans.mixed.source.FishTank;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Sjaak Derksen
|
||||
*/
|
||||
@Mapper
|
||||
public interface FishTankMapperWithDocument {
|
||||
|
||||
FishTankMapperWithDocument INSTANCE = Mappers.getMapper( FishTankMapperWithDocument.class );
|
||||
|
||||
@Mappings({
|
||||
@Mapping(target = "fish.kind", source = "fish.type"),
|
||||
@Mapping(target = "fish.name", expression = "java(\"Jaws\")"),
|
||||
@Mapping(target = "plant", ignore = true ),
|
||||
@Mapping(target = "ornament", ignore = true ),
|
||||
@Mapping(target = "material", ignore = true),
|
||||
@Mapping(target = "quality.document", source = "quality.report"),
|
||||
@Mapping(target = "quality.document.organisation.name", constant = "NoIdeaInc" )
|
||||
})
|
||||
FishTankWithNestedDocumentDto map( FishTank source );
|
||||
|
||||
}
|
@ -16,7 +16,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.mapstruct.ap.test.nestedtargetproperties._target;
|
||||
package org.mapstruct.ap.test.nestedbeans.mixed._target;
|
||||
|
||||
/**
|
||||
*
|
@ -0,0 +1,82 @@
|
||||
/**
|
||||
* 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.mixed._target;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Sjaak Derksen
|
||||
*/
|
||||
public class FishTankDto {
|
||||
|
||||
private FishDto fish;
|
||||
private WaterPlantDto plant;
|
||||
private String name;
|
||||
private MaterialDto material;
|
||||
private OrnamentDto ornament;
|
||||
private WaterQualityDto quality;
|
||||
|
||||
public FishDto getFish() {
|
||||
return fish;
|
||||
}
|
||||
|
||||
public void setFish(FishDto fish) {
|
||||
this.fish = fish;
|
||||
}
|
||||
|
||||
public WaterPlantDto getPlant() {
|
||||
return plant;
|
||||
}
|
||||
|
||||
public void setPlant(WaterPlantDto plant) {
|
||||
this.plant = plant;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public MaterialDto getMaterial() {
|
||||
return material;
|
||||
}
|
||||
|
||||
public void setMaterial(MaterialDto material) {
|
||||
this.material = material;
|
||||
}
|
||||
|
||||
public OrnamentDto getOrnament() {
|
||||
return ornament;
|
||||
}
|
||||
|
||||
public void setOrnament(OrnamentDto ornament) {
|
||||
this.ornament = ornament;
|
||||
}
|
||||
|
||||
public WaterQualityDto getQuality() {
|
||||
return quality;
|
||||
}
|
||||
|
||||
public void setQuality(WaterQualityDto quality) {
|
||||
this.quality = quality;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,82 @@
|
||||
/**
|
||||
* 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.mixed._target;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Sjaak Derksen
|
||||
*/
|
||||
public class FishTankWithNestedDocumentDto {
|
||||
|
||||
private FishDto fish;
|
||||
private WaterPlantDto plant;
|
||||
private String name;
|
||||
private MaterialDto material;
|
||||
private OrnamentDto ornament;
|
||||
private WaterQualityWithDocumentDto quality;
|
||||
|
||||
public FishDto getFish() {
|
||||
return fish;
|
||||
}
|
||||
|
||||
public void setFish(FishDto fish) {
|
||||
this.fish = fish;
|
||||
}
|
||||
|
||||
public WaterPlantDto getPlant() {
|
||||
return plant;
|
||||
}
|
||||
|
||||
public void setPlant(WaterPlantDto plant) {
|
||||
this.plant = plant;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public MaterialDto getMaterial() {
|
||||
return material;
|
||||
}
|
||||
|
||||
public void setMaterial(MaterialDto material) {
|
||||
this.material = material;
|
||||
}
|
||||
|
||||
public OrnamentDto getOrnament() {
|
||||
return ornament;
|
||||
}
|
||||
|
||||
public void setOrnament(OrnamentDto ornament) {
|
||||
this.ornament = ornament;
|
||||
}
|
||||
|
||||
public WaterQualityWithDocumentDto getQuality() {
|
||||
return quality;
|
||||
}
|
||||
|
||||
public void setQuality(WaterQualityWithDocumentDto quality) {
|
||||
this.quality = quality;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,46 @@
|
||||
/**
|
||||
* 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.mixed._target;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Sjaak Derksen
|
||||
*/
|
||||
public class MaterialDto {
|
||||
|
||||
private String manufacturer;
|
||||
private MaterialTypeDto materialType;
|
||||
|
||||
public String getManufacturer() {
|
||||
return manufacturer;
|
||||
}
|
||||
|
||||
public void setManufacturer(String manufacturer) {
|
||||
this.manufacturer = manufacturer;
|
||||
}
|
||||
|
||||
public MaterialTypeDto getMaterialType() {
|
||||
return materialType;
|
||||
}
|
||||
|
||||
public void setMaterialType(MaterialTypeDto materialType) {
|
||||
this.materialType = materialType;
|
||||
}
|
||||
|
||||
}
|
@ -16,31 +16,22 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.mapstruct.ap.test.nestedtargetproperties._target;
|
||||
package org.mapstruct.ap.test.nestedbeans.mixed._target;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Sjaak Derksen
|
||||
*/
|
||||
public class FishTankDto {
|
||||
public class MaterialTypeDto {
|
||||
|
||||
private FishDto fish;
|
||||
private WaterPlantDto plant;
|
||||
private String type;
|
||||
|
||||
public FishDto getFish() {
|
||||
return fish;
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setFish(FishDto fish) {
|
||||
this.fish = fish;
|
||||
}
|
||||
|
||||
public WaterPlantDto getPlant() {
|
||||
return plant;
|
||||
}
|
||||
|
||||
public void setPlant(WaterPlantDto plant) {
|
||||
this.plant = plant;
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
}
|
@ -16,23 +16,22 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.mapstruct.ap.test.nestedtargetproperties;
|
||||
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.Mapping;
|
||||
import org.mapstruct.ap.test.nestedtargetproperties._target.FishTankDto;
|
||||
import org.mapstruct.ap.test.nestedtargetproperties.source.FishTank;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
package org.mapstruct.ap.test.nestedbeans.mixed._target;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Sjaak Derksen
|
||||
*/
|
||||
@Mapper
|
||||
public interface FishTankMapper {
|
||||
public class OrnamentDto {
|
||||
|
||||
FishTankMapper INSTANCE = Mappers.getMapper( FishTankMapper.class );
|
||||
private String type;
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
@Mapping(target = "fish.kind", source = "fish.type")
|
||||
FishTankDto map( FishTank source );
|
||||
}
|
@ -16,7 +16,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.mapstruct.ap.test.nestedtargetproperties._target;
|
||||
package org.mapstruct.ap.test.nestedbeans.mixed._target;
|
||||
|
||||
/**
|
||||
*
|
@ -0,0 +1,37 @@
|
||||
/**
|
||||
* 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.mixed._target;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Sjaak Derksen
|
||||
*/
|
||||
public class WaterQualityDto {
|
||||
|
||||
private WaterQualityReportDto report;
|
||||
|
||||
public WaterQualityReportDto getReport() {
|
||||
return report;
|
||||
}
|
||||
|
||||
public void setReport(WaterQualityReportDto report) {
|
||||
this.report = report;
|
||||
}
|
||||
|
||||
}
|
@ -16,33 +16,16 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.mapstruct.ap.test.nestedtargetproperties.source;
|
||||
package org.mapstruct.ap.test.nestedbeans.mixed._target;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Sjaak Derksen
|
||||
*/
|
||||
public class FishTank {
|
||||
public class WaterQualityOrganisationDto {
|
||||
|
||||
private Fish fish;
|
||||
private WaterPlant plant;
|
||||
private String name;
|
||||
|
||||
public Fish getFish() {
|
||||
return fish;
|
||||
}
|
||||
|
||||
public void setFish(Fish fish) {
|
||||
this.fish = fish;
|
||||
}
|
||||
|
||||
public WaterPlant getPlant() {
|
||||
return plant;
|
||||
}
|
||||
|
||||
public void setPlant(WaterPlant plant) {
|
||||
this.plant = plant;
|
||||
}
|
||||
private String approval;
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
@ -52,4 +35,12 @@ public class FishTank {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getApproval() {
|
||||
return approval;
|
||||
}
|
||||
|
||||
public void setApproval(String approval) {
|
||||
this.approval = approval;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,46 @@
|
||||
/**
|
||||
* 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.mixed._target;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Sjaak Derksen
|
||||
*/
|
||||
public class WaterQualityReportDto {
|
||||
|
||||
private WaterQualityOrganisationDto organisation;
|
||||
private String verdict;
|
||||
|
||||
public WaterQualityOrganisationDto getOrganisation() {
|
||||
return organisation;
|
||||
}
|
||||
|
||||
public void setOrganisation(WaterQualityOrganisationDto organisation) {
|
||||
this.organisation = organisation;
|
||||
}
|
||||
|
||||
public String getVerdict() {
|
||||
return verdict;
|
||||
}
|
||||
|
||||
public void setVerdict(String verdict) {
|
||||
this.verdict = verdict;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,37 @@
|
||||
/**
|
||||
* 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.mixed._target;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Sjaak Derksen
|
||||
*/
|
||||
public class WaterQualityWithDocumentDto {
|
||||
|
||||
private WaterQualityReportDto document;
|
||||
|
||||
public WaterQualityReportDto getDocument() {
|
||||
return document;
|
||||
}
|
||||
|
||||
public void setDocument(WaterQualityReportDto document) {
|
||||
this.document = document;
|
||||
}
|
||||
|
||||
}
|
@ -16,7 +16,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.mapstruct.ap.test.nestedtargetproperties.source;
|
||||
package org.mapstruct.ap.test.nestedbeans.mixed.source;
|
||||
|
||||
/**
|
||||
*
|
@ -0,0 +1,82 @@
|
||||
/**
|
||||
* 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.mixed.source;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Sjaak Derksen
|
||||
*/
|
||||
public class FishTank {
|
||||
|
||||
private Fish fish;
|
||||
private WaterPlant plant;
|
||||
private String name;
|
||||
private MaterialType material;
|
||||
private Interior interior;
|
||||
private WaterQuality quality;
|
||||
|
||||
public Fish getFish() {
|
||||
return fish;
|
||||
}
|
||||
|
||||
public void setFish(Fish fish) {
|
||||
this.fish = fish;
|
||||
}
|
||||
|
||||
public WaterPlant getPlant() {
|
||||
return plant;
|
||||
}
|
||||
|
||||
public void setPlant(WaterPlant plant) {
|
||||
this.plant = plant;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public MaterialType getMaterial() {
|
||||
return material;
|
||||
}
|
||||
|
||||
public void setMaterial(MaterialType material) {
|
||||
this.material = material;
|
||||
}
|
||||
|
||||
public Interior getInterior() {
|
||||
return interior;
|
||||
}
|
||||
|
||||
public void setInterior(Interior interior) {
|
||||
this.interior = interior;
|
||||
}
|
||||
|
||||
public WaterQuality getQuality() {
|
||||
return quality;
|
||||
}
|
||||
|
||||
public void setQuality(WaterQuality quality) {
|
||||
this.quality = quality;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,45 @@
|
||||
/**
|
||||
* 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.mixed.source;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Sjaak Derksen
|
||||
*/
|
||||
public class Interior {
|
||||
|
||||
private String designer;
|
||||
private Ornament ornament;
|
||||
|
||||
public String getDesigner() {
|
||||
return designer;
|
||||
}
|
||||
|
||||
public void setDesigner(String designer) {
|
||||
this.designer = designer;
|
||||
}
|
||||
|
||||
public Ornament getOrnament() {
|
||||
return ornament;
|
||||
}
|
||||
|
||||
public void setOrnament(Ornament ornament) {
|
||||
this.ornament = ornament;
|
||||
}
|
||||
}
|
@ -0,0 +1,37 @@
|
||||
/**
|
||||
* 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.mixed.source;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Sjaak Derksen
|
||||
*/
|
||||
public class MaterialType {
|
||||
|
||||
private String type;
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,37 @@
|
||||
/**
|
||||
* 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.mixed.source;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Sjaak Derksen
|
||||
*/
|
||||
public class Ornament {
|
||||
|
||||
private String type;
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
}
|
@ -16,7 +16,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.mapstruct.ap.test.nestedtargetproperties.source;
|
||||
package org.mapstruct.ap.test.nestedbeans.mixed.source;
|
||||
|
||||
/**
|
||||
*
|
@ -0,0 +1,37 @@
|
||||
/**
|
||||
* 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.mixed.source;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Sjaak Derksen
|
||||
*/
|
||||
public class WaterQuality {
|
||||
|
||||
private WaterQualityReport report;
|
||||
|
||||
public WaterQualityReport getReport() {
|
||||
return report;
|
||||
}
|
||||
|
||||
public void setReport(WaterQualityReport report) {
|
||||
this.report = report;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,46 @@
|
||||
/**
|
||||
* 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.mixed.source;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Sjaak Derksen
|
||||
*/
|
||||
public class WaterQualityReport {
|
||||
|
||||
private String organisationName;
|
||||
private String verdict;
|
||||
|
||||
public String getOrganisationName() {
|
||||
return organisationName;
|
||||
}
|
||||
|
||||
public void setOrganisationName(String organisationName) {
|
||||
this.organisationName = organisationName;
|
||||
}
|
||||
|
||||
public String getVerdict() {
|
||||
return verdict;
|
||||
}
|
||||
|
||||
public void setVerdict(String verdict) {
|
||||
this.verdict = verdict;
|
||||
}
|
||||
|
||||
}
|
@ -28,12 +28,6 @@ import org.mapstruct.ap.test.nestedsourceproperties.source.Chart;
|
||||
import org.mapstruct.ap.test.nestedsourceproperties.source.Label;
|
||||
import org.mapstruct.ap.test.nestedsourceproperties.source.Song;
|
||||
import org.mapstruct.ap.test.nestedsourceproperties.source.Studio;
|
||||
import org.mapstruct.ap.test.nestedtargetproperties._target.FishDto;
|
||||
import org.mapstruct.ap.test.nestedtargetproperties._target.FishTankDto;
|
||||
import org.mapstruct.ap.test.nestedtargetproperties._target.WaterPlantDto;
|
||||
import org.mapstruct.ap.test.nestedtargetproperties.source.Fish;
|
||||
import org.mapstruct.ap.test.nestedtargetproperties.source.FishTank;
|
||||
import org.mapstruct.ap.test.nestedtargetproperties.source.WaterPlant;
|
||||
import org.mapstruct.ap.testutil.IssueKey;
|
||||
import org.mapstruct.ap.testutil.WithClasses;
|
||||
import org.mapstruct.ap.testutil.runner.AnnotationProcessorTestRunner;
|
||||
@ -50,16 +44,9 @@ import org.mapstruct.ap.testutil.runner.GeneratedSource;
|
||||
Label.class,
|
||||
Studio.class,
|
||||
ChartEntry.class,
|
||||
FishDto.class,
|
||||
FishTankDto.class,
|
||||
WaterPlantDto.class,
|
||||
Fish.class,
|
||||
FishTank.class,
|
||||
WaterPlant.class,
|
||||
ChartEntryToArtist.class,
|
||||
ChartEntryToArtistUpdate.class,
|
||||
FishTankMapper.class
|
||||
})
|
||||
ChartEntryToArtistUpdate.class
|
||||
} )
|
||||
@IssueKey("389")
|
||||
@RunWith(AnnotationProcessorTestRunner.class)
|
||||
public class NestedTargetPropertiesTest {
|
||||
@ -67,8 +54,7 @@ public class NestedTargetPropertiesTest {
|
||||
@Rule
|
||||
public GeneratedSource generatedSource = new GeneratedSource().addComparisonToFixtureFor(
|
||||
ChartEntryToArtist.class,
|
||||
ChartEntryToArtistUpdate.class,
|
||||
FishTankMapper.class
|
||||
ChartEntryToArtistUpdate.class
|
||||
);
|
||||
|
||||
@Test
|
||||
@ -186,31 +172,4 @@ public class NestedTargetPropertiesTest {
|
||||
assertThat( result.getSong().getPositions().get( 0 ) ).isEqualTo( 1 );
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void automappingAndTargetNestingDemonstrator() {
|
||||
|
||||
FishTank source = new FishTank();
|
||||
source.setName( "MyLittleFishTank" );
|
||||
Fish fish = new Fish();
|
||||
fish.setType( "Carp" );
|
||||
WaterPlant waterplant = new WaterPlant();
|
||||
waterplant.setKind( "Water Hyacinth" );
|
||||
source.setFish( fish );
|
||||
source.setPlant( waterplant );
|
||||
|
||||
FishTankDto target = FishTankMapper.INSTANCE.map( source );
|
||||
|
||||
// the nested property generates a method fishTankToFishDto(FishTank fishTank, FishDto mappingTarget)
|
||||
// when name based mapping continues MapStruct searches for a property called `name` in fishTank (type
|
||||
// 'FishTank'. If it is there, it should most cerntainly not be mapped to a mappingTarget of type 'FishDto'
|
||||
assertThat( target.getFish() ).isNotNull();
|
||||
assertThat( target.getFish().getKind() ).isEqualTo( "Carp" );
|
||||
assertThat( target.getFish().getName() ).isNull();
|
||||
|
||||
// automapping takes care of mapping property "waterPlant".
|
||||
assertThat( target.getPlant() ).isNotNull();
|
||||
assertThat( target.getPlant().getKind() ).isEqualTo( "Water Hyacinth" );
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -16,22 +16,22 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.mapstruct.ap.test.nestedtargetproperties;
|
||||
package org.mapstruct.ap.test.nestedbeans.mixed;
|
||||
|
||||
import javax.annotation.Generated;
|
||||
import org.mapstruct.ap.test.nestedtargetproperties._target.FishDto;
|
||||
import org.mapstruct.ap.test.nestedtargetproperties._target.FishTankDto;
|
||||
import org.mapstruct.ap.test.nestedtargetproperties._target.WaterPlantDto;
|
||||
import org.mapstruct.ap.test.nestedtargetproperties.source.Fish;
|
||||
import org.mapstruct.ap.test.nestedtargetproperties.source.FishTank;
|
||||
import org.mapstruct.ap.test.nestedtargetproperties.source.WaterPlant;
|
||||
import org.mapstruct.ap.test.nestedbeans.mixed._target.FishDto;
|
||||
import org.mapstruct.ap.test.nestedbeans.mixed._target.FishTankDto;
|
||||
import org.mapstruct.ap.test.nestedbeans.mixed._target.WaterPlantDto;
|
||||
import org.mapstruct.ap.test.nestedbeans.mixed.source.Fish;
|
||||
import org.mapstruct.ap.test.nestedbeans.mixed.source.FishTank;
|
||||
import org.mapstruct.ap.test.nestedbeans.mixed.source.WaterPlant;
|
||||
|
||||
@Generated(
|
||||
value = "org.mapstruct.ap.MappingProcessor",
|
||||
date = "2017-02-07T21:05:06+0100",
|
||||
date = "2017-02-13T00:35:18+0100",
|
||||
comments = "version: , compiler: javac, environment: Java 1.8.0_112 (Oracle Corporation)"
|
||||
)
|
||||
public class FishTankMapperImpl implements FishTankMapper {
|
||||
public class FishTankMapperConstantImpl implements FishTankMapperConstant {
|
||||
|
||||
@Override
|
||||
public FishTankDto map(FishTank source) {
|
||||
@ -41,38 +41,23 @@ public class FishTankMapperImpl implements FishTankMapper {
|
||||
|
||||
FishTankDto fishTankDto = new FishTankDto();
|
||||
|
||||
fishTankDto.setFish( fishTankToFishDto( source ) );
|
||||
fishTankDto.setFish( fishToFishDto( source.getFish() ) );
|
||||
fishTankDto.setPlant( waterPlantToWaterPlantDto( source.getPlant() ) );
|
||||
fishTankDto.setName( source.getName() );
|
||||
|
||||
return fishTankDto;
|
||||
}
|
||||
|
||||
private String fishTankFishType(FishTank fishTank) {
|
||||
if ( fishTank == null ) {
|
||||
return null;
|
||||
}
|
||||
Fish fish = fishTank.getFish();
|
||||
protected FishDto fishToFishDto(Fish fish) {
|
||||
if ( fish == null ) {
|
||||
return null;
|
||||
}
|
||||
String type = fish.getType();
|
||||
if ( type == null ) {
|
||||
return null;
|
||||
}
|
||||
return type;
|
||||
}
|
||||
|
||||
protected FishDto fishTankToFishDto(FishTank fishTank) {
|
||||
if ( fishTank == null ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
FishDto fishDto = new FishDto();
|
||||
|
||||
String type = fishTankFishType( fishTank );
|
||||
if ( type != null ) {
|
||||
fishDto.setKind( type );
|
||||
}
|
||||
fishDto.setKind( fish.getType() );
|
||||
|
||||
fishDto.setName( "Nemo" );
|
||||
|
||||
return fishDto;
|
||||
}
|
@ -0,0 +1,358 @@
|
||||
/**
|
||||
* 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.mixed;
|
||||
|
||||
import javax.annotation.Generated;
|
||||
import org.mapstruct.ap.test.nestedbeans.mixed._target.FishDto;
|
||||
import org.mapstruct.ap.test.nestedbeans.mixed._target.FishTankDto;
|
||||
import org.mapstruct.ap.test.nestedbeans.mixed._target.MaterialDto;
|
||||
import org.mapstruct.ap.test.nestedbeans.mixed._target.MaterialTypeDto;
|
||||
import org.mapstruct.ap.test.nestedbeans.mixed._target.OrnamentDto;
|
||||
import org.mapstruct.ap.test.nestedbeans.mixed._target.WaterPlantDto;
|
||||
import org.mapstruct.ap.test.nestedbeans.mixed._target.WaterQualityDto;
|
||||
import org.mapstruct.ap.test.nestedbeans.mixed._target.WaterQualityOrganisationDto;
|
||||
import org.mapstruct.ap.test.nestedbeans.mixed._target.WaterQualityReportDto;
|
||||
import org.mapstruct.ap.test.nestedbeans.mixed.source.Fish;
|
||||
import org.mapstruct.ap.test.nestedbeans.mixed.source.FishTank;
|
||||
import org.mapstruct.ap.test.nestedbeans.mixed.source.Interior;
|
||||
import org.mapstruct.ap.test.nestedbeans.mixed.source.MaterialType;
|
||||
import org.mapstruct.ap.test.nestedbeans.mixed.source.Ornament;
|
||||
import org.mapstruct.ap.test.nestedbeans.mixed.source.WaterPlant;
|
||||
import org.mapstruct.ap.test.nestedbeans.mixed.source.WaterQuality;
|
||||
import org.mapstruct.ap.test.nestedbeans.mixed.source.WaterQualityReport;
|
||||
|
||||
@Generated(
|
||||
value = "org.mapstruct.ap.MappingProcessor",
|
||||
date = "2017-02-12T21:48:04+0100",
|
||||
comments = "version: , compiler: javac, environment: Java 1.8.0_45 (Oracle Corporation)"
|
||||
)
|
||||
public class FishTankMapperImpl implements FishTankMapper {
|
||||
|
||||
@Override
|
||||
public FishTankDto map(FishTank source) {
|
||||
if ( source == null ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
FishTankDto fishTankDto = new FishTankDto();
|
||||
|
||||
fishTankDto.setMaterial( fishTankToMaterialDto( source ) );
|
||||
fishTankDto.setFish( fishToFishDto( source.getFish() ) );
|
||||
fishTankDto.setQuality( waterQualityToWaterQualityDto( source.getQuality() ) );
|
||||
Ornament ornament = sourceInteriorOrnament( source );
|
||||
if ( ornament != null ) {
|
||||
fishTankDto.setOrnament( ornamentToOrnamentDto( ornament ) );
|
||||
}
|
||||
fishTankDto.setPlant( waterPlantToWaterPlantDto( source.getPlant() ) );
|
||||
fishTankDto.setName( source.getName() );
|
||||
|
||||
return fishTankDto;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FishTankDto mapAsWell(FishTank source) {
|
||||
if ( source == null ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
FishTankDto fishTankDto = new FishTankDto();
|
||||
|
||||
fishTankDto.setMaterial( fishTankToMaterialDto( source ) );
|
||||
fishTankDto.setFish( fishToFishDto( source.getFish() ) );
|
||||
fishTankDto.setQuality( waterQualityToWaterQualityDto( source.getQuality() ) );
|
||||
Ornament ornament = sourceInteriorOrnament1( source );
|
||||
if ( ornament != null ) {
|
||||
fishTankDto.setOrnament( ornamentToOrnamentDto( ornament ) );
|
||||
}
|
||||
fishTankDto.setPlant( waterPlantToWaterPlantDto( source.getPlant() ) );
|
||||
fishTankDto.setName( source.getName() );
|
||||
|
||||
return fishTankDto;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FishTank map(FishTankDto source) {
|
||||
if ( source == null ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
FishTank fishTank = new FishTank();
|
||||
|
||||
fishTank.setFish( fishDtoToFish( source.getFish() ) );
|
||||
fishTank.setQuality( waterQualityDtoToWaterQuality( source.getQuality() ) );
|
||||
fishTank.setInterior( fishTankDtoToInterior( source ) );
|
||||
MaterialTypeDto materialType = sourceMaterialMaterialType( source );
|
||||
if ( materialType != null ) {
|
||||
fishTank.setMaterial( materialTypeDtoToMaterialType( materialType ) );
|
||||
}
|
||||
fishTank.setPlant( waterPlantDtoToWaterPlant( source.getPlant() ) );
|
||||
fishTank.setName( source.getName() );
|
||||
|
||||
return fishTank;
|
||||
}
|
||||
|
||||
protected MaterialTypeDto materialTypeToMaterialTypeDto(MaterialType materialType) {
|
||||
if ( materialType == null ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
MaterialTypeDto materialTypeDto = new MaterialTypeDto();
|
||||
|
||||
materialTypeDto.setType( materialType.getType() );
|
||||
|
||||
return materialTypeDto;
|
||||
}
|
||||
|
||||
protected MaterialDto fishTankToMaterialDto(FishTank fishTank) {
|
||||
if ( fishTank == null ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
MaterialDto materialDto = new MaterialDto();
|
||||
|
||||
materialDto.setMaterialType( materialTypeToMaterialTypeDto( fishTank.getMaterial() ) );
|
||||
|
||||
return materialDto;
|
||||
}
|
||||
|
||||
protected FishDto fishToFishDto(Fish fish) {
|
||||
if ( fish == null ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
FishDto fishDto = new FishDto();
|
||||
|
||||
fishDto.setKind( fish.getType() );
|
||||
|
||||
return fishDto;
|
||||
}
|
||||
|
||||
protected WaterQualityOrganisationDto waterQualityReportToWaterQualityOrganisationDto(WaterQualityReport waterQualityReport) {
|
||||
if ( waterQualityReport == null ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
WaterQualityOrganisationDto waterQualityOrganisationDto = new WaterQualityOrganisationDto();
|
||||
|
||||
waterQualityOrganisationDto.setName( waterQualityReport.getOrganisationName() );
|
||||
|
||||
return waterQualityOrganisationDto;
|
||||
}
|
||||
|
||||
protected WaterQualityReportDto waterQualityReportToWaterQualityReportDto(WaterQualityReport waterQualityReport) {
|
||||
if ( waterQualityReport == null ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
WaterQualityReportDto waterQualityReportDto = new WaterQualityReportDto();
|
||||
|
||||
waterQualityReportDto.setOrganisation( waterQualityReportToWaterQualityOrganisationDto( waterQualityReport ) );
|
||||
waterQualityReportDto.setVerdict( waterQualityReport.getVerdict() );
|
||||
|
||||
return waterQualityReportDto;
|
||||
}
|
||||
|
||||
protected WaterQualityDto waterQualityToWaterQualityDto(WaterQuality waterQuality) {
|
||||
if ( waterQuality == null ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
WaterQualityDto waterQualityDto = new WaterQualityDto();
|
||||
|
||||
waterQualityDto.setReport( waterQualityReportToWaterQualityReportDto( waterQuality.getReport() ) );
|
||||
|
||||
return waterQualityDto;
|
||||
}
|
||||
|
||||
private Ornament sourceInteriorOrnament(FishTank fishTank) {
|
||||
|
||||
if ( fishTank == null ) {
|
||||
return null;
|
||||
}
|
||||
Interior interior = fishTank.getInterior();
|
||||
if ( interior == null ) {
|
||||
return null;
|
||||
}
|
||||
Ornament ornament = interior.getOrnament();
|
||||
if ( ornament == null ) {
|
||||
return null;
|
||||
}
|
||||
return ornament;
|
||||
}
|
||||
|
||||
protected OrnamentDto ornamentToOrnamentDto(Ornament ornament) {
|
||||
if ( ornament == null ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
OrnamentDto ornamentDto = new OrnamentDto();
|
||||
|
||||
ornamentDto.setType( ornament.getType() );
|
||||
|
||||
return ornamentDto;
|
||||
}
|
||||
|
||||
protected WaterPlantDto waterPlantToWaterPlantDto(WaterPlant waterPlant) {
|
||||
if ( waterPlant == null ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
WaterPlantDto waterPlantDto = new WaterPlantDto();
|
||||
|
||||
waterPlantDto.setKind( waterPlant.getKind() );
|
||||
|
||||
return waterPlantDto;
|
||||
}
|
||||
|
||||
private Ornament sourceInteriorOrnament1(FishTank fishTank) {
|
||||
|
||||
if ( fishTank == null ) {
|
||||
return null;
|
||||
}
|
||||
Interior interior = fishTank.getInterior();
|
||||
if ( interior == null ) {
|
||||
return null;
|
||||
}
|
||||
Ornament ornament = interior.getOrnament();
|
||||
if ( ornament == null ) {
|
||||
return null;
|
||||
}
|
||||
return ornament;
|
||||
}
|
||||
|
||||
protected Fish fishDtoToFish(FishDto fishDto) {
|
||||
if ( fishDto == null ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
Fish fish = new Fish();
|
||||
|
||||
fish.setType( fishDto.getKind() );
|
||||
|
||||
return fish;
|
||||
}
|
||||
|
||||
private String waterQualityReportDtoOrganisationName(WaterQualityReportDto waterQualityReportDto) {
|
||||
|
||||
if ( waterQualityReportDto == null ) {
|
||||
return null;
|
||||
}
|
||||
WaterQualityOrganisationDto organisation = waterQualityReportDto.getOrganisation();
|
||||
if ( organisation == null ) {
|
||||
return null;
|
||||
}
|
||||
String name = organisation.getName();
|
||||
if ( name == null ) {
|
||||
return null;
|
||||
}
|
||||
return name;
|
||||
}
|
||||
|
||||
protected WaterQualityReport waterQualityReportDtoToWaterQualityReport(WaterQualityReportDto waterQualityReportDto) {
|
||||
if ( waterQualityReportDto == null ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
WaterQualityReport waterQualityReport = new WaterQualityReport();
|
||||
|
||||
String name = waterQualityReportDtoOrganisationName( waterQualityReportDto );
|
||||
if ( name != null ) {
|
||||
waterQualityReport.setOrganisationName( name );
|
||||
}
|
||||
waterQualityReport.setVerdict( waterQualityReportDto.getVerdict() );
|
||||
|
||||
return waterQualityReport;
|
||||
}
|
||||
|
||||
protected WaterQuality waterQualityDtoToWaterQuality(WaterQualityDto waterQualityDto) {
|
||||
if ( waterQualityDto == null ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
WaterQuality waterQuality = new WaterQuality();
|
||||
|
||||
waterQuality.setReport( waterQualityReportDtoToWaterQualityReport( waterQualityDto.getReport() ) );
|
||||
|
||||
return waterQuality;
|
||||
}
|
||||
|
||||
protected Ornament ornamentDtoToOrnament(OrnamentDto ornamentDto) {
|
||||
if ( ornamentDto == null ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
Ornament ornament = new Ornament();
|
||||
|
||||
ornament.setType( ornamentDto.getType() );
|
||||
|
||||
return ornament;
|
||||
}
|
||||
|
||||
protected Interior fishTankDtoToInterior(FishTankDto fishTankDto) {
|
||||
if ( fishTankDto == null ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
Interior interior = new Interior();
|
||||
|
||||
interior.setOrnament( ornamentDtoToOrnament( fishTankDto.getOrnament() ) );
|
||||
|
||||
return interior;
|
||||
}
|
||||
|
||||
private MaterialTypeDto sourceMaterialMaterialType(FishTankDto fishTankDto) {
|
||||
|
||||
if ( fishTankDto == null ) {
|
||||
return null;
|
||||
}
|
||||
MaterialDto material = fishTankDto.getMaterial();
|
||||
if ( material == null ) {
|
||||
return null;
|
||||
}
|
||||
MaterialTypeDto materialType = material.getMaterialType();
|
||||
if ( materialType == null ) {
|
||||
return null;
|
||||
}
|
||||
return materialType;
|
||||
}
|
||||
|
||||
protected MaterialType materialTypeDtoToMaterialType(MaterialTypeDto materialTypeDto) {
|
||||
if ( materialTypeDto == null ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
MaterialType materialType = new MaterialType();
|
||||
|
||||
materialType.setType( materialTypeDto.getType() );
|
||||
|
||||
return materialType;
|
||||
}
|
||||
|
||||
protected WaterPlant waterPlantDtoToWaterPlant(WaterPlantDto waterPlantDto) {
|
||||
if ( waterPlantDto == null ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
WaterPlant waterPlant = new WaterPlant();
|
||||
|
||||
waterPlant.setKind( waterPlantDto.getKind() );
|
||||
|
||||
return waterPlant;
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user