├── .gitignore ├── .travis.yml ├── LICENSE.txt ├── NOTICE.txt ├── README.md ├── RELEASE_NOTES ├── examples-common ├── pom.xml └── src │ ├── main │ └── java │ │ └── fr │ │ └── xebia │ │ └── extras │ │ └── selma │ │ └── beans │ │ ├── CustomMapper.java │ │ └── DateBO.java │ └── test │ └── java │ └── fr │ └── xebia │ └── extras │ └── selma │ └── beans │ ├── CustomMapperTest.java │ ├── DateBOMapper.java │ ├── TypeIn.java │ └── TypeOut.java ├── examples ├── pom.xml └── src │ ├── main │ └── java │ │ └── fr │ │ └── xebia │ │ └── extras │ │ └── selma │ │ ├── beans │ │ ├── Address.java │ │ ├── AddressDto.java │ │ ├── CustomMappings.java │ │ ├── Customer.java │ │ ├── CustomerDto.java │ │ ├── Order.java │ │ ├── Order2OrderDto.java │ │ ├── OrderDto.java │ │ ├── Person.java │ │ ├── PersonDto.java │ │ ├── PersonMapper.java │ │ ├── Product.java │ │ ├── ProductDto.java │ │ ├── ProductType.java │ │ ├── SalesChannel.java │ │ └── SalesChannelDto.java │ │ └── service │ │ └── OrderService.java │ └── test │ └── java │ └── fr │ └── xebia │ └── extras │ └── selma │ └── service │ └── OrderServiceTest.java ├── pom.xml ├── processor ├── pom.xml └── src │ ├── main │ ├── java │ │ └── fr │ │ │ └── xebia │ │ │ └── extras │ │ │ └── selma │ │ │ └── codegen │ │ │ ├── AnnotationWrapper.java │ │ │ ├── BeanWrapper.java │ │ │ ├── BeanWrapperFactory.java │ │ │ ├── CollectionsRegistry.java │ │ │ ├── CustomMapperWrapper.java │ │ │ ├── EnumMappersWrapper.java │ │ │ ├── FactoryWrapper.java │ │ │ ├── FieldMap.java │ │ │ ├── FieldsWrapper.java │ │ │ ├── IgnoreFieldsWrapper.java │ │ │ ├── ImmutableTypesWrapper.java │ │ │ ├── InOutType.java │ │ │ ├── MapperClassGenerator.java │ │ │ ├── MapperGeneratorContext.java │ │ │ ├── MapperMethodGenerator.java │ │ │ ├── MapperProcessor.java │ │ │ ├── MapperWrapper.java │ │ │ ├── MappingBuilder.java │ │ │ ├── MappingRegistry.java │ │ │ ├── MappingSourceNode.java │ │ │ ├── MapsWrapper.java │ │ │ ├── MethodWrapper.java │ │ │ ├── ProcessorUtils.java │ │ │ ├── SourceConfiguration.java │ │ │ ├── SourceNodeVars.java │ │ │ ├── SourceWrapper.java │ │ │ ├── TypeConstructorWrapper.java │ │ │ └── compiler │ │ │ └── CompilerMessageRegistry.java │ └── resources │ │ └── META-INF │ │ └── services │ │ └── javax.annotation.processing.Processor │ └── test │ └── java │ └── fr │ └── xebia │ └── extras │ └── selma │ ├── beans │ ├── AbstractBuilderOut.java │ ├── AbstractSourceString.java │ ├── AddressIn.java │ ├── AddressOut.java │ ├── AddressOutWithDataSource.java │ ├── AggregatedBean.java │ ├── Book.java │ ├── BookDTO.java │ ├── BooleanBean.java │ ├── BuilderIn.java │ ├── BuilderOut.java │ ├── CircularReference.java │ ├── CityIn.java │ ├── CityOut.java │ ├── CityOutWithDataSource.java │ ├── CollectionBeanDefensiveDestination.java │ ├── CollectionBeanDestination.java │ ├── CollectionBeanSource.java │ ├── DataSource.java │ ├── DatePojo.java │ ├── DestinationString.java │ ├── EnumA.java │ ├── EnumB.java │ ├── EnumBeanA.java │ ├── EnumBeanB.java │ ├── EnumBeanIn.java │ ├── EnumBeanOut.java │ ├── EnumIn.java │ ├── EnumOut.java │ ├── ExtendedCityIn.java │ ├── ExtendedCityOut.java │ ├── FirstBean.java │ ├── Home.java │ ├── HomeDto.java │ ├── IbanRest.java │ ├── Library.java │ ├── LibraryDTO.java │ ├── LinkedBlockingListBean.java │ ├── LinkedListBean.java │ ├── NoEmptyConstructorPersonOut.java │ ├── NoGetterBean.java │ ├── Passenger.java │ ├── Person.java │ ├── PersonDto.java │ ├── PersonImpl.java │ ├── PersonIn.java │ ├── PersonOut.java │ ├── Phone.java │ ├── Proposal.java │ ├── ProposalDto.java │ ├── RawBean.java │ ├── RawCollectionBeanDestination.java │ ├── RawCollectionBeanSource.java │ ├── RawListBean.java │ ├── RawMapBean.java │ ├── Rib.java │ ├── SecondBean.java │ ├── SimpleContacts.java │ ├── SimpleContactsDto.java │ ├── SimplePerson.java │ ├── SimplePersonDto.java │ ├── SourceString.java │ ├── StringList.java │ ├── StringMap.java │ ├── TicketIn.java │ ├── TicketOut.java │ ├── TicketTocken.java │ ├── TimestampPojo.java │ └── immutable │ │ └── ImmutablePackageBean.java │ └── it │ ├── BeanMapperIT.java │ ├── BooleanBeanMapperIT.java │ ├── BuilderMapperIT.java │ ├── CircularReferenceMapperIT.java │ ├── CollectionInheritanceMapperIT.java │ ├── CollectionsMapperIT.java │ ├── CustomEnumMapperIT.java │ ├── CustomFieldMapperIT.java │ ├── CustomFieldMapperMappingsIT.java │ ├── CustomMapperIt.java │ ├── CustomMethodEnumMapsMapperIT.java │ ├── ExplicitIgnoreFieldMapperIT.java │ ├── ExplicitIgnoreFieldMappingsMapperIT.java │ ├── FailingCustomFieldMapperIT.java │ ├── FailingCustomMapperIT.java │ ├── FailingEnumMappersIT.java │ ├── FailingMappersIT.java │ ├── FailingMissingPropertyMapsMappersIT.java │ ├── FullyQualifiedIgnoreFieldMapperIT.java │ ├── FullyQualifiedIgnoreFieldMappingsMapperIT.java │ ├── HomeMapperIT.java │ ├── IbanMapperIT.java │ ├── ImmutablePackageMapperIT.java │ ├── ImmutableTypesMappingIT.java │ ├── IncompleteEnumMapperIT.java │ ├── InheritedMapperIT.java │ ├── Issue167BeanMapper.java │ ├── MappingInterceptorIt.java │ ├── NestedMapAndCollectionsMapperIT.java │ ├── NotNullValueMapperIT.java │ ├── NotSupportedMappingIT.java │ ├── PersonMapperIT.java │ ├── PrimitivesMapperIT.java │ ├── SameEnumMapperIT.java │ ├── SelmaIT.java │ ├── SourcedBeanMapperIT.java │ ├── UpdateGraphBeanMapperIT.java │ ├── UseDeclaredMethodMapperIT.java │ ├── WideningPrimitivesMapperIT.java │ ├── aggregation │ ├── AggregatedInterceptor.java │ ├── AggregationMapper.java │ ├── AggregationMapperIT.java │ ├── FailingAggregationMapper.java │ └── FailingAggregationMapperIT.java │ ├── arrays │ ├── ArrayBeanDestination.java │ ├── ArrayBeanMapper.java │ ├── ArrayBeanMapperIT.java │ ├── ArrayBeanSource.java │ ├── BeanDestination.java │ └── BeanSource.java │ ├── bug │ ├── ConflictingClassAndFieldNameInCustomFieldIT.java │ ├── LinkedHashMapMapper.java │ ├── LinkedHashMapMapperIT.java │ ├── beans │ │ ├── Address.java │ │ ├── AddressDto.java │ │ ├── Person.java │ │ ├── PersonDto.java │ │ └── PersonMapper.java │ └── source │ │ ├── Person.java │ │ ├── PersonDto.java │ │ ├── SourcedPersonMapper.java │ │ └── SourcedPersonMapperIT.java │ ├── collection │ ├── CollectionMapper.java │ ├── CollectionsMapperIT.java │ ├── FailingRawBeanMapperIT.java │ ├── IterableMapper.java │ ├── IterableMapperIT.java │ ├── RawBeanMapper.java │ ├── RawCollectionMapper.java │ ├── RawCollectionMapperIT.java │ ├── UpdateDeclaredCollectionMapper.java │ └── UpdateDeclaredCollectionMapperIT.java │ ├── custom │ ├── cyclic │ │ ├── CustomCyclicChainedMapperIT.java │ │ ├── CyclicBookMapper.java │ │ └── CyclicChainedMappers.java │ ├── fields │ │ ├── CustomFieldToFieldMapper.java │ │ ├── CustomFieldToFieldMapperIT.java │ │ ├── EmbeddedFieldToUpperFieldInMapsIT.java │ │ ├── EmbeddedFieldToUpperFieldInMapsUpdateGraphIT.java │ │ ├── EmbeddedFieldToUpperFieldMapper.java │ │ ├── EmbeddedFieldToUpperFieldUpdateGraphMapper.java │ │ ├── FQCNFieldToFieldInMapsIT.java │ │ ├── FQCNFullCustomFieldToFieldMapping.java │ │ ├── FQCNOneCustomFieldToFieldMapping.java │ │ ├── FailingEmbeddedFieldToUpperFieldInMapsIT.java │ │ ├── FailingEmbeddedFieldToUpperFieldMapper.java │ │ ├── FaillingFieldToFieldWithCustomMapper.java │ │ └── FaillingFieldToFieldWithCustomMapperIT.java │ ├── interceptor │ │ ├── AddressMappingInterceptor.java │ │ ├── MappingInterceptorForImmutable.java │ │ ├── MappingInterceptorForMutable.java │ │ ├── MappingInterceptorInMaps.java │ │ ├── MappingInterceptorInMapsIT.java │ │ ├── MappingInterceptorInMapsWithIgnoreNullValue.java │ │ ├── MappingInterceptorInMapsWithIgnoreNullValueIT.java │ │ ├── MappingInterceptorInUpdateWithIgnore.java │ │ ├── NeverUsedMappingInterceptorInMapper.java │ │ ├── NeverUsedMappingInterceptorInMaps.java │ │ └── beans │ │ │ ├── CustomDateTimeInterceptor.java │ │ │ ├── Validation.java │ │ │ └── ValidationJson.java │ └── mapper │ │ ├── AbstractMapperWithCustom.java │ │ ├── AbstractMapperWithCustomIT.java │ │ ├── AbstractMapperWithInterceptor.java │ │ ├── AbstractMapperWithInterceptorIT.java │ │ ├── AddressMapper.java │ │ ├── CustomCdiMapperInMaps.java │ │ ├── CustomCdiMapperInMapsIT.java │ │ ├── CustomCdiSingletonMapperInMaps.java │ │ ├── CustomCdiSingletonMapperInMapsIT.java │ │ ├── CustomImmutableMapper.java │ │ ├── CustomImmutableMapperInMapper.java │ │ ├── CustomMapperDefaultsToImmutable.java │ │ ├── CustomMapperDefaultsToImmutableIT.java │ │ ├── CustomMapperDefaultsToMutable.java │ │ ├── CustomMapperDefaultsToMutableIT.java │ │ ├── CustomMapperInMaps.java │ │ ├── CustomMapperInMapsIT.java │ │ ├── CustomMapperUsingSelmaMapper.java │ │ ├── CustomMapperUsingSelmaMapperIT.java │ │ ├── CustomMutableMapper.java │ │ ├── DateMapper.java │ │ ├── DateToLongCustomMapperIT.java │ │ ├── DateToLongMapper.java │ │ ├── FailOnConflictMapper.java │ │ ├── FailOnConflictsMapperIT.java │ │ └── NeverUsedCustomMapper.java │ ├── extend │ ├── ExtendMapper.java │ ├── ExtendMapperIT.java │ ├── ExtendNamedMapper.java │ ├── FailingExtendMapper.java │ └── FailingExtendMapperIT.java │ ├── factory │ ├── BeanFactory.java │ ├── BuildingIn.java │ ├── BuildingOut.java │ ├── ExtendedAddressIn.java │ ├── ExtendedAddressOut.java │ ├── FactoryMapper.java │ ├── FactoryMapperIT.java │ └── OutObject.java │ ├── generic │ ├── FailingGenericMapperIT.java │ ├── FooMapper.java │ ├── GenericMapper.java │ ├── GenericMapperIT.java │ ├── GenericSourceBeanIT.java │ ├── GenericSourceBeanMapper.java │ ├── PageListMapper.java │ ├── SameErasureMapper.java │ ├── SameErasureMapperIT.java │ ├── SpecificMapper.java │ └── beans │ │ ├── Bar.java │ │ ├── EntityPageList.java │ │ ├── Foo.java │ │ ├── GenericBean.java │ │ ├── GenericListBean.java │ │ ├── MongoEntity.java │ │ ├── PageList.java │ │ ├── Records.java │ │ ├── RecordsDAO.java │ │ ├── SimpleDTO.java │ │ ├── SimpleDomain.java │ │ └── Value.java │ ├── heritance │ ├── MailMapper.java │ ├── MailMapperIT.java │ └── beans │ │ ├── AbstractCoordonnee.java │ │ ├── Mail.java │ │ └── MailDto.java │ ├── ignore │ ├── FailingMissingFieldInMapsMapper.java │ ├── FailingMissingFieldsInMapsMapperIT.java │ ├── IgnoreMissingFieldsInMapperIT.java │ ├── IgnoreMissingFieldsInMapperMapper.java │ └── IgnoreMissingFieldsInMapsMapper.java │ ├── inject │ ├── AddressMapper.java │ ├── AddressMapperCDI.java │ ├── AddressMapperWithName.java │ ├── BeanFactoryClass.java │ ├── CustomImmutableMapperClass.java │ ├── CustomMapperUsingCdiIoCIT.java │ ├── CustomMapperUsingSpringIoCIT.java │ ├── CustomMapperUsingSpringIoCWithServiceNameIT.java │ └── SpringConfiguration.java │ ├── mappers │ ├── BadCustomMapper.java │ ├── BadMapperSignature.java │ ├── BadMapperSignatureIT.java │ ├── BeanMapper.java │ ├── BooleanBeanMapper.java │ ├── BuilderMapper.java │ ├── CircularReferenceMapper.java │ ├── CollectionInheritanceMapper.java │ ├── CollectionsMapper.java │ ├── CustomClassEnumMapper.java │ ├── CustomFieldMapper.java │ ├── CustomFieldMappingsMapper.java │ ├── CustomMapper.java │ ├── CustomMapperSupport.java │ ├── CustomMapperWithoutSource.java │ ├── CustomMethodEnumMapper.java │ ├── CustomMethodEnumMapsMapper.java │ ├── CustomMethodEnumNoDefaultMapsMapper.java │ ├── CustomMethodNoDefaultEnumMapper.java │ ├── CustomSourcedBeanMapper.java │ ├── EmptyCustomMapper.java │ ├── FailingCustomFieldMapper.java │ ├── FailingCustomMapper.java │ ├── FailingEnumMapper.java │ ├── HomeMapper.java │ ├── IbanMapper.java │ ├── IgnoreFieldMapper.java │ ├── IgnoreFieldMappingsMapper.java │ ├── IgnoreFullyQualifiedNameClassField.java │ ├── IgnoreFullyQualifiedNameClassFieldMappingsMapper.java │ ├── IgnoreSimpleNameClassField.java │ ├── IgnoreSimpleNameClassFieldMappingsMapper.java │ ├── ImmutablePackageMapper.java │ ├── ImmutableTypesMapper.java │ ├── IncompleteEnumMatchingMapper.java │ ├── InheritedMapper.java │ ├── MapperForIssue167.java │ ├── MappingInterceptor.java │ ├── MappingInterceptorSupport.java │ ├── MissingPropertyMapper.java │ ├── MissingPropertyMapsMapper.java │ ├── NestedMapAndCollectionMapper.java │ ├── NoDefaultConstructorCustomMapper.java │ ├── NotNullMapper.java │ ├── NotSupportedMapping.java │ ├── PersonMapper.java │ ├── SameEnumMapperIt.java │ ├── SelmaCustomTestMapper.java │ ├── SelmaSourcedTestMapper.java │ ├── SelmaTestMapper.java │ ├── SimpleMapper.java │ ├── SourcedBeanMapper.java │ ├── UpdateGraphBeanMapper.java │ ├── UseDeclaredMethodMapper.java │ └── WideningMapper.java │ ├── parent │ ├── SourceStringMapper.java │ └── SourceStringMapperIT.java │ ├── tostring │ ├── EnumToStringMapper.java │ ├── PrimitivesOrBoxedToStringMapper.java │ └── ToStringMapperIT.java │ └── utils │ ├── Compile.java │ ├── IntegrationTestBase.java │ ├── TestClassLoader.java │ └── TestCompiler.java ├── resources ├── S3lm4.graffle ├── S3lm4.png ├── logo-v2.png └── logo-v6.png ├── selma ├── .gitignore ├── pom.xml └── src │ └── main │ ├── java │ └── fr │ │ └── xebia │ │ └── extras │ │ └── selma │ │ ├── CollectionMappingStrategy.java │ │ ├── EnumMapper.java │ │ ├── Field.java │ │ ├── IgnoreMissing.java │ │ ├── InheritMaps.java │ │ ├── InstanceCache.java │ │ ├── IoC.java │ │ ├── Mapper.java │ │ ├── Maps.java │ │ ├── Selma.java │ │ ├── SelmaConstants.java │ │ ├── SelmaException.java │ │ ├── SelmaUtils.java │ │ └── SimpleInstanceCache.java │ └── resources │ └── selma.properties └── travis.sh /.gitignore: -------------------------------------------------------------------------------- 1 | .idea/** 2 | **/target/** 3 | **/*.iml 4 | **/.settings/** 5 | **/.project 6 | **/.classpath 7 | **/.factorypath 8 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: java 2 | 3 | before_install: 4 | - git clone -b travis `git config --get remote.origin.url` target/travis 5 | - cat /etc/hosts # optionally check the content *before* 6 | - sudo hostname "$(hostname | cut -c1-63)" 7 | - sed -e "s/^\\(127\\.0\\.0\\.1.*\\)/\\1 $(hostname | cut -c1-63)/" /etc/hosts > /tmp/hosts 8 | - sudo mv /tmp/hosts /etc/hosts 9 | - cat /etc/hosts # optionally check the content *after* 10 | 11 | script: "sh ./travis.sh" 12 | 13 | jdk: 14 | - openjdk7 15 | - oraclejdk8 16 | 17 | # whitelist 18 | branches: 19 | only: 20 | - master 21 | 22 | env: 23 | global: 24 | - secure: "ELThTQqmQjdhMXK+eRL5uCC5ygUHacpmx2QLVFfiXmMiSUH++F4FhaP7wLxPLPTWePqw7dtJ0Jb1j8NrLgUmQkn9AIil9V5GNNjpvEaUZBa3y0zd5cyfFc28wdcmgQ9CucaJuS6v8gXbM9/OvQWRzLULdAK2EKdyNwS1H2I2ED4=" 25 | - secure: "OQamliY3ibuHuox2dxr7Bgnx56xX+wM5IOi3HjptmE77k23OrpVklsrep1EsDHU9GmLAXWz+rVVhujMLgFYikovOxuOQKHyi+/sJFEnCXx8o6I3Ha1YpZCgmtWN+D82eSlIPflPPl8MAypn8Zl3ndaf5MOzr8vJyhIGGzFGSPHg=" 26 | -------------------------------------------------------------------------------- /NOTICE.txt: -------------------------------------------------------------------------------- 1 | This project uses JUnit (http://junit.org) 2 | developped by Harmcrest (www.hamcrest.org) 3 | 4 | This project uses jacoco 5 | 6 | This project uses JavaWriter 7 | 8 | -------------------------------------------------------------------------------- /examples-common/src/main/java/fr/xebia/extras/selma/beans/CustomMapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Séven Le Mesle 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package fr.xebia.extras.selma.beans; 18 | 19 | /** 20 | * Created by slemesle on 02/12/14. 21 | */ 22 | public class CustomMapper { 23 | 24 | public String dateStringToDateBO(DateBO dateString) { 25 | return dateString.toString(); 26 | } 27 | 28 | public DateBO dateStringToDateBO(String dateString) { 29 | return new DateBO(dateString); 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /examples-common/src/test/java/fr/xebia/extras/selma/beans/CustomMapperTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Séven Le Mesle 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package fr.xebia.extras.selma.beans; 18 | 19 | import fr.xebia.extras.selma.Selma; 20 | import org.junit.Assert; 21 | import org.junit.Test; 22 | 23 | /** 24 | * Created by slemesle on 02/12/14. 25 | */ 26 | public class CustomMapperTest { 27 | 28 | @Test 29 | public void given_custom_mapper_selma_should_use_it_for_IOTypes() { 30 | DateBOMapper mapper = Selma.mapper(DateBOMapper.class); 31 | TypeIn in = new TypeIn("1245432"); 32 | TypeOut out = mapper.asTypeOut(in); 33 | 34 | Assert.assertEquals(out.getDate(), new DateBO(in.getDate())); 35 | 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /examples-common/src/test/java/fr/xebia/extras/selma/beans/DateBOMapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Séven Le Mesle 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package fr.xebia.extras.selma.beans; 18 | 19 | import fr.xebia.extras.selma.Mapper; 20 | 21 | /** 22 | * Created by slemesle on 02/12/14. 23 | */ 24 | @Mapper(withCustom = CustomMapper.class) 25 | public interface DateBOMapper { 26 | 27 | TypeOut asTypeOut(TypeIn in); 28 | 29 | } 30 | -------------------------------------------------------------------------------- /examples-common/src/test/java/fr/xebia/extras/selma/beans/TypeIn.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Séven Le Mesle 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package fr.xebia.extras.selma.beans; 18 | 19 | /** 20 | * Created by slemesle on 02/12/14. 21 | */ 22 | public class TypeIn { 23 | 24 | String date; 25 | 26 | public TypeIn(String date) { 27 | this.date = date; 28 | } 29 | 30 | public String getDate() { 31 | return date; 32 | } 33 | 34 | public void setDate(String date) { 35 | this.date = date; 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /examples-common/src/test/java/fr/xebia/extras/selma/beans/TypeOut.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Séven Le Mesle 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package fr.xebia.extras.selma.beans; 18 | 19 | /** 20 | * Created by slemesle on 02/12/14. 21 | */ 22 | public class TypeOut { 23 | 24 | DateBO date; 25 | 26 | public DateBO getDate() { 27 | return date; 28 | } 29 | 30 | public void setDate(DateBO date) { 31 | this.date = date; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /examples/src/main/java/fr/xebia/extras/selma/beans/CustomMappings.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Xebia and Séven Le Mesle 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package fr.xebia.extras.selma.beans; 18 | 19 | 20 | /** 21 | * Custom Mapping show case 22 | */ 23 | public class CustomMappings { 24 | 25 | 26 | public String productTypeToString(ProductType in) { 27 | 28 | return in.toString(); 29 | } 30 | 31 | public ProductType productTypeToString(String in) { 32 | 33 | return ProductType.valueOf(in); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /examples/src/main/java/fr/xebia/extras/selma/beans/Order2OrderDto.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Xebia and Séven Le Mesle 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package fr.xebia.extras.selma.beans; 18 | 19 | import fr.xebia.extras.selma.IgnoreMissing; 20 | import fr.xebia.extras.selma.Mapper; 21 | 22 | /** 23 | * 24 | */ 25 | @Mapper(withIgnoreMissing = IgnoreMissing.ALL, withCustom = {CustomMappings.class, CustomMapper.class}) 26 | public interface Order2OrderDto { 27 | 28 | OrderDto asDto(Order in); 29 | 30 | Order asOrder(OrderDto in); 31 | 32 | ProductDto to(Product in); 33 | 34 | } 35 | -------------------------------------------------------------------------------- /examples/src/main/java/fr/xebia/extras/selma/beans/PersonMapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Xebia and Séven Le Mesle 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package fr.xebia.extras.selma.beans; 18 | 19 | import fr.xebia.extras.selma.Mapper; 20 | 21 | /** 22 | * Created by slemesle on 14/12/2013. 23 | */ 24 | @Mapper 25 | public interface PersonMapper { 26 | 27 | 28 | PersonDto asPersonDto(Person in); 29 | 30 | } 31 | -------------------------------------------------------------------------------- /examples/src/main/java/fr/xebia/extras/selma/beans/ProductType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Xebia and Séven Le Mesle 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package fr.xebia.extras.selma.beans; 18 | 19 | /** 20 | * Created with IntelliJ IDEA. 21 | * User: slemesle 22 | * Date: 27/11/2013 23 | * Time: 20:59 24 | * To change this template use File | Settings | File Templates. 25 | */ 26 | public enum ProductType { 27 | 28 | GOODS, 29 | FOOD, 30 | SERVICE, 31 | TEST 32 | 33 | } 34 | -------------------------------------------------------------------------------- /examples/src/main/java/fr/xebia/extras/selma/beans/SalesChannel.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Xebia and Séven Le Mesle 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package fr.xebia.extras.selma.beans; 18 | 19 | /** 20 | * Created with IntelliJ IDEA. 21 | * User: slemesle 22 | * Date: 26/11/2013 23 | * Time: 23:49 24 | * To change this template use File | Settings | File Templates. 25 | */ 26 | public enum SalesChannel { 27 | 28 | WEB, SHOP, RETAILER, PHONE 29 | } 30 | -------------------------------------------------------------------------------- /examples/src/main/java/fr/xebia/extras/selma/beans/SalesChannelDto.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Xebia and Séven Le Mesle 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package fr.xebia.extras.selma.beans; 18 | 19 | /** 20 | * Created with IntelliJ IDEA. 21 | * User: slemesle 22 | * Date: 26/11/2013 23 | * Time: 23:49 24 | * To change this template use File | Settings | File Templates. 25 | */ 26 | public enum SalesChannelDto { 27 | 28 | WEB, SHOP, RETAILER, PHONE 29 | } 30 | -------------------------------------------------------------------------------- /examples/src/main/java/fr/xebia/extras/selma/service/OrderService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Xebia and Séven Le Mesle 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package fr.xebia.extras.selma.service; 18 | 19 | import fr.xebia.extras.selma.Selma; 20 | import fr.xebia.extras.selma.beans.Order; 21 | import fr.xebia.extras.selma.beans.Order2OrderDto; 22 | import fr.xebia.extras.selma.beans.OrderDto; 23 | 24 | /** 25 | * 26 | */ 27 | public class OrderService { 28 | 29 | private final Order2OrderDto orderMapper; 30 | 31 | public OrderService() { 32 | this.orderMapper = Selma.getMapper(Order2OrderDto.class); 33 | } 34 | 35 | public OrderDto process(Order order) { 36 | return orderMapper.asDto(order); 37 | } 38 | 39 | public Order update(OrderDto dto) { 40 | return orderMapper.asOrder(dto); 41 | } 42 | 43 | } 44 | -------------------------------------------------------------------------------- /processor/src/main/resources/META-INF/services/javax.annotation.processing.Processor: -------------------------------------------------------------------------------- 1 | fr.xebia.extras.selma.codegen.MapperProcessor 2 | -------------------------------------------------------------------------------- /processor/src/test/java/fr/xebia/extras/selma/beans/AbstractBuilderOut.java: -------------------------------------------------------------------------------- 1 | package fr.xebia.extras.selma.beans; 2 | 3 | /** 4 | * Bean used to test Builder-style properties. 5 | */ 6 | public abstract class AbstractBuilderOut> { 7 | private String str; 8 | 9 | public String getStr() { 10 | return str; 11 | } 12 | 13 | /** 14 | * Should work with inherited Builder properties. 15 | * 16 | * @param str 17 | * @return 18 | */ 19 | @SuppressWarnings("unchecked") 20 | public T setStr(String str) { 21 | this.str = str; 22 | return (T) this; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /processor/src/test/java/fr/xebia/extras/selma/beans/AbstractSourceString.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Séven Le Mesle 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package fr.xebia.extras.selma.beans; 18 | 19 | /** 20 | * Created by slemesle on 15/04/2017. 21 | */ 22 | public class AbstractSourceString { 23 | 24 | private String id; 25 | 26 | public String getId() { 27 | return id; 28 | } 29 | 30 | public void setId(String id) { 31 | this.id = id; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /processor/src/test/java/fr/xebia/extras/selma/beans/Book.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Séven Le Mesle 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package fr.xebia.extras.selma.beans; 18 | 19 | /** 20 | * Created by slemesle on 21/06/2014. 21 | */ 22 | public class Book { 23 | 24 | private String name; 25 | 26 | private String author; 27 | 28 | public String getName() { 29 | return name; 30 | } 31 | 32 | public void setName(String name) { 33 | this.name = name; 34 | } 35 | 36 | public String getAuthor() { 37 | return author; 38 | } 39 | 40 | public void setAuthor(String author) { 41 | this.author = author; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /processor/src/test/java/fr/xebia/extras/selma/beans/BookDTO.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Séven Le Mesle 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package fr.xebia.extras.selma.beans; 18 | 19 | /** 20 | * Created by slemesle on 21/06/2014. 21 | */ 22 | public class BookDTO { 23 | private String name; 24 | private String author; 25 | 26 | public String getName() { 27 | return name; 28 | } 29 | 30 | public void setName(String name) { 31 | this.name = name; 32 | } 33 | 34 | public String getAuthor() { 35 | return author; 36 | } 37 | 38 | public void setAuthor(String author) { 39 | this.author = author; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /processor/src/test/java/fr/xebia/extras/selma/beans/BuilderIn.java: -------------------------------------------------------------------------------- 1 | package fr.xebia.extras.selma.beans; 2 | 3 | /** 4 | * Bean used to test Builder-style properties. 5 | */ 6 | public class BuilderIn { 7 | private String str; 8 | private int intVal; 9 | 10 | public int getIntVal() { 11 | return intVal; 12 | } 13 | 14 | public void setIntVal(int intVal) { 15 | this.intVal = intVal; 16 | } 17 | 18 | public String getStr() { 19 | return str; 20 | } 21 | 22 | public void setStr(String str) { 23 | this.str = str; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /processor/src/test/java/fr/xebia/extras/selma/beans/BuilderOut.java: -------------------------------------------------------------------------------- 1 | package fr.xebia.extras.selma.beans; 2 | 3 | /** 4 | * Bean used to test Builder-style properties. 5 | */ 6 | public class BuilderOut extends AbstractBuilderOut { 7 | private int intVal; 8 | 9 | public int getIntVal() { 10 | return intVal; 11 | } 12 | 13 | public BuilderOut setIntVal(int intVal) { 14 | this.intVal = intVal; 15 | return this; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /processor/src/test/java/fr/xebia/extras/selma/beans/CircularReference.java: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | */ 4 | package fr.xebia.extras.selma.beans; 5 | 6 | /** 7 | * Bean with circular reference 8 | */ 9 | public class CircularReference { 10 | 11 | private String value; 12 | 13 | private CircularReference ref; 14 | 15 | public CircularReference() { 16 | 17 | } 18 | 19 | public CircularReference(String value) { 20 | super(); 21 | this.value = value; 22 | } 23 | 24 | public String getValue() { 25 | return value; 26 | } 27 | 28 | public void setValue(String value) { 29 | this.value = value; 30 | } 31 | 32 | public CircularReference getRef() { 33 | return ref; 34 | } 35 | 36 | public void setRef(CircularReference ref) { 37 | this.ref = ref; 38 | } 39 | 40 | } 41 | -------------------------------------------------------------------------------- /processor/src/test/java/fr/xebia/extras/selma/beans/CollectionBeanDestination.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Xebia and Séven Le Mesle 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package fr.xebia.extras.selma.beans; 18 | 19 | import java.util.ArrayList; 20 | import java.util.List; 21 | 22 | /** 23 | * 24 | */ 25 | public class CollectionBeanDestination { 26 | 27 | private List strings; 28 | 29 | public CollectionBeanDestination() { 30 | } 31 | 32 | public CollectionBeanDestination(List strings) { 33 | this.strings = strings; 34 | } 35 | 36 | public List getStrings() { 37 | if (strings == null) { 38 | strings = new ArrayList(); 39 | } 40 | return strings; 41 | } 42 | 43 | } 44 | -------------------------------------------------------------------------------- /processor/src/test/java/fr/xebia/extras/selma/beans/CollectionBeanSource.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Xebia and Séven Le Mesle 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package fr.xebia.extras.selma.beans; 18 | 19 | import java.util.ArrayList; 20 | import java.util.List; 21 | 22 | /** 23 | * 24 | */ 25 | public class CollectionBeanSource { 26 | 27 | private List strings; 28 | 29 | public CollectionBeanSource(List strings) { 30 | this.strings = strings; 31 | } 32 | 33 | public List getStrings() { 34 | if (strings == null) { 35 | strings = new ArrayList(); 36 | } 37 | return strings; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /processor/src/test/java/fr/xebia/extras/selma/beans/DataSource.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Xebia and Séven Le Mesle 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package fr.xebia.extras.selma.beans; 18 | 19 | /** 20 | * 21 | */ 22 | public class DataSource { 23 | 24 | 25 | } 26 | -------------------------------------------------------------------------------- /processor/src/test/java/fr/xebia/extras/selma/beans/DestinationString.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Séven Le Mesle 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package fr.xebia.extras.selma.beans; 18 | 19 | /** 20 | * Created by slemesle on 15/04/2017. 21 | */ 22 | public class DestinationString { 23 | 24 | private String id; 25 | 26 | public String getId() { 27 | return id; 28 | } 29 | public void setId(String id) { 30 | this.id = id; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /processor/src/test/java/fr/xebia/extras/selma/beans/EnumA.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Séven Le Mesle 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package fr.xebia.extras.selma.beans; 18 | 19 | /** 20 | * Created by slemesle on 12/03/2014. 21 | */ 22 | public enum EnumA { 23 | 24 | 25 | A, B, C 26 | } 27 | -------------------------------------------------------------------------------- /processor/src/test/java/fr/xebia/extras/selma/beans/EnumB.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Séven Le Mesle 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package fr.xebia.extras.selma.beans; 18 | 19 | /** 20 | * Created by slemesle on 12/03/2014. 21 | */ 22 | public enum EnumB { 23 | 24 | 25 | A, C 26 | } 27 | -------------------------------------------------------------------------------- /processor/src/test/java/fr/xebia/extras/selma/beans/EnumBeanA.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Séven Le Mesle 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package fr.xebia.extras.selma.beans; 18 | 19 | /** 20 | * Created by slemesle on 10/11/14. 21 | */ 22 | public class EnumBeanA { 23 | 24 | private EnumA myEnum; 25 | 26 | public EnumA getMyEnum() { 27 | return myEnum; 28 | } 29 | 30 | public void setMyEnum(EnumA myEnum) { 31 | this.myEnum = myEnum; 32 | } 33 | } 34 | 35 | -------------------------------------------------------------------------------- /processor/src/test/java/fr/xebia/extras/selma/beans/EnumBeanB.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Séven Le Mesle 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package fr.xebia.extras.selma.beans; 18 | 19 | /** 20 | * Created by slemesle on 10/11/14. 21 | */ 22 | public class EnumBeanB { 23 | 24 | private EnumB myEnum; 25 | 26 | public EnumB getMyEnum() { 27 | return myEnum; 28 | } 29 | 30 | public void setMyEnum(EnumB myEnum) { 31 | this.myEnum = myEnum; 32 | } 33 | } 34 | 35 | -------------------------------------------------------------------------------- /processor/src/test/java/fr/xebia/extras/selma/beans/EnumBeanIn.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Séven Le Mesle 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package fr.xebia.extras.selma.beans; 18 | 19 | /** 20 | * Created by slemesle on 19/06/2014. 21 | */ 22 | public class EnumBeanIn { 23 | 24 | private EnumIn enumIn; 25 | 26 | public EnumIn getEnumIn() { 27 | return enumIn; 28 | } 29 | 30 | public void setEnumIn(EnumIn enumIn) { 31 | this.enumIn = enumIn; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /processor/src/test/java/fr/xebia/extras/selma/beans/EnumBeanOut.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Séven Le Mesle 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package fr.xebia.extras.selma.beans; 18 | 19 | /** 20 | * Created by slemesle on 19/06/2014. 21 | */ 22 | public class EnumBeanOut { 23 | 24 | private EnumIn enumIn; 25 | 26 | public EnumIn getEnumIn() { 27 | return enumIn; 28 | } 29 | 30 | public void setEnumIn(EnumIn enumIn) { 31 | this.enumIn = enumIn; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /processor/src/test/java/fr/xebia/extras/selma/beans/EnumIn.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Xebia and Séven Le Mesle 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package fr.xebia.extras.selma.beans; 18 | 19 | /** 20 | * Created with IntelliJ IDEA. 21 | * User: slemesle 22 | * Date: 19/11/2013 23 | * Time: 11:08 24 | * To change this template use File | Settings | File Templates. 25 | */ 26 | public enum EnumIn { 27 | 28 | VAL_1, 29 | VAL_2, 30 | VAL_3, 31 | VAL_4 32 | 33 | } 34 | -------------------------------------------------------------------------------- /processor/src/test/java/fr/xebia/extras/selma/beans/EnumOut.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Xebia and Séven Le Mesle 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package fr.xebia.extras.selma.beans; 18 | 19 | /** 20 | * Created with IntelliJ IDEA. 21 | * User: slemesle 22 | * Date: 19/11/2013 23 | * Time: 11:08 24 | * To change this template use File | Settings | File Templates. 25 | */ 26 | public enum EnumOut { 27 | 28 | VAL_1, 29 | VAL_2, 30 | VAL_3, 31 | VAL_4 32 | 33 | } 34 | -------------------------------------------------------------------------------- /processor/src/test/java/fr/xebia/extras/selma/beans/ExtendedCityIn.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Xebia and Séven Le Mesle 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package fr.xebia.extras.selma.beans; 18 | 19 | /** 20 | * 21 | */ 22 | public class ExtendedCityIn extends CityIn { 23 | 24 | private String addedField; 25 | 26 | public String getAddedField() { 27 | return addedField; 28 | } 29 | 30 | public void setAddedField(String addedField) { 31 | this.addedField = addedField; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /processor/src/test/java/fr/xebia/extras/selma/beans/ExtendedCityOut.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Xebia and Séven Le Mesle 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package fr.xebia.extras.selma.beans; 18 | 19 | /** 20 | * 21 | */ 22 | public class ExtendedCityOut extends CityOut { 23 | 24 | private String addedField; 25 | 26 | public String getAddedField() { 27 | return addedField; 28 | } 29 | 30 | public void setAddedField(String addedField) { 31 | this.addedField = addedField; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /processor/src/test/java/fr/xebia/extras/selma/beans/FirstBean.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Séven Le Mesle 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package fr.xebia.extras.selma.beans; 18 | 19 | /** 20 | * Created by slemesle on 27/02/2017. 21 | */ 22 | public class FirstBean { 23 | 24 | private String firstName; 25 | private Long age; 26 | private String lastName; 27 | 28 | public String getFirstName() { 29 | return firstName; 30 | } 31 | 32 | public void setFirstName(String firstName) { 33 | this.firstName = firstName; 34 | } 35 | 36 | public Long getAge() { 37 | return age; 38 | } 39 | 40 | public void setAge(Long age) { 41 | this.age = age; 42 | } 43 | 44 | public String getLastName() { 45 | return lastName; 46 | } 47 | 48 | public void setLastName(String lastName) { 49 | this.lastName = lastName; 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /processor/src/test/java/fr/xebia/extras/selma/beans/Home.java: -------------------------------------------------------------------------------- 1 | package fr.xebia.extras.selma.beans; 2 | 3 | /** 4 | * @author FaniloRandria 5 | */ 6 | public class Home { 7 | 8 | private Phone phoneHome; 9 | 10 | public Home (Phone phoneHome) { 11 | this.phoneHome = phoneHome; 12 | } 13 | 14 | public Phone getPhoneHome() { 15 | return phoneHome; 16 | } 17 | 18 | public void setPhoneHome(Phone phoneHome) { 19 | this.phoneHome = phoneHome; 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /processor/src/test/java/fr/xebia/extras/selma/beans/HomeDto.java: -------------------------------------------------------------------------------- 1 | package fr.xebia.extras.selma.beans; 2 | 3 | /** 4 | * @author FaniloRandria 5 | */ 6 | public class HomeDto { 7 | 8 | public String phone; 9 | 10 | public String getPhone() { 11 | return phone; 12 | } 13 | 14 | public void setPhone(String phone) { 15 | this.phone = phone; 16 | } 17 | 18 | } 19 | -------------------------------------------------------------------------------- /processor/src/test/java/fr/xebia/extras/selma/beans/IbanRest.java: -------------------------------------------------------------------------------- 1 | package fr.xebia.extras.selma.beans; 2 | 3 | public class IbanRest { 4 | 5 | private Integer codeBanque; 6 | 7 | private Integer codeBanqueDomiciliation; 8 | 9 | public IbanRest() { 10 | 11 | } 12 | 13 | public IbanRest(Integer codeBanque, Integer codeBanqueDomiciliation) { 14 | this.codeBanque = codeBanque; 15 | this.codeBanqueDomiciliation = codeBanqueDomiciliation; 16 | } 17 | 18 | public Integer getCodeBanque() { 19 | return codeBanque; 20 | } 21 | 22 | public void setCodeBanque(final Integer codeBanque) { 23 | this.codeBanque = codeBanque; 24 | } 25 | 26 | public Integer getCodeBanqueDomiciliation() { 27 | return codeBanqueDomiciliation; 28 | } 29 | 30 | public void setCodeBanqueDomiciliation(final Integer codeBanqueDomiciliation) { 31 | this.codeBanqueDomiciliation = codeBanqueDomiciliation; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /processor/src/test/java/fr/xebia/extras/selma/beans/LibraryDTO.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Séven Le Mesle 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package fr.xebia.extras.selma.beans; 18 | 19 | import java.util.Date; 20 | import java.util.List; 21 | 22 | /** 23 | * Created by slemesle on 21/06/2014. 24 | */ 25 | public class LibraryDTO { 26 | 27 | private List books; 28 | 29 | private Date dateField; 30 | 31 | 32 | public List getBooks() { 33 | return books; 34 | } 35 | 36 | public void setBooks(List books) { 37 | this.books = books; 38 | } 39 | 40 | public Date getDateField() { 41 | return dateField; 42 | } 43 | 44 | public void setDateField(Date dateField) { 45 | this.dateField = dateField; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /processor/src/test/java/fr/xebia/extras/selma/beans/LinkedBlockingListBean.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Séven Le Mesle 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package fr.xebia.extras.selma.beans; 18 | 19 | import java.util.concurrent.LinkedBlockingQueue; 20 | 21 | /** 22 | * Created by slemesle on 30/05/2017. 23 | */ 24 | public class LinkedBlockingListBean { 25 | LinkedBlockingQueue list = new LinkedBlockingQueue(); 26 | 27 | public LinkedBlockingQueue getList() { 28 | return list; 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /processor/src/test/java/fr/xebia/extras/selma/beans/LinkedListBean.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Séven Le Mesle 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package fr.xebia.extras.selma.beans; 18 | 19 | import java.util.LinkedList; 20 | 21 | /** 22 | * Created by slemesle on 30/05/2017. 23 | */ 24 | public class LinkedListBean { 25 | LinkedList list; 26 | 27 | public LinkedList getList() { 28 | return list; 29 | } 30 | 31 | public void setList(LinkedList list) { 32 | this.list = list; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /processor/src/test/java/fr/xebia/extras/selma/beans/NoGetterBean.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Séven Le Mesle 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package fr.xebia.extras.selma.beans; 18 | 19 | /** 20 | * Created by slemesle on 13/11/14. 21 | */ 22 | public class NoGetterBean { 23 | 24 | private String field; 25 | 26 | public void setField(String field) { 27 | this.field = field; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /processor/src/test/java/fr/xebia/extras/selma/beans/Passenger.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Séven Le Mesle 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package fr.xebia.extras.selma.beans; 18 | 19 | import java.util.Date; 20 | 21 | /** 22 | * Created by slemesle on 23/11/14. 23 | */ 24 | public class Passenger { 25 | 26 | private int age; 27 | private String card; 28 | private Date date; 29 | 30 | public Date getDate() { 31 | return date; 32 | } 33 | 34 | public void setDate(Date date) { 35 | this.date = date; 36 | } 37 | 38 | public int getAge() { 39 | return age; 40 | } 41 | 42 | public void setAge(int age) { 43 | this.age = age; 44 | } 45 | 46 | public String getCard() { 47 | return card; 48 | } 49 | 50 | public void setCard(String card) { 51 | this.card = card; 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /processor/src/test/java/fr/xebia/extras/selma/beans/Person.java: -------------------------------------------------------------------------------- 1 | package fr.xebia.extras.selma.beans; 2 | 3 | /** 4 | * Created by dtente on 28/09/2016. 5 | */ 6 | public interface Person { 7 | 8 | String getNom(); 9 | 10 | String getPrenom(); 11 | 12 | } 13 | -------------------------------------------------------------------------------- /processor/src/test/java/fr/xebia/extras/selma/beans/PersonDto.java: -------------------------------------------------------------------------------- 1 | package fr.xebia.extras.selma.beans; 2 | 3 | /** 4 | * Created by dtente on 28/09/2016. 5 | */ 6 | public class PersonDto { 7 | 8 | private String nom; 9 | 10 | private String prenom; 11 | 12 | public PersonDto() { 13 | } 14 | 15 | public void setNom(String nom) { 16 | this.nom = nom; 17 | } 18 | 19 | public void setPrenom(String prenom) { 20 | this.prenom = prenom; 21 | } 22 | 23 | public String getNom() { 24 | return this.nom; 25 | } 26 | 27 | public String getPrenom() { 28 | return this.prenom; 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /processor/src/test/java/fr/xebia/extras/selma/beans/PersonImpl.java: -------------------------------------------------------------------------------- 1 | package fr.xebia.extras.selma.beans; 2 | 3 | /** 4 | * Created by dtente on 28/09/2016. 5 | */ 6 | public class PersonImpl implements Person { 7 | 8 | private String nom; 9 | 10 | private String prenom; 11 | 12 | public PersonImpl() { 13 | } 14 | 15 | public PersonImpl(String nom, String prenom) { 16 | this.nom = nom; 17 | this.prenom = prenom; 18 | } 19 | 20 | public String getNom() { 21 | return this.nom; 22 | } 23 | 24 | public String getPrenom() { 25 | return this.prenom; 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /processor/src/test/java/fr/xebia/extras/selma/beans/Phone.java: -------------------------------------------------------------------------------- 1 | package fr.xebia.extras.selma.beans; 2 | 3 | /** 4 | * @author FaniloRandria 5 | */ 6 | public class Phone { 7 | 8 | private String phoneNumber; 9 | 10 | public Phone (String phoneNumber) { 11 | this.phoneNumber = phoneNumber; 12 | } 13 | 14 | public String getPhoneNumber() { 15 | return phoneNumber; 16 | } 17 | 18 | public void setPhoneNumber(String phoneNumber) { 19 | this.phoneNumber = phoneNumber; 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /processor/src/test/java/fr/xebia/extras/selma/beans/RawBean.java: -------------------------------------------------------------------------------- 1 | package fr.xebia.extras.selma.beans; 2 | 3 | public class RawBean { 4 | private Object object; 5 | 6 | public Object getObject() { 7 | return object; 8 | } 9 | 10 | public void setObject(Object object) { 11 | this.object = object; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /processor/src/test/java/fr/xebia/extras/selma/beans/RawCollectionBeanDestination.java: -------------------------------------------------------------------------------- 1 | package fr.xebia.extras.selma.beans; 2 | 3 | import java.util.List; 4 | import java.util.Map; 5 | 6 | public class RawCollectionBeanDestination { 7 | private List stringList; 8 | private Map intMap; 9 | 10 | public Map getIntMap() { 11 | return intMap; 12 | } 13 | 14 | public void setIntMap(Map intMap) { 15 | this.intMap = intMap; 16 | } 17 | 18 | public List getStringList() { 19 | return stringList; 20 | } 21 | 22 | public void setStringList(List stringList) { 23 | this.stringList = stringList; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /processor/src/test/java/fr/xebia/extras/selma/beans/RawCollectionBeanSource.java: -------------------------------------------------------------------------------- 1 | package fr.xebia.extras.selma.beans; 2 | 3 | import java.util.List; 4 | import java.util.Map; 5 | 6 | public class RawCollectionBeanSource { 7 | private List stringList; 8 | private Map intMap; 9 | 10 | public List getStringList() { 11 | return stringList; 12 | } 13 | 14 | public void setStringList(List stringList) { 15 | this.stringList = stringList; 16 | } 17 | 18 | public Map getIntMap() { 19 | return intMap; 20 | } 21 | 22 | public void setIntMap(Map intMap) { 23 | this.intMap = intMap; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /processor/src/test/java/fr/xebia/extras/selma/beans/RawListBean.java: -------------------------------------------------------------------------------- 1 | package fr.xebia.extras.selma.beans; 2 | 3 | import java.util.List; 4 | 5 | public class RawListBean { 6 | private List rawList; 7 | 8 | public List getRawList() { 9 | return rawList; 10 | } 11 | 12 | public void setRawList(List rawList) { 13 | this.rawList = rawList; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /processor/src/test/java/fr/xebia/extras/selma/beans/RawMapBean.java: -------------------------------------------------------------------------------- 1 | package fr.xebia.extras.selma.beans; 2 | 3 | import java.util.Map; 4 | 5 | public class RawMapBean { 6 | private Map rawMap; 7 | 8 | public Map getRawMap() { 9 | return rawMap; 10 | } 11 | 12 | public void setRawMap(Map rawMap) { 13 | this.rawMap = rawMap; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /processor/src/test/java/fr/xebia/extras/selma/beans/Rib.java: -------------------------------------------------------------------------------- 1 | package fr.xebia.extras.selma.beans; 2 | 3 | public class Rib { 4 | 5 | private Integer codeBanque; 6 | 7 | private Integer codeBanqueCompensation; 8 | 9 | public Rib() { 10 | 11 | } 12 | 13 | public Rib(Integer codeBanque, Integer codeBanqueCompensation) { 14 | this.codeBanque = codeBanque; 15 | this.codeBanqueCompensation = codeBanqueCompensation; 16 | } 17 | 18 | public Integer getCodeBanque() { 19 | return codeBanque; 20 | } 21 | 22 | public void setCodeBanque(final Integer codeBanque) { 23 | this.codeBanque = codeBanque; 24 | } 25 | 26 | public Integer getCodeBanqueCompensation() { 27 | return codeBanqueCompensation; 28 | } 29 | 30 | public void setCodeBanqueCompensation(final Integer codeBanqueCompensation) { 31 | this.codeBanqueCompensation = codeBanqueCompensation; 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /processor/src/test/java/fr/xebia/extras/selma/beans/SimpleContacts.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Séven Le Mesle 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package fr.xebia.extras.selma.beans; 18 | 19 | import java.util.List; 20 | 21 | /** 22 | * Created by slemesle on 21/11/14. 23 | */ 24 | public class SimpleContacts { 25 | 26 | private List contacts; 27 | 28 | public List getContacts() { 29 | return contacts; 30 | } 31 | 32 | public void setContacts(List contacts) { 33 | this.contacts = contacts; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /processor/src/test/java/fr/xebia/extras/selma/beans/SimpleContactsDto.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Séven Le Mesle 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package fr.xebia.extras.selma.beans; 18 | 19 | import java.util.List; 20 | 21 | /** 22 | * Created by slemesle on 21/11/14. 23 | */ 24 | public class SimpleContactsDto { 25 | 26 | private List contacts; 27 | 28 | public List getContacts() { 29 | return contacts; 30 | } 31 | 32 | public void setContacts(List contacts) { 33 | this.contacts = contacts; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /processor/src/test/java/fr/xebia/extras/selma/beans/SimplePerson.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Séven Le Mesle 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package fr.xebia.extras.selma.beans; 18 | 19 | /** 20 | * Created by slemesle on 27/03/2014. 21 | */ 22 | public class SimplePerson { 23 | 24 | private String nom; 25 | private String prenom; 26 | private int age; 27 | 28 | public int getAge() { 29 | return age; 30 | } 31 | 32 | public void setAge(int age) { 33 | this.age = age; 34 | } 35 | 36 | public String getNom() { 37 | return nom; 38 | } 39 | 40 | public void setNom(String nom) { 41 | this.nom = nom; 42 | } 43 | 44 | public String getPrenom() { 45 | return prenom; 46 | } 47 | 48 | public void setPrenom(String prenom) { 49 | this.prenom = prenom; 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /processor/src/test/java/fr/xebia/extras/selma/beans/SourceString.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Séven Le Mesle 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package fr.xebia.extras.selma.beans; 18 | 19 | /** 20 | * Created by slemesle on 15/04/2017. 21 | */ 22 | public class SourceString extends AbstractSourceString { 23 | } 24 | -------------------------------------------------------------------------------- /processor/src/test/java/fr/xebia/extras/selma/beans/StringList.java: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | */ 4 | package fr.xebia.extras.selma.beans; 5 | 6 | import java.util.ArrayList; 7 | 8 | /** 9 | * @author juaudo 10 | */ 11 | public class StringList extends ArrayList { 12 | 13 | } 14 | -------------------------------------------------------------------------------- /processor/src/test/java/fr/xebia/extras/selma/beans/StringMap.java: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | */ 4 | package fr.xebia.extras.selma.beans; 5 | 6 | import java.util.HashMap; 7 | 8 | /** 9 | * @author juaudo 10 | */ 11 | public class StringMap extends HashMap { 12 | 13 | } 14 | -------------------------------------------------------------------------------- /processor/src/test/java/fr/xebia/extras/selma/beans/TicketOut.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Séven Le Mesle 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package fr.xebia.extras.selma.beans; 18 | 19 | /** 20 | * Created by slemesle on 17/10/2014. 21 | */ 22 | public class TicketOut { 23 | 24 | private String login; 25 | 26 | private TicketTocken tocken; 27 | 28 | public TicketOut() { 29 | } 30 | 31 | public TicketOut(String login, TicketTocken tocken) { 32 | this.login = login; 33 | this.tocken = tocken; 34 | } 35 | 36 | public String getLogin() { 37 | return login; 38 | } 39 | 40 | public void setLogin(String login) { 41 | this.login = login; 42 | } 43 | 44 | public TicketTocken getTocken() { 45 | return tocken; 46 | } 47 | 48 | public void setTocken(TicketTocken tocken) { 49 | this.tocken = tocken; 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /processor/src/test/java/fr/xebia/extras/selma/beans/TicketTocken.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Séven Le Mesle 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package fr.xebia.extras.selma.beans; 18 | 19 | import java.util.Date; 20 | 21 | /** 22 | * Created by slemesle on 17/10/2014. 23 | */ 24 | public class TicketTocken { 25 | 26 | private final String hash; 27 | private final Date expireAt; 28 | 29 | public TicketTocken(String hash, Date expireAt) { 30 | this.hash = hash; 31 | this.expireAt = expireAt; 32 | } 33 | 34 | 35 | public String getHash() { 36 | return hash; 37 | } 38 | 39 | public Date getExpireAt() { 40 | return expireAt; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /processor/src/test/java/fr/xebia/extras/selma/beans/immutable/ImmutablePackageBean.java: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | */ 4 | package fr.xebia.extras.selma.beans.immutable; 5 | 6 | /** 7 | * ImmutableBean in an immutable package 8 | */ 9 | public class ImmutablePackageBean { 10 | 11 | public String value; 12 | 13 | public String getValue() { 14 | return value; 15 | } 16 | 17 | public void setValue(String value) { 18 | this.value = value; 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /processor/src/test/java/fr/xebia/extras/selma/it/BuilderMapperIT.java: -------------------------------------------------------------------------------- 1 | package fr.xebia.extras.selma.it; 2 | 3 | import fr.xebia.extras.selma.Selma; 4 | import fr.xebia.extras.selma.beans.BuilderIn; 5 | import fr.xebia.extras.selma.beans.BuilderOut; 6 | import fr.xebia.extras.selma.it.mappers.BuilderMapper; 7 | import fr.xebia.extras.selma.it.utils.Compile; 8 | import fr.xebia.extras.selma.it.utils.IntegrationTestBase; 9 | import org.junit.Assert; 10 | import org.junit.Test; 11 | 12 | /** 13 | * 14 | */ 15 | @Compile(withClasses = BuilderMapper.class) 16 | public class BuilderMapperIT extends IntegrationTestBase { 17 | 18 | @Test 19 | public void builderMapper_should_map_properties() throws Exception { 20 | BuilderMapper mapper = Selma.getMapper(BuilderMapper.class); 21 | 22 | BuilderIn builderIn = new BuilderIn(); 23 | builderIn.setIntVal(5); 24 | builderIn.setStr("a string"); 25 | 26 | BuilderOut res = mapper.asBuilderOut(builderIn); 27 | 28 | Assert.assertNotNull(res); 29 | Assert.assertEquals(builderIn.getIntVal(), res.getIntVal()); 30 | Assert.assertEquals(builderIn.getStr(), res.getStr()); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /processor/src/test/java/fr/xebia/extras/selma/it/HomeMapperIT.java: -------------------------------------------------------------------------------- 1 | package fr.xebia.extras.selma.it; 2 | 3 | import static org.assertj.core.api.Assertions.assertThat; 4 | 5 | import org.junit.Test; 6 | 7 | import fr.xebia.extras.selma.Selma; 8 | import fr.xebia.extras.selma.beans.Home; 9 | import fr.xebia.extras.selma.beans.HomeDto; 10 | import fr.xebia.extras.selma.beans.Phone; 11 | import fr.xebia.extras.selma.it.mappers.HomeMapper; 12 | import fr.xebia.extras.selma.it.utils.Compile; 13 | import fr.xebia.extras.selma.it.utils.IntegrationTestBase; 14 | 15 | /** 16 | * @author FaniloRandria 17 | */ 18 | @Compile(withClasses = HomeMapper.class) 19 | public class HomeMapperIT extends IntegrationTestBase { 20 | 21 | public static final String NUMBER_PHONE = "06-11-22-33-44"; 22 | 23 | @Test 24 | public void beanMapperTest() throws Exception { 25 | HomeMapper mapper = Selma.getMapper(HomeMapper.class); 26 | Phone phone = new Phone(NUMBER_PHONE); 27 | Home home = new Home(phone); 28 | HomeDto homeDto = mapper.toDto(home); 29 | assertThat(homeDto.getPhone()).isEqualTo(NUMBER_PHONE); 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /processor/src/test/java/fr/xebia/extras/selma/it/IbanMapperIT.java: -------------------------------------------------------------------------------- 1 | package fr.xebia.extras.selma.it; 2 | 3 | import fr.xebia.extras.selma.Selma; 4 | import fr.xebia.extras.selma.beans.IbanRest; 5 | import fr.xebia.extras.selma.beans.Rib; 6 | import fr.xebia.extras.selma.it.mappers.IbanMapper; 7 | import fr.xebia.extras.selma.it.utils.Compile; 8 | import fr.xebia.extras.selma.it.utils.IntegrationTestBase; 9 | import org.junit.Assert; 10 | import org.junit.Test; 11 | 12 | @Compile(withClasses = {IbanMapper.class}) 13 | public class IbanMapperIT extends IntegrationTestBase { 14 | 15 | @Test 16 | public void startWith_Iban_to_Rib_Test() { 17 | final IbanMapper mapper = Selma.mapper(IbanMapper.class); 18 | 19 | IbanRest ibanRest = new IbanRest(12, 25); 20 | 21 | Rib rib = mapper.convert(ibanRest); 22 | 23 | Assert.assertEquals(ibanRest.getCodeBanque(), rib.getCodeBanque()); 24 | Assert.assertEquals(ibanRest.getCodeBanqueDomiciliation(), rib.getCodeBanqueCompensation()); 25 | } 26 | 27 | @Test 28 | public void startWith_Rib_to_Iban_Test() { 29 | final IbanMapper mapper = Selma.mapper(IbanMapper.class); 30 | 31 | Rib rib = new Rib(12, 25); 32 | 33 | IbanRest ibanRest = mapper.convert(rib); 34 | 35 | Assert.assertEquals(ibanRest.getCodeBanque(), rib.getCodeBanque()); 36 | Assert.assertEquals(ibanRest.getCodeBanqueDomiciliation(), rib.getCodeBanqueCompensation()); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /processor/src/test/java/fr/xebia/extras/selma/it/aggregation/AggregatedInterceptor.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Séven Le Mesle 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package fr.xebia.extras.selma.it.aggregation; 18 | 19 | import fr.xebia.extras.selma.beans.*; 20 | 21 | /** 22 | * Created by slemesle on 24/04/2017. 23 | */ 24 | public class AggregatedInterceptor { 25 | 26 | 27 | public static final int SALARY_INC = 10000; 28 | 29 | /** 30 | * Simply intercept in and out person after mapping process 31 | * 32 | */ 33 | public void intercept(FirstBean first, SecondBean second, AggregatedBean aggregatedBean) { 34 | 35 | aggregatedBean.setSalary(second.getSalary() + SALARY_INC); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /processor/src/test/java/fr/xebia/extras/selma/it/aggregation/FailingAggregationMapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Séven Le Mesle 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package fr.xebia.extras.selma.it.aggregation; 18 | 19 | import fr.xebia.extras.selma.Mapper; 20 | import fr.xebia.extras.selma.Maps; 21 | import fr.xebia.extras.selma.beans.AggregatedBean; 22 | import fr.xebia.extras.selma.beans.FirstBean; 23 | import fr.xebia.extras.selma.beans.PersonIn; 24 | import fr.xebia.extras.selma.beans.SecondBean; 25 | 26 | /** 27 | * This mapper interface demonstrate the use of Bean Aggregation. 28 | */ 29 | @Mapper 30 | public interface FailingAggregationMapper { 31 | 32 | AggregatedBean mapFromAggregate(FirstBean first, SecondBean second); 33 | 34 | } 35 | -------------------------------------------------------------------------------- /processor/src/test/java/fr/xebia/extras/selma/it/arrays/ArrayBeanDestination.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Séven Le Mesle 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package fr.xebia.extras.selma.it.arrays; 18 | 19 | /** 20 | * Created by slemesle on 25/11/2016. 21 | */ 22 | public class ArrayBeanDestination { 23 | private BeanDestination beans[]; 24 | 25 | public BeanDestination[] getBeans() { 26 | return this.beans; 27 | } 28 | 29 | public void setBeans(BeanDestination beans[]) { 30 | this.beans = beans; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /processor/src/test/java/fr/xebia/extras/selma/it/arrays/ArrayBeanMapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Séven Le Mesle 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package fr.xebia.extras.selma.it.arrays; 18 | 19 | 20 | import fr.xebia.extras.selma.Mapper; 21 | 22 | 23 | @Mapper 24 | public interface ArrayBeanMapper { 25 | 26 | ArrayBeanDestination asArrayBeanDestination(ArrayBeanSource in); 27 | } 28 | 29 | -------------------------------------------------------------------------------- /processor/src/test/java/fr/xebia/extras/selma/it/arrays/ArrayBeanSource.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Séven Le Mesle 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package fr.xebia.extras.selma.it.arrays; 18 | 19 | /** 20 | * Created by slemesle on 25/11/2016. 21 | */ 22 | public class ArrayBeanSource { 23 | private BeanSource beans[]; 24 | 25 | public ArrayBeanSource() { 26 | } 27 | 28 | public BeanSource[] getBeans() { 29 | return this.beans; 30 | } 31 | 32 | public void setBeans(BeanSource beans[]) { 33 | this.beans = beans; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /processor/src/test/java/fr/xebia/extras/selma/it/arrays/BeanDestination.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Séven Le Mesle 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package fr.xebia.extras.selma.it.arrays; 18 | 19 | /** 20 | * Created by slemesle on 25/11/2016. 21 | */ 22 | public class BeanDestination { 23 | private int foo; 24 | 25 | public BeanDestination() { 26 | } 27 | 28 | public int getFoo() { 29 | return foo; 30 | } 31 | 32 | public void setFoo(int foo) { 33 | this.foo = foo; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /processor/src/test/java/fr/xebia/extras/selma/it/arrays/BeanSource.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Séven Le Mesle 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package fr.xebia.extras.selma.it.arrays; 18 | 19 | /** 20 | * Created by slemesle on 25/11/2016. 21 | */ 22 | class BeanSource { 23 | private int foo; 24 | 25 | public int getFoo() { 26 | return this.foo; 27 | } 28 | 29 | public void setFoo(int foo) { 30 | this.foo = foo; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /processor/src/test/java/fr/xebia/extras/selma/it/bug/ConflictingClassAndFieldNameInCustomFieldIT.java: -------------------------------------------------------------------------------- 1 | package fr.xebia.extras.selma.it.bug; 2 | 3 | import fr.xebia.extras.selma.it.bug.beans.PersonMapper; 4 | import fr.xebia.extras.selma.it.utils.Compile; 5 | import fr.xebia.extras.selma.it.utils.IntegrationTestBase; 6 | import org.junit.Test; 7 | 8 | @Compile(withClasses = {}, withPackage = {"fr.xebia.extras.selma.it.bug.beans"}, shouldFail = true) 9 | public class ConflictingClassAndFieldNameInCustomFieldIT extends IntegrationTestBase { 10 | 11 | @Test 12 | public void compilation_should_fail_on_custom_fields() throws Exception { 13 | 14 | assertCompilationError(PersonMapper.class, "PersonDto asDto(Person person);", 15 | "Mapping custom field city from source bean fr.xebia.extras.selma.it.bug.beans.Address, setter for " + 16 | "field addresscity is missing in destination bean fr.xebia.extras.selma.it.bug.beans.AddressDto !"); 17 | 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /processor/src/test/java/fr/xebia/extras/selma/it/bug/beans/Address.java: -------------------------------------------------------------------------------- 1 | package fr.xebia.extras.selma.it.bug.beans; 2 | 3 | public class Address { 4 | 5 | private String street; 6 | 7 | private String zipCode; 8 | 9 | private String city; 10 | 11 | private String country; 12 | 13 | public String getZipCode() { 14 | return zipCode; 15 | } 16 | 17 | public void setZipCode(String zipCode) { 18 | this.zipCode = zipCode; 19 | } 20 | 21 | public String getCity() { 22 | return city; 23 | } 24 | 25 | public void setCity(String city) { 26 | this.city = city; 27 | } 28 | 29 | public String getCountry() { 30 | return country; 31 | } 32 | 33 | public void setCountry(String country) { 34 | this.country = country; 35 | } 36 | 37 | public String getStreet() { 38 | return street; 39 | } 40 | 41 | public void setStreet(String street) { 42 | this.street = street; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /processor/src/test/java/fr/xebia/extras/selma/it/bug/beans/AddressDto.java: -------------------------------------------------------------------------------- 1 | package fr.xebia.extras.selma.it.bug.beans; 2 | 3 | public class AddressDto { 4 | 5 | private String street; 6 | private String zipCode; 7 | private String city; 8 | private String country; 9 | 10 | public String getZipCode() { 11 | return zipCode; 12 | } 13 | 14 | public void setZipCode(String zipCode) { 15 | this.zipCode = zipCode; 16 | } 17 | 18 | public String getCity() { 19 | return city; 20 | } 21 | 22 | public void setCity(String city) { 23 | this.city = city; 24 | } 25 | 26 | public String getCountry() { 27 | return country; 28 | } 29 | 30 | public void setCountry(String country) { 31 | this.country = country; 32 | } 33 | 34 | public String getStreet() { 35 | return street; 36 | } 37 | 38 | public void setStreet(String street) { 39 | this.street = street; 40 | } 41 | } -------------------------------------------------------------------------------- /processor/src/test/java/fr/xebia/extras/selma/it/bug/beans/Person.java: -------------------------------------------------------------------------------- 1 | package fr.xebia.extras.selma.it.bug.beans; 2 | 3 | import java.util.Collections; 4 | import java.util.List; 5 | 6 | public class Person { 7 | private String name; 8 | 9 | private Address address; 10 | 11 | private List
additionalAddresses = Collections.emptyList(); 12 | 13 | public Person() { 14 | } 15 | 16 | public Person(String name) { 17 | this.name = name; 18 | } 19 | 20 | public String getName() { 21 | return name; 22 | } 23 | 24 | public void setName(String name) { 25 | this.name = name; 26 | } 27 | 28 | public Address getAddress() { 29 | return address; 30 | } 31 | 32 | public void setAddress(Address address) { 33 | this.address = address; 34 | } 35 | 36 | public List
getAdditionalAddresses() { 37 | return additionalAddresses; 38 | } 39 | 40 | public void setAdditionalAddresses(List
additionalAddresses) { 41 | this.additionalAddresses = additionalAddresses; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /processor/src/test/java/fr/xebia/extras/selma/it/bug/beans/PersonMapper.java: -------------------------------------------------------------------------------- 1 | package fr.xebia.extras.selma.it.bug.beans; 2 | 3 | import fr.xebia.extras.selma.Field; 4 | import fr.xebia.extras.selma.Mapper; 5 | 6 | @Mapper( 7 | withCustomFields = { 8 | @Field({"address.street", "addressStreet"}), 9 | @Field({"address.zipCode", "addressZipCode"}), 10 | @Field({"address.city", "addressCity"}), 11 | @Field({"address.country", "addressCountry"}) 12 | } 13 | ) 14 | public interface PersonMapper { 15 | Person asModel(PersonDto personDto); 16 | 17 | PersonDto asDto(Person person); 18 | } 19 | -------------------------------------------------------------------------------- /processor/src/test/java/fr/xebia/extras/selma/it/bug/source/Person.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Séven Le Mesle 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package fr.xebia.extras.selma.it.bug.source; 18 | 19 | /** 20 | * Created by slemesle on 02/08/2016. 21 | */ 22 | public class Person { 23 | 24 | String firstName; 25 | 26 | public Person (String firstName) { 27 | this.firstName = firstName; 28 | } 29 | 30 | public String getFirstName() { 31 | return firstName; 32 | } 33 | 34 | public void setFirstName(String firstName) { 35 | this.firstName = firstName; 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /processor/src/test/java/fr/xebia/extras/selma/it/bug/source/PersonDto.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Séven Le Mesle 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package fr.xebia.extras.selma.it.bug.source; 18 | 19 | import java.util.Date; 20 | 21 | /** 22 | * Created by slemesle on 02/08/2016. 23 | */ 24 | public class PersonDto { 25 | 26 | public final Date birthDate; 27 | private String firstName; 28 | 29 | public PersonDto(Date birthDate) { 30 | this.birthDate = birthDate; 31 | } 32 | 33 | public PersonDto() { 34 | this.birthDate = null; 35 | } 36 | 37 | public String getFirstName() { 38 | return firstName; 39 | } 40 | 41 | public void setFirstName(String firstName) { 42 | this.firstName = firstName; 43 | } 44 | 45 | } 46 | -------------------------------------------------------------------------------- /processor/src/test/java/fr/xebia/extras/selma/it/bug/source/SourcedPersonMapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Séven Le Mesle 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package fr.xebia.extras.selma.it.bug.source; 18 | 19 | import fr.xebia.extras.selma.Mapper; 20 | 21 | import java.util.Date; 22 | 23 | /** 24 | * Created by slemesle on 02/08/2016. 25 | */ 26 | @Mapper(withSources = Date.class) 27 | public interface SourcedPersonMapper { 28 | 29 | PersonDto personToPersonDto(Person person); 30 | 31 | } 32 | -------------------------------------------------------------------------------- /processor/src/test/java/fr/xebia/extras/selma/it/collection/IterableMapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Séven Le Mesle 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package fr.xebia.extras.selma.it.collection; 18 | 19 | import fr.xebia.extras.selma.Mapper; 20 | 21 | import java.util.Collection; 22 | 23 | /** 24 | * Created by slemesle on 09/06/2017. 25 | */ 26 | @Mapper 27 | public interface IterableMapper { 28 | 29 | Iterable toIterables(Collection numbers); 30 | 31 | Collection toCollection(Iterable numbers); 32 | 33 | } 34 | -------------------------------------------------------------------------------- /processor/src/test/java/fr/xebia/extras/selma/it/collection/RawBeanMapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Xebia and Séven Le Mesle 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package fr.xebia.extras.selma.it.collection; 18 | 19 | import fr.xebia.extras.selma.Mapper; 20 | import fr.xebia.extras.selma.beans.RawBean; 21 | import fr.xebia.extras.selma.beans.RawListBean; 22 | import fr.xebia.extras.selma.beans.RawMapBean; 23 | 24 | /** 25 | * Have to use separate methods (and thus beans) as JDK7 doesn't reliably print multiple compile errors from the same 26 | * compilation method (ie the clone() methods). 27 | */ 28 | @Mapper 29 | public interface RawBeanMapper { 30 | 31 | RawBean clone(RawBean rawBean); 32 | 33 | RawListBean clone(RawListBean rawBean); 34 | 35 | RawMapBean clone(RawMapBean rawBean); 36 | } 37 | -------------------------------------------------------------------------------- /processor/src/test/java/fr/xebia/extras/selma/it/collection/RawCollectionMapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Xebia and Séven Le Mesle 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package fr.xebia.extras.selma.it.collection; 18 | 19 | import fr.xebia.extras.selma.Mapper; 20 | import fr.xebia.extras.selma.beans.RawCollectionBeanDestination; 21 | import fr.xebia.extras.selma.beans.RawCollectionBeanSource; 22 | 23 | /** 24 | * 25 | */ 26 | @Mapper 27 | public interface RawCollectionMapper { 28 | RawCollectionBeanDestination asParameterizedToRawCollectionBeanDestination(RawCollectionBeanSource source); 29 | } 30 | -------------------------------------------------------------------------------- /processor/src/test/java/fr/xebia/extras/selma/it/collection/UpdateDeclaredCollectionMapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Séven Le Mesle 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package fr.xebia.extras.selma.it.collection; 18 | 19 | import fr.xebia.extras.selma.IgnoreMissing; 20 | import fr.xebia.extras.selma.Mapper; 21 | import fr.xebia.extras.selma.beans.Library; 22 | import fr.xebia.extras.selma.beans.LibraryDTO; 23 | 24 | @Mapper(withIgnoreMissing = IgnoreMissing.DESTINATION) 25 | public interface UpdateDeclaredCollectionMapper { 26 | 27 | LibraryDTO updateLibrary(Library from, LibraryDTO to); 28 | 29 | } 30 | -------------------------------------------------------------------------------- /processor/src/test/java/fr/xebia/extras/selma/it/custom/cyclic/CyclicBookMapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Séven Le Mesle 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package fr.xebia.extras.selma.it.custom.cyclic; 18 | 19 | import fr.xebia.extras.selma.Mapper; 20 | import fr.xebia.extras.selma.Maps; 21 | import fr.xebia.extras.selma.beans.AddressIn; 22 | import fr.xebia.extras.selma.beans.AddressOut; 23 | 24 | /** 25 | * Created by slemesle on 08/03/2018. 26 | */ 27 | @Mapper(withCyclicMapping = true) 28 | public interface CyclicBookMapper { 29 | 30 | @Maps(withIgnoreFields = "test") AddressOut asBookDTO(AddressIn book); 31 | } 32 | -------------------------------------------------------------------------------- /processor/src/test/java/fr/xebia/extras/selma/it/custom/cyclic/CyclicChainedMappers.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Séven Le Mesle 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package fr.xebia.extras.selma.it.custom.cyclic; 18 | 19 | import fr.xebia.extras.selma.Field; 20 | import fr.xebia.extras.selma.IgnoreMissing; 21 | import fr.xebia.extras.selma.Mapper; 22 | import fr.xebia.extras.selma.Maps; 23 | import fr.xebia.extras.selma.beans.PersonIn; 24 | import fr.xebia.extras.selma.beans.PersonOut; 25 | 26 | /** 27 | * Created by slemesle on 08/03/2018. 28 | */ 29 | @Mapper(withCyclicMapping = true, withIgnoreMissing = IgnoreMissing.ALL) 30 | public interface CyclicChainedMappers { 31 | 32 | @Maps(withCustomFields = { 33 | @Field(value = {"address"}, withCustom = CyclicBookMapper.class) 34 | }) PersonOut asLibraryDTO(PersonIn library); 35 | } 36 | -------------------------------------------------------------------------------- /processor/src/test/java/fr/xebia/extras/selma/it/custom/fields/FQCNOneCustomFieldToFieldMapping.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Séven Le Mesle 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package fr.xebia.extras.selma.it.custom.fields; 18 | 19 | import fr.xebia.extras.selma.Field; 20 | import fr.xebia.extras.selma.Mapper; 21 | import fr.xebia.extras.selma.Maps; 22 | import fr.xebia.extras.selma.beans.SimpleContacts; 23 | import fr.xebia.extras.selma.beans.SimpleContactsDto; 24 | 25 | /** 26 | * Created by slemesle on 21/11/14. 27 | */ 28 | @Mapper 29 | public interface FQCNOneCustomFieldToFieldMapping { 30 | 31 | @Maps(withCustomFields = { 32 | @Field({"SimplePerson.prenom", "firstname"}), @Field({"fr.xebia.extras.selma.beans.SimplePerson.nom", "lastname"}) 33 | }) SimpleContactsDto asContactsDto(SimpleContacts in); 34 | } 35 | -------------------------------------------------------------------------------- /processor/src/test/java/fr/xebia/extras/selma/it/custom/interceptor/AddressMappingInterceptor.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Séven Le Mesle 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package fr.xebia.extras.selma.it.custom.interceptor; 18 | 19 | import fr.xebia.extras.selma.beans.AddressIn; 20 | import fr.xebia.extras.selma.beans.AddressOut; 21 | 22 | /** 23 | * Created by slemesle on 26/03/2014. 24 | */ 25 | public class AddressMappingInterceptor { 26 | 27 | 28 | /** 29 | * Simply intercept in and out address after mapping process 30 | * 31 | * @param in 32 | * @param out 33 | */ 34 | public void intercept(AddressIn in, AddressOut out) { 35 | 36 | out.setNumber(in.getNumber()); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /processor/src/test/java/fr/xebia/extras/selma/it/custom/interceptor/MappingInterceptorForImmutable.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Séven Le Mesle 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package fr.xebia.extras.selma.it.custom.interceptor; 18 | 19 | import fr.xebia.extras.selma.beans.PersonIn; 20 | import fr.xebia.extras.selma.beans.PersonOut; 21 | 22 | /** 23 | * Created by slemesle on 26/03/2014. 24 | */ 25 | public class MappingInterceptorForImmutable { 26 | 27 | 28 | public static final String SALT = " Immutable BIO"; 29 | 30 | /** 31 | * Simply intercept in and out person after mapping process 32 | * 33 | * @param in 34 | * @param out 35 | */ 36 | public void intercept(PersonIn in, PersonOut out) { 37 | 38 | out.setBiography(in.getFirstName() + SALT); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /processor/src/test/java/fr/xebia/extras/selma/it/custom/interceptor/MappingInterceptorForMutable.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Séven Le Mesle 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package fr.xebia.extras.selma.it.custom.interceptor; 18 | 19 | import fr.xebia.extras.selma.beans.PersonIn; 20 | import fr.xebia.extras.selma.beans.PersonOut; 21 | 22 | /** 23 | * Created by slemesle on 26/03/2014. 24 | */ 25 | public class MappingInterceptorForMutable { 26 | 27 | 28 | public static final String SALT = " Mutable BIO"; 29 | 30 | /** 31 | * Simply intercept in and out person after mapping process 32 | * 33 | * @param in 34 | * @param out 35 | */ 36 | public void intercept(PersonIn in, PersonOut out) { 37 | 38 | out.setBiography(in.getFirstName() + SALT); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /processor/src/test/java/fr/xebia/extras/selma/it/custom/interceptor/NeverUsedMappingInterceptorInMapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Séven Le Mesle 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package fr.xebia.extras.selma.it.custom.interceptor; 18 | 19 | import fr.xebia.extras.selma.beans.PersonIn; 20 | import fr.xebia.extras.selma.beans.PersonOut; 21 | 22 | /** 23 | * Created by slemesle on 26/03/2014. 24 | */ 25 | public class NeverUsedMappingInterceptorInMapper { 26 | 27 | 28 | public static final String SALT = " Never used"; 29 | 30 | /** 31 | * Simply intercept in and out person after mapping process 32 | * 33 | * @param in 34 | * @param out 35 | */ 36 | public void intercept(final PersonIn in, final PersonOut out) { 37 | 38 | out.setBiography(in.getFirstName() + SALT); 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /processor/src/test/java/fr/xebia/extras/selma/it/custom/interceptor/NeverUsedMappingInterceptorInMaps.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Séven Le Mesle 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package fr.xebia.extras.selma.it.custom.interceptor; 18 | 19 | import fr.xebia.extras.selma.beans.Book; 20 | import fr.xebia.extras.selma.beans.BookDTO; 21 | 22 | /** 23 | * Created by slemesle on 26/03/2014. 24 | */ 25 | public class NeverUsedMappingInterceptorInMaps { 26 | 27 | 28 | /** 29 | * Simply intercept in and out person after mapping process 30 | * 31 | * @param in 32 | * @param out 33 | */ 34 | public void intercept(Book in, BookDTO out) { 35 | 36 | throw new UnsupportedOperationException("This interceptor should never be called"); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /processor/src/test/java/fr/xebia/extras/selma/it/custom/interceptor/beans/Validation.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Séven Le Mesle 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package fr.xebia.extras.selma.it.custom.interceptor.beans; 18 | 19 | import java.util.Calendar; 20 | 21 | /** 22 | * Created by slemesle on 08/06/2017. 23 | */ 24 | public class Validation { 25 | 26 | private Integer id; 27 | 28 | private Calendar validationDate; 29 | 30 | public Integer getId() { 31 | return id; 32 | } 33 | 34 | public void setId(Integer id) { 35 | this.id = id; 36 | } 37 | 38 | public Calendar getValidationDate() { 39 | return validationDate; 40 | } 41 | 42 | public void setValidationDate(Calendar validationDate) { 43 | this.validationDate = validationDate; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /processor/src/test/java/fr/xebia/extras/selma/it/custom/interceptor/beans/ValidationJson.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Séven Le Mesle 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package fr.xebia.extras.selma.it.custom.interceptor.beans; 18 | 19 | /** 20 | * Created by slemesle on 08/06/2017. 21 | */ 22 | public class ValidationJson { 23 | 24 | private Integer eventDateStamp; 25 | 26 | private Integer eventTimeStamp; 27 | 28 | public Integer getEventDateStamp() { 29 | return eventDateStamp; 30 | } 31 | 32 | public void setEventDateStamp(Integer eventDateStamp) { 33 | this.eventDateStamp = eventDateStamp; 34 | } 35 | 36 | public Integer getEventTimeStamp() { 37 | return eventTimeStamp; 38 | } 39 | 40 | public void setEventTimeStamp(Integer eventTimeStamp) { 41 | this.eventTimeStamp = eventTimeStamp; 42 | } 43 | 44 | } 45 | -------------------------------------------------------------------------------- /processor/src/test/java/fr/xebia/extras/selma/it/custom/mapper/AbstractMapperWithInterceptor.java: -------------------------------------------------------------------------------- 1 | package fr.xebia.extras.selma.it.custom.mapper; 2 | 3 | import fr.xebia.extras.selma.Mapper; 4 | import fr.xebia.extras.selma.beans.PersonIn; 5 | import fr.xebia.extras.selma.beans.PersonOut; 6 | 7 | /** 8 | * Created by v.koroteev on 10.05.2016. 9 | */ 10 | @Mapper(withIgnoreFields = {"fr.xebia.extras.selma.beans.PersonIn.male", "fr.xebia.extras.selma.beans.PersonOut.biography"}) 11 | public abstract class AbstractMapperWithInterceptor { 12 | 13 | public static final int NUMBER_INCREMENT = 10000; 14 | 15 | public abstract PersonOut asPersonOut(PersonIn in); 16 | 17 | public void interceptor(PersonIn in, PersonOut out) { 18 | out.getAddress().setNumber(in.getAddress().getNumber() + NUMBER_INCREMENT); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /processor/src/test/java/fr/xebia/extras/selma/it/custom/mapper/AddressMapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Séven Le Mesle 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package fr.xebia.extras.selma.it.custom.mapper; 18 | 19 | import fr.xebia.extras.selma.Mapper; 20 | import fr.xebia.extras.selma.beans.AddressIn; 21 | import fr.xebia.extras.selma.beans.AddressOut; 22 | 23 | /** 24 | * Created by slemesle on 25/03/15. 25 | */ 26 | @Mapper(withIgnoreFields = "extras", withCustom = CustomImmutableMapper.class) 27 | public interface AddressMapper { 28 | 29 | AddressOut asAddressOut(AddressIn in); 30 | 31 | AddressOut asAddressOut(AddressIn in, AddressOut out); 32 | 33 | AddressIn asAddressIn(AddressOut in); 34 | 35 | AddressIn asAddressIn(AddressOut in, AddressIn out); 36 | } 37 | -------------------------------------------------------------------------------- /processor/src/test/java/fr/xebia/extras/selma/it/custom/mapper/CustomCdiMapperInMaps.java: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright 2013 Xebia and Séven Le Mesle 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package fr.xebia.extras.selma.it.custom.mapper; 18 | 19 | import fr.xebia.extras.selma.IoC; 20 | import fr.xebia.extras.selma.Mapper; 21 | import fr.xebia.extras.selma.beans.Book; 22 | import fr.xebia.extras.selma.beans.BookDTO; 23 | 24 | @Mapper(withIoC = IoC.CDI) 25 | public interface CustomCdiMapperInMaps { 26 | 27 | Book asBook(BookDTO source); 28 | 29 | BookDTO asBookDto(Book source); 30 | 31 | } 32 | -------------------------------------------------------------------------------- /processor/src/test/java/fr/xebia/extras/selma/it/custom/mapper/CustomCdiSingletonMapperInMaps.java: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright 2013 Xebia and Séven Le Mesle 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package fr.xebia.extras.selma.it.custom.mapper; 18 | 19 | import fr.xebia.extras.selma.IoC; 20 | import fr.xebia.extras.selma.Mapper; 21 | import fr.xebia.extras.selma.beans.Book; 22 | import fr.xebia.extras.selma.beans.BookDTO; 23 | 24 | @Mapper(withIoC = IoC.CDI_SINGLETON) 25 | public interface CustomCdiSingletonMapperInMaps { 26 | 27 | Book asBook(BookDTO source); 28 | 29 | BookDTO asBookDto(Book source); 30 | 31 | } 32 | -------------------------------------------------------------------------------- /processor/src/test/java/fr/xebia/extras/selma/it/custom/mapper/CustomImmutableMapperInMapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Séven Le Mesle 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package fr.xebia.extras.selma.it.custom.mapper; 18 | 19 | import fr.xebia.extras.selma.beans.CityIn; 20 | import fr.xebia.extras.selma.beans.CityOut; 21 | 22 | /** 23 | * Created by slemesle on 19/11/14. 24 | */ 25 | public class CustomImmutableMapperInMapper { 26 | 27 | 28 | public static final String IMMUTABLY_MAPPED = " immutably mapped from mapper"; 29 | public static final int POPULATION_INC = 5; 30 | 31 | public CityOut mapCity(CityIn cityIn) { 32 | CityOut cityOut = new CityOut(); 33 | cityOut.setName(cityIn.getName() + IMMUTABLY_MAPPED); 34 | cityOut.setCapital(cityIn.isCapital()); 35 | cityOut.setPopulation(cityIn.getPopulation() + POPULATION_INC); 36 | return cityOut; 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /processor/src/test/java/fr/xebia/extras/selma/it/custom/mapper/CustomMapperDefaultsToImmutable.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Séven Le Mesle 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package fr.xebia.extras.selma.it.custom.mapper; 18 | 19 | import fr.xebia.extras.selma.Mapper; 20 | import fr.xebia.extras.selma.beans.PersonIn; 21 | import fr.xebia.extras.selma.beans.PersonOut; 22 | 23 | /** 24 | * Created by slemesle on 19/11/14. 25 | */ 26 | @Mapper(withCustom = CustomImmutableMapper.class, 27 | withIgnoreFields = {"fr.xebia.extras.selma.beans.PersonIn.male", "fr.xebia.extras.selma.beans.PersonOut.biography"}) 28 | public interface CustomMapperDefaultsToImmutable { 29 | 30 | PersonOut mapWithCustom(PersonIn in); 31 | 32 | PersonOut mapWithCustom(PersonIn in, PersonOut out); 33 | } 34 | -------------------------------------------------------------------------------- /processor/src/test/java/fr/xebia/extras/selma/it/custom/mapper/CustomMapperDefaultsToMutable.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Séven Le Mesle 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package fr.xebia.extras.selma.it.custom.mapper; 18 | 19 | import fr.xebia.extras.selma.Mapper; 20 | import fr.xebia.extras.selma.beans.PersonIn; 21 | import fr.xebia.extras.selma.beans.PersonOut; 22 | 23 | /** 24 | * Created by slemesle on 19/11/14. 25 | */ 26 | @Mapper(withCustom = CustomMutableMapper.class, 27 | withIgnoreFields = {"fr.xebia.extras.selma.beans.PersonIn.male", "fr.xebia.extras.selma.beans.PersonOut.biography"}) 28 | public interface CustomMapperDefaultsToMutable { 29 | 30 | PersonOut mapWithCustom(PersonIn in); 31 | 32 | PersonOut mapWithCustom(PersonIn in, PersonOut out); 33 | } 34 | -------------------------------------------------------------------------------- /processor/src/test/java/fr/xebia/extras/selma/it/custom/mapper/CustomMapperUsingSelmaMapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Séven Le Mesle 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package fr.xebia.extras.selma.it.custom.mapper; 18 | 19 | import fr.xebia.extras.selma.Mapper; 20 | import fr.xebia.extras.selma.beans.PersonIn; 21 | import fr.xebia.extras.selma.beans.PersonOut; 22 | 23 | /** 24 | * Created by slemesle on 19/11/14. 25 | */ 26 | @Mapper(withCustom = {AddressMapper.class}, 27 | withIgnoreFields = {"fr.xebia.extras.selma.beans.PersonIn.male", "fr.xebia.extras.selma.beans.PersonOut.biography"}) 28 | public interface CustomMapperUsingSelmaMapper { 29 | 30 | PersonOut mapWithAddressMapper(PersonIn in); 31 | 32 | PersonOut mapWithCustom(PersonIn in, PersonOut out); 33 | } 34 | -------------------------------------------------------------------------------- /processor/src/test/java/fr/xebia/extras/selma/it/custom/mapper/DateMapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Séven Le Mesle 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package fr.xebia.extras.selma.it.custom.mapper; 18 | 19 | import java.util.Date; 20 | 21 | /** 22 | * Created by slemesle on 03/04/15. 23 | */ 24 | public class DateMapper { 25 | 26 | public Long dateAsLong(Date date) { 27 | return date.getTime(); 28 | } 29 | 30 | public Date longAsDate(Long timestamp) { 31 | return new Date(timestamp); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /processor/src/test/java/fr/xebia/extras/selma/it/custom/mapper/DateToLongMapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Séven Le Mesle 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package fr.xebia.extras.selma.it.custom.mapper; 18 | 19 | import fr.xebia.extras.selma.Mapper; 20 | import fr.xebia.extras.selma.beans.DatePojo; 21 | import fr.xebia.extras.selma.beans.TimestampPojo; 22 | 23 | /** 24 | * Created by slemesle on 03/04/15. 25 | */ 26 | @Mapper(withCustom = DateMapper.class) 27 | public interface DateToLongMapper { 28 | 29 | 30 | TimestampPojo asTimestampPojo(DatePojo src); 31 | } 32 | -------------------------------------------------------------------------------- /processor/src/test/java/fr/xebia/extras/selma/it/custom/mapper/FailOnConflictMapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Séven Le Mesle 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package fr.xebia.extras.selma.it.custom.mapper; 18 | 19 | import fr.xebia.extras.selma.Mapper; 20 | 21 | /** 22 | * Created by slemesle on 02/08/2016. 23 | */ 24 | @Mapper(withCustom = FailOnConflictMapper.CustommConflictingMApper.class) 25 | public interface FailOnConflictMapper { 26 | 27 | 28 | String toString(String in); 29 | 30 | class CustommConflictingMApper { 31 | public String mapName(String name){ 32 | return name; 33 | } 34 | 35 | public String mapCode(String code){ 36 | return code; 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /processor/src/test/java/fr/xebia/extras/selma/it/custom/mapper/NeverUsedCustomMapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Séven Le Mesle 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package fr.xebia.extras.selma.it.custom.mapper; 18 | 19 | import fr.xebia.extras.selma.beans.Book; 20 | import fr.xebia.extras.selma.beans.BookDTO; 21 | 22 | /** 23 | * Created by slemesle on 21/11/14. 24 | */ 25 | public class NeverUsedCustomMapper { 26 | 27 | public BookDTO asBookDTO(Book book) { 28 | return null; 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /processor/src/test/java/fr/xebia/extras/selma/it/factory/BuildingIn.java: -------------------------------------------------------------------------------- 1 | package fr.xebia.extras.selma.it.factory; 2 | 3 | public class BuildingIn { 4 | private String name; 5 | private String street; 6 | private int number; 7 | 8 | public String getName() { 9 | return name; 10 | } 11 | 12 | public void setName(String name) { 13 | this.name = name; 14 | } 15 | 16 | public int getNumber() { 17 | return number; 18 | } 19 | 20 | public void setNumber(int number) { 21 | this.number = number; 22 | } 23 | 24 | public String getStreet() { 25 | return street; 26 | } 27 | 28 | public void setStreet(String street) { 29 | this.street = street; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /processor/src/test/java/fr/xebia/extras/selma/it/factory/BuildingOut.java: -------------------------------------------------------------------------------- 1 | package fr.xebia.extras.selma.it.factory; 2 | 3 | /** 4 | * Bean with no public constructor. 5 | */ 6 | public class BuildingOut { 7 | private String name; 8 | private String street; 9 | private int number; 10 | private BuildingOut() { 11 | } 12 | 13 | public static BuildingOut create() { 14 | return new BuildingOut(); 15 | } 16 | 17 | public String getName() { 18 | return name; 19 | } 20 | 21 | public void setName(String name) { 22 | this.name = name; 23 | } 24 | 25 | public int getNumber() { 26 | return number; 27 | } 28 | 29 | public void setNumber(int number) { 30 | this.number = number; 31 | } 32 | 33 | public String getStreet() { 34 | return street; 35 | } 36 | 37 | public void setStreet(String street) { 38 | this.street = street; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /processor/src/test/java/fr/xebia/extras/selma/it/factory/ExtendedAddressIn.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Séven Le Mesle 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package fr.xebia.extras.selma.it.factory; 18 | 19 | import fr.xebia.extras.selma.beans.AddressIn; 20 | 21 | /** 22 | * Created by slemesle on 15/03/2016. 23 | */ 24 | public class ExtendedAddressIn extends AddressIn { 25 | private BuildingIn building; 26 | 27 | public BuildingIn getBuilding() { 28 | return building; 29 | } 30 | 31 | public void setBuilding(BuildingIn building) { 32 | this.building = building; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /processor/src/test/java/fr/xebia/extras/selma/it/factory/ExtendedAddressOut.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Séven Le Mesle 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package fr.xebia.extras.selma.it.factory; 18 | 19 | import fr.xebia.extras.selma.beans.AddressOut; 20 | 21 | /** 22 | * Created by slemesle on 15/03/2016. 23 | */ 24 | public class ExtendedAddressOut extends AddressOut implements OutObject { 25 | private BuildingOut building; 26 | 27 | public BuildingOut getBuilding() { 28 | return building; 29 | } 30 | 31 | public void setBuilding(BuildingOut building) { 32 | this.building = building; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /processor/src/test/java/fr/xebia/extras/selma/it/factory/FactoryMapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Séven Le Mesle 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package fr.xebia.extras.selma.it.factory; 18 | 19 | import fr.xebia.extras.selma.Mapper; 20 | import fr.xebia.extras.selma.beans.AddressIn; 21 | import fr.xebia.extras.selma.beans.AddressOut; 22 | 23 | /** 24 | * Created by slemesle on 06/03/2016. 25 | */ 26 | @Mapper(withFactories = BeanFactory.class) 27 | public interface FactoryMapper { 28 | 29 | AddressOut asAddressOut(AddressIn in); 30 | 31 | ExtendedAddressOut asExtendedAddressOut(ExtendedAddressIn in); 32 | } 33 | -------------------------------------------------------------------------------- /processor/src/test/java/fr/xebia/extras/selma/it/factory/OutObject.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Séven Le Mesle 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package fr.xebia.extras.selma.it.factory; 18 | 19 | /** 20 | * Created by slemesle on 15/03/2016. 21 | */ 22 | public interface OutObject { 23 | } 24 | -------------------------------------------------------------------------------- /processor/src/test/java/fr/xebia/extras/selma/it/generic/FooMapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Séven Le Mesle 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package fr.xebia.extras.selma.it.generic; 18 | 19 | import fr.xebia.extras.selma.Field; 20 | import fr.xebia.extras.selma.Mapper; 21 | import fr.xebia.extras.selma.it.generic.beans.Bar; 22 | import fr.xebia.extras.selma.it.generic.beans.Foo; 23 | 24 | /** 25 | * Created by slemesle on 12/07/2017. 26 | */ 27 | @Mapper(withCustomFields = { 28 | @Field({"id", "item.id"}), 29 | @Field({"description", "item.description"}) 30 | }) 31 | public interface FooMapper { 32 | 33 | Foo asFoo(Bar bar); 34 | 35 | Bar asBar(Foo foo); 36 | } -------------------------------------------------------------------------------- /processor/src/test/java/fr/xebia/extras/selma/it/generic/GenericMapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Séven Le Mesle 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package fr.xebia.extras.selma.it.generic; 18 | 19 | /** 20 | * Created by slemesle on 25/11/15. 21 | */ 22 | public interface GenericMapper { 23 | 24 | B asEntity(A source); 25 | 26 | A asDto(B source); 27 | 28 | B updateEntity(A source, B dest); 29 | 30 | } 31 | -------------------------------------------------------------------------------- /processor/src/test/java/fr/xebia/extras/selma/it/generic/PageListMapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Séven Le Mesle 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package fr.xebia.extras.selma.it.generic; 18 | 19 | import fr.xebia.extras.selma.IgnoreMissing; 20 | import fr.xebia.extras.selma.IoC; 21 | import fr.xebia.extras.selma.Mapper; 22 | import fr.xebia.extras.selma.it.generic.beans.EntityPageList; 23 | import fr.xebia.extras.selma.it.generic.beans.MongoEntity; 24 | import fr.xebia.extras.selma.it.generic.beans.PageList; 25 | 26 | @Mapper(withIoC = IoC.SPRING, withIgnoreMissing = IgnoreMissing.ALL) 27 | public interface PageListMapper { 28 | 29 | EntityPageList asEntityPageList(PageList source); 30 | 31 | PageList asPageList(EntityPageList source); 32 | 33 | } 34 | -------------------------------------------------------------------------------- /processor/src/test/java/fr/xebia/extras/selma/it/generic/SameErasureMapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Séven Le Mesle 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package fr.xebia.extras.selma.it.generic; 18 | 19 | import fr.xebia.extras.selma.Mapper; 20 | import fr.xebia.extras.selma.it.generic.beans.Records; 21 | import fr.xebia.extras.selma.it.generic.beans.RecordsDAO; 22 | 23 | /** 24 | * Created by slemesle on 06/03/2018. 25 | */ 26 | @Mapper 27 | public interface SameErasureMapper { 28 | 29 | RecordsDAO asRecordsDAO(Records records); 30 | } 31 | -------------------------------------------------------------------------------- /processor/src/test/java/fr/xebia/extras/selma/it/generic/SpecificMapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Séven Le Mesle 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package fr.xebia.extras.selma.it.generic; 18 | 19 | import fr.xebia.extras.selma.Mapper; 20 | import fr.xebia.extras.selma.beans.AddressIn; 21 | import fr.xebia.extras.selma.beans.AddressOut; 22 | 23 | /** 24 | * Created by slemesle on 25/11/15. 25 | */ 26 | @Mapper 27 | public interface SpecificMapper extends GenericMapper { 28 | 29 | } 30 | -------------------------------------------------------------------------------- /processor/src/test/java/fr/xebia/extras/selma/it/generic/beans/Bar.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Séven Le Mesle 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package fr.xebia.extras.selma.it.generic.beans; 18 | 19 | /** 20 | * Created by slemesle on 12/07/2017. 21 | */ 22 | public class Bar { 23 | private Long id; 24 | private String description; 25 | 26 | public Long getId() { 27 | return id; 28 | } 29 | 30 | public void setId(Long id) { 31 | this.id = id; 32 | } 33 | 34 | public String getDescription() { 35 | return description; 36 | } 37 | 38 | public void setDescription(String description) { 39 | this.description = description; 40 | } 41 | } -------------------------------------------------------------------------------- /processor/src/test/java/fr/xebia/extras/selma/it/generic/beans/EntityPageList.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Séven Le Mesle 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package fr.xebia.extras.selma.it.generic.beans; 18 | 19 | /** 20 | * Created by slemesle on 29/06/2017. 21 | */ 22 | public class EntityPageList { 23 | } 24 | -------------------------------------------------------------------------------- /processor/src/test/java/fr/xebia/extras/selma/it/generic/beans/Foo.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Séven Le Mesle 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package fr.xebia.extras.selma.it.generic.beans; 18 | 19 | /** 20 | * Created by slemesle on 12/07/2017. 21 | */ 22 | public class Foo { 23 | private E item; 24 | 25 | public E getItem() { 26 | return item; 27 | } 28 | 29 | public void setItem(E item) { 30 | this.item = item; 31 | } 32 | } -------------------------------------------------------------------------------- /processor/src/test/java/fr/xebia/extras/selma/it/generic/beans/GenericBean.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Séven Le Mesle 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package fr.xebia.extras.selma.it.generic.beans; 18 | 19 | /** 20 | * Created by slemesle on 15/07/2016. 21 | */ 22 | public class GenericBean { 23 | 24 | private T property; 25 | 26 | 27 | public T getProperty() { 28 | return property; 29 | } 30 | 31 | public void setProperty(T property) { 32 | this.property = property; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /processor/src/test/java/fr/xebia/extras/selma/it/generic/beans/GenericListBean.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Séven Le Mesle 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package fr.xebia.extras.selma.it.generic.beans; 18 | 19 | import java.util.List; 20 | 21 | /** 22 | * Created by slemesle on 15/07/2016. 23 | */ 24 | public class GenericListBean { 25 | 26 | private List propertyList; 27 | 28 | public List getPropertyList() { 29 | return propertyList; 30 | } 31 | 32 | public void setPropertyList(List propertyList) { 33 | this.propertyList = propertyList; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /processor/src/test/java/fr/xebia/extras/selma/it/generic/beans/MongoEntity.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Séven Le Mesle 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package fr.xebia.extras.selma.it.generic.beans; 18 | 19 | /** 20 | * Created by slemesle on 29/06/2017. 21 | */ 22 | public class MongoEntity { 23 | } 24 | -------------------------------------------------------------------------------- /processor/src/test/java/fr/xebia/extras/selma/it/generic/beans/PageList.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Séven Le Mesle 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package fr.xebia.extras.selma.it.generic.beans; 18 | 19 | /** 20 | * Created by slemesle on 29/06/2017. 21 | */ 22 | public class PageList { 23 | } 24 | -------------------------------------------------------------------------------- /processor/src/test/java/fr/xebia/extras/selma/it/generic/beans/Records.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Séven Le Mesle 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package fr.xebia.extras.selma.it.generic.beans; 18 | 19 | /** 20 | * Created by slemesle on 06/03/2018. 21 | */ 22 | public class Records { 23 | private Value type; 24 | private Value speed; 25 | 26 | public Value getType() { 27 | return type; 28 | } 29 | 30 | public void setType(Value type) { 31 | this.type = type; 32 | } 33 | 34 | public Value getSpeed() { 35 | return speed; 36 | } 37 | 38 | public void setSpeed(Value speed) { 39 | this.speed = speed; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /processor/src/test/java/fr/xebia/extras/selma/it/generic/beans/RecordsDAO.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Séven Le Mesle 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package fr.xebia.extras.selma.it.generic.beans; 18 | 19 | /** 20 | * Created by slemesle on 06/03/2018. 21 | */ 22 | public class RecordsDAO { 23 | private Value type; 24 | private Value speed; 25 | 26 | public Value getType() { 27 | return type; 28 | } 29 | 30 | public void setType(Value type) { 31 | this.type = type; 32 | } 33 | 34 | public Value getSpeed() { 35 | return speed; 36 | } 37 | 38 | public void setSpeed(Value speed) { 39 | this.speed = speed; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /processor/src/test/java/fr/xebia/extras/selma/it/generic/beans/SimpleDTO.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Séven Le Mesle 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package fr.xebia.extras.selma.it.generic.beans; 18 | 19 | /** 20 | * Created by slemesle on 15/07/2016. 21 | */ 22 | public class SimpleDTO { 23 | 24 | 25 | private String name; 26 | 27 | 28 | public String getName() { 29 | return name; 30 | } 31 | 32 | public void setName(String name) { 33 | this.name = name; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /processor/src/test/java/fr/xebia/extras/selma/it/generic/beans/SimpleDomain.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Séven Le Mesle 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package fr.xebia.extras.selma.it.generic.beans; 18 | 19 | /** 20 | * Created by slemesle on 15/07/2016. 21 | */ 22 | public class SimpleDomain { 23 | 24 | private String name; 25 | 26 | public SimpleDomain(String name) { 27 | 28 | this.name = name; 29 | } 30 | 31 | public SimpleDomain() { 32 | } 33 | 34 | public String getName() { 35 | return name; 36 | } 37 | 38 | public void setName(String name) { 39 | this.name = name; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /processor/src/test/java/fr/xebia/extras/selma/it/generic/beans/Value.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Séven Le Mesle 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package fr.xebia.extras.selma.it.generic.beans; 18 | 19 | /** 20 | * Created by slemesle on 06/03/2018. 21 | */ 22 | public class Value { 23 | private T value; 24 | private String unit; 25 | 26 | public T getValue() { 27 | return value; 28 | } 29 | 30 | public void setValue(T value) { 31 | this.value = value; 32 | } 33 | 34 | public String getUnit() { 35 | return unit; 36 | } 37 | 38 | public void setUnit(String unit) { 39 | this.unit = unit; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /processor/src/test/java/fr/xebia/extras/selma/it/heritance/MailMapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Séven Le Mesle 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package fr.xebia.extras.selma.it.heritance; 18 | 19 | import fr.xebia.extras.selma.Field; 20 | import fr.xebia.extras.selma.Mapper; 21 | import fr.xebia.extras.selma.Maps; 22 | import fr.xebia.extras.selma.it.heritance.beans.Mail; 23 | import fr.xebia.extras.selma.it.heritance.beans.MailDto; 24 | 25 | /** 26 | * Created by slemesle on 06/06/2017. 27 | */ 28 | @Mapper(ignoreNotSupported = true) 29 | public interface MailMapper { 30 | 31 | @Maps( withCustomFields = { @Field({"email", "adresse"})}, withIgnoreFields = {"npai", "type", "updateDate"} ) 32 | MailDto asMailDto(Mail mail); 33 | } 34 | -------------------------------------------------------------------------------- /processor/src/test/java/fr/xebia/extras/selma/it/heritance/beans/Mail.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Séven Le Mesle 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package fr.xebia.extras.selma.it.heritance.beans; 18 | 19 | /** 20 | * Created by slemesle on 06/06/2017. 21 | */ 22 | public class Mail extends AbstractCoordonnee { 23 | 24 | private String adresse; 25 | 26 | public Mail(String id) { 27 | super(id); 28 | } 29 | 30 | public String getAdresse() { 31 | return this.adresse; 32 | } 33 | 34 | public void setAdresse(String adresse) { 35 | this.adresse = adresse; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /processor/src/test/java/fr/xebia/extras/selma/it/heritance/beans/MailDto.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Séven Le Mesle 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package fr.xebia.extras.selma.it.heritance.beans; 18 | 19 | /** 20 | * Created by slemesle on 06/06/2017. 21 | */ 22 | public class MailDto { 23 | 24 | private String id; 25 | private String email; 26 | 27 | public String getId() { 28 | return id; 29 | } 30 | 31 | public void setId(String id) { 32 | this.id = id; 33 | } 34 | 35 | public String getEmail() { 36 | return email; 37 | } 38 | 39 | public void setEmail(String email) { 40 | this.email = email; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /processor/src/test/java/fr/xebia/extras/selma/it/ignore/FailingMissingFieldInMapsMapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Séven Le Mesle 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package fr.xebia.extras.selma.it.ignore; 18 | 19 | /** 20 | * Created by slemesle on 27/11/14. 21 | */ 22 | 23 | import fr.xebia.extras.selma.Mapper; 24 | import fr.xebia.extras.selma.Maps; 25 | import fr.xebia.extras.selma.beans.PersonIn; 26 | import fr.xebia.extras.selma.beans.PersonOut; 27 | 28 | import static fr.xebia.extras.selma.IgnoreMissing.*; 29 | 30 | @Mapper(withIgnoreMissing = ALL) 31 | public interface FailingMissingFieldInMapsMapper { 32 | 33 | @Maps(withIgnoreMissing = SOURCE) PersonOut mapMissingSource(PersonIn in); 34 | 35 | @Maps(withIgnoreMissing = DESTINATION) PersonOut mapMissingDestination(PersonIn in); 36 | 37 | @Maps(withIgnoreMissing = NONE) PersonOut mapMissingNone(PersonIn in); 38 | 39 | } 40 | -------------------------------------------------------------------------------- /processor/src/test/java/fr/xebia/extras/selma/it/ignore/IgnoreMissingFieldsInMapperMapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Séven Le Mesle 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package fr.xebia.extras.selma.it.ignore; 18 | 19 | /** 20 | * Created by slemesle on 27/11/14. 21 | */ 22 | 23 | import fr.xebia.extras.selma.Mapper; 24 | import fr.xebia.extras.selma.beans.PersonIn; 25 | import fr.xebia.extras.selma.beans.PersonOut; 26 | 27 | import static fr.xebia.extras.selma.IgnoreMissing.ALL; 28 | 29 | @Mapper(withIgnoreMissing = ALL) 30 | public interface IgnoreMissingFieldsInMapperMapper { 31 | 32 | PersonOut map(PersonIn in); 33 | 34 | } 35 | -------------------------------------------------------------------------------- /processor/src/test/java/fr/xebia/extras/selma/it/ignore/IgnoreMissingFieldsInMapsMapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Séven Le Mesle 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package fr.xebia.extras.selma.it.ignore; 18 | 19 | /** 20 | * Created by slemesle on 27/11/14. 21 | */ 22 | 23 | import fr.xebia.extras.selma.Mapper; 24 | import fr.xebia.extras.selma.Maps; 25 | import fr.xebia.extras.selma.beans.PersonIn; 26 | import fr.xebia.extras.selma.beans.PersonOut; 27 | 28 | import static fr.xebia.extras.selma.IgnoreMissing.ALL; 29 | import static fr.xebia.extras.selma.IgnoreMissing.NONE; 30 | 31 | @Mapper(withIgnoreMissing = NONE) 32 | public interface IgnoreMissingFieldsInMapsMapper { 33 | 34 | @Maps(withIgnoreMissing = ALL) PersonOut map(PersonIn in); 35 | 36 | } 37 | -------------------------------------------------------------------------------- /processor/src/test/java/fr/xebia/extras/selma/it/inject/AddressMapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Séven Le Mesle 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package fr.xebia.extras.selma.it.inject; 18 | 19 | import fr.xebia.extras.selma.IoC; 20 | import fr.xebia.extras.selma.Mapper; 21 | import fr.xebia.extras.selma.beans.AddressIn; 22 | import fr.xebia.extras.selma.beans.AddressOut; 23 | 24 | /** 25 | * Created by slemesle on 25/03/15. 26 | */ 27 | @Mapper(withIgnoreFields = "extras", 28 | withCustom = CustomImmutableMapperClass.class, 29 | withFactories = BeanFactoryClass.class, 30 | withIoC = IoC.SPRING) 31 | public interface AddressMapper { 32 | 33 | AddressOut asAddressOut(AddressIn in); 34 | 35 | } 36 | -------------------------------------------------------------------------------- /processor/src/test/java/fr/xebia/extras/selma/it/inject/AddressMapperCDI.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Séven Le Mesle 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package fr.xebia.extras.selma.it.inject; 18 | 19 | import fr.xebia.extras.selma.IoC; 20 | import fr.xebia.extras.selma.Mapper; 21 | import fr.xebia.extras.selma.beans.AddressIn; 22 | import fr.xebia.extras.selma.beans.AddressOut; 23 | 24 | /** 25 | * Created by slemesle on 25/03/15. 26 | */ 27 | @Mapper(withIgnoreFields = "extras", withCustom = CustomImmutableMapperClass.class, withFactories = BeanFactoryClass.class, withIoC = IoC.CDI_APPLICATION_SCOPED, withFinalMappers = false) 28 | public interface AddressMapperCDI { 29 | 30 | AddressOut asAddressOut(AddressIn in); 31 | 32 | } 33 | -------------------------------------------------------------------------------- /processor/src/test/java/fr/xebia/extras/selma/it/inject/AddressMapperWithName.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Séven Le Mesle 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package fr.xebia.extras.selma.it.inject; 18 | 19 | import fr.xebia.extras.selma.IoC; 20 | import fr.xebia.extras.selma.Mapper; 21 | import fr.xebia.extras.selma.beans.AddressIn; 22 | import fr.xebia.extras.selma.beans.AddressOut; 23 | 24 | /** 25 | * Created by slemesle on 25/03/15. 26 | */ 27 | @Mapper(withIgnoreFields = "extras", withCustom = CustomImmutableMapperClass.class, withIoC = IoC.SPRING, withIoCServiceName = "addressSelmaMapper") 28 | public interface AddressMapperWithName { 29 | 30 | AddressOut asAddressOut(AddressIn in); 31 | 32 | } 33 | -------------------------------------------------------------------------------- /processor/src/test/java/fr/xebia/extras/selma/it/inject/SpringConfiguration.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Séven Le Mesle 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package fr.xebia.extras.selma.it.inject; 18 | 19 | import org.springframework.context.annotation.ComponentScan; 20 | import org.springframework.context.annotation.Configuration; 21 | 22 | /** 23 | * Created by slemesle on 27/03/15. 24 | */ 25 | @Configuration 26 | @ComponentScan(value = "fr.xebia.extras.selma.it.inject", resourcePattern = "**/*Class.class") 27 | public class SpringConfiguration { 28 | 29 | 30 | } 31 | -------------------------------------------------------------------------------- /processor/src/test/java/fr/xebia/extras/selma/it/mappers/BadMapperSignature.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Xebia and Séven Le Mesle 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package fr.xebia.extras.selma.it.mappers; 18 | 19 | import fr.xebia.extras.selma.Mapper; 20 | 21 | /** 22 | * Created with IntelliJ IDEA. 23 | * User: slemesle 24 | * Date: 22/11/2013 25 | * Time: 14:27 26 | * To change this template use File | Settings | File Templates. 27 | */ 28 | @Mapper 29 | public interface BadMapperSignature { 30 | 31 | String mapThreeParameters(String in, String inBis, String inTer); 32 | 33 | 34 | String mapDifferentTypes(boolean in); 35 | 36 | 37 | String mapTwoParametersDifferentTypes(String in, boolean out); 38 | 39 | void mapTutu(String in); 40 | 41 | String mapString(); 42 | 43 | } 44 | -------------------------------------------------------------------------------- /processor/src/test/java/fr/xebia/extras/selma/it/mappers/BeanMapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Xebia and Séven Le Mesle 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package fr.xebia.extras.selma.it.mappers; 18 | 19 | import fr.xebia.extras.selma.IgnoreMissing; 20 | import fr.xebia.extras.selma.Mapper; 21 | import fr.xebia.extras.selma.beans.AddressIn; 22 | import fr.xebia.extras.selma.beans.AddressOut; 23 | import fr.xebia.extras.selma.beans.PersonIn; 24 | import fr.xebia.extras.selma.beans.PersonOut; 25 | 26 | /** 27 | * 28 | */ 29 | @Mapper(withIgnoreMissing = IgnoreMissing.ALL) 30 | public interface BeanMapper { 31 | 32 | PersonOut asPersonOut(PersonIn in); 33 | 34 | 35 | AddressOut asAddressOut(AddressIn in); 36 | } 37 | -------------------------------------------------------------------------------- /processor/src/test/java/fr/xebia/extras/selma/it/mappers/BooleanBeanMapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Xebia and Séven Le Mesle 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package fr.xebia.extras.selma.it.mappers; 18 | 19 | import fr.xebia.extras.selma.Mapper; 20 | import fr.xebia.extras.selma.beans.BooleanBean; 21 | 22 | /** 23 | * Special Mapper to test boolean mapping 24 | */ 25 | @Mapper 26 | public interface BooleanBeanMapper { 27 | 28 | 29 | BooleanBean asBooleanBean(BooleanBean in); 30 | 31 | Boolean asBoolean(boolean in); 32 | 33 | boolean asBoolean(Boolean in); 34 | 35 | } 36 | -------------------------------------------------------------------------------- /processor/src/test/java/fr/xebia/extras/selma/it/mappers/BuilderMapper.java: -------------------------------------------------------------------------------- 1 | package fr.xebia.extras.selma.it.mappers; 2 | 3 | import fr.xebia.extras.selma.Mapper; 4 | import fr.xebia.extras.selma.beans.BuilderIn; 5 | import fr.xebia.extras.selma.beans.BuilderOut; 6 | 7 | /** 8 | * 9 | */ 10 | @Mapper 11 | public interface BuilderMapper { 12 | BuilderOut asBuilderOut(BuilderIn in); 13 | } 14 | -------------------------------------------------------------------------------- /processor/src/test/java/fr/xebia/extras/selma/it/mappers/CircularReferenceMapper.java: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | */ 4 | package fr.xebia.extras.selma.it.mappers; 5 | 6 | import fr.xebia.extras.selma.Mapper; 7 | import fr.xebia.extras.selma.beans.CircularReference; 8 | 9 | /** 10 | * Mapper for an bean with circular reference 11 | */ 12 | @Mapper(withCyclicMapping = true) 13 | public interface CircularReferenceMapper { 14 | 15 | CircularReference as(CircularReference in); 16 | 17 | } 18 | -------------------------------------------------------------------------------- /processor/src/test/java/fr/xebia/extras/selma/it/mappers/CollectionInheritanceMapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Xebia and Séven Le Mesle 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package fr.xebia.extras.selma.it.mappers; 18 | 19 | import fr.xebia.extras.selma.Mapper; 20 | import fr.xebia.extras.selma.beans.StringList; 21 | import fr.xebia.extras.selma.beans.StringMap; 22 | 23 | 24 | @Mapper 25 | public interface CollectionInheritanceMapper { 26 | 27 | StringMap as(StringMap map); 28 | 29 | StringList as(StringList list); 30 | 31 | } 32 | -------------------------------------------------------------------------------- /processor/src/test/java/fr/xebia/extras/selma/it/mappers/CollectionsMapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Séven Le Mesle 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package fr.xebia.extras.selma.it.mappers; 18 | 19 | import fr.xebia.extras.selma.CollectionMappingStrategy; 20 | import fr.xebia.extras.selma.Mapper; 21 | import fr.xebia.extras.selma.Maps; 22 | import fr.xebia.extras.selma.beans.LinkedBlockingListBean; 23 | import fr.xebia.extras.selma.beans.LinkedListBean; 24 | 25 | import java.util.List; 26 | import java.util.Set; 27 | import java.util.TreeSet; 28 | 29 | /** 30 | * Created by slemesle on 05/06/2014. 31 | */ 32 | @Mapper 33 | public interface CollectionsMapper { 34 | 35 | Set asSet(TreeSet keys); 36 | 37 | TreeSet asTreeSet(TreeSet in); 38 | 39 | 40 | TreeSet listAsSet(List in); 41 | 42 | } 43 | -------------------------------------------------------------------------------- /processor/src/test/java/fr/xebia/extras/selma/it/mappers/CustomClassEnumMapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Séven Le Mesle 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package fr.xebia.extras.selma.it.mappers; 18 | 19 | import fr.xebia.extras.selma.EnumMapper; 20 | import fr.xebia.extras.selma.Mapper; 21 | import fr.xebia.extras.selma.beans.EnumA; 22 | import fr.xebia.extras.selma.beans.EnumB; 23 | import fr.xebia.extras.selma.beans.EnumIn; 24 | import fr.xebia.extras.selma.beans.EnumOut; 25 | 26 | /** 27 | * Created by slemesle on 12/03/2014. 28 | */ 29 | 30 | @Mapper(withEnums = { 31 | @EnumMapper(from = EnumA.class, to = EnumB.class, defaultValue = "A"), 32 | @EnumMapper(from = EnumIn.class, to = EnumOut.class) 33 | }) 34 | public interface CustomClassEnumMapper { 35 | 36 | EnumB asEnumB(EnumA in); 37 | 38 | } 39 | -------------------------------------------------------------------------------- /processor/src/test/java/fr/xebia/extras/selma/it/mappers/CustomMapperSupport.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Xebia and Séven Le Mesle 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package fr.xebia.extras.selma.it.mappers; 18 | 19 | import fr.xebia.extras.selma.IgnoreMissing; 20 | import fr.xebia.extras.selma.Mapper; 21 | import fr.xebia.extras.selma.beans.PersonIn; 22 | import fr.xebia.extras.selma.beans.PersonOut; 23 | 24 | /** 25 | * 26 | * 27 | */ 28 | @Mapper(withCustom = CustomMapper.class, withIgnoreMissing = IgnoreMissing.ALL) 29 | public interface CustomMapperSupport { 30 | 31 | PersonOut mapWithCustom(PersonIn in); 32 | 33 | PersonOut mapWithCustom(PersonIn in, PersonOut out); 34 | 35 | } 36 | -------------------------------------------------------------------------------- /processor/src/test/java/fr/xebia/extras/selma/it/mappers/CustomMethodEnumMapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Séven Le Mesle 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package fr.xebia.extras.selma.it.mappers; 18 | 19 | import fr.xebia.extras.selma.EnumMapper; 20 | import fr.xebia.extras.selma.Mapper; 21 | import fr.xebia.extras.selma.beans.*; 22 | 23 | /** 24 | * Created by slemesle on 12/03/2014. 25 | */ 26 | @Mapper 27 | public interface CustomMethodEnumMapper { 28 | 29 | @EnumMapper(defaultValue = "C") EnumB asEnumB(EnumA in); 30 | 31 | @EnumMapper(defaultValue = "C") EnumB asEnumB(EnumA in, EnumB out); 32 | 33 | @EnumMapper(from = EnumIn.class, to = EnumOut.class) CityOut asEnumBeanIn(CityIn in); 34 | 35 | @EnumMapper(from = EnumIn.class, to = EnumOut.class) CityOut asEnumBeanIn(CityIn in, CityOut out); 36 | 37 | } 38 | -------------------------------------------------------------------------------- /processor/src/test/java/fr/xebia/extras/selma/it/mappers/CustomMethodNoDefaultEnumMapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Séven Le Mesle 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package fr.xebia.extras.selma.it.mappers; 18 | 19 | import fr.xebia.extras.selma.EnumMapper; 20 | import fr.xebia.extras.selma.Mapper; 21 | import fr.xebia.extras.selma.beans.EnumA; 22 | import fr.xebia.extras.selma.beans.EnumB; 23 | 24 | /** 25 | * Created by slemesle on 12/03/2014. 26 | */ 27 | @Mapper 28 | public interface CustomMethodNoDefaultEnumMapper { 29 | 30 | @EnumMapper EnumB asEnumB(EnumA in); 31 | 32 | } 33 | -------------------------------------------------------------------------------- /processor/src/test/java/fr/xebia/extras/selma/it/mappers/CustomSourcedBeanMapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Xebia and Séven Le Mesle 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package fr.xebia.extras.selma.it.mappers; 18 | 19 | import fr.xebia.extras.selma.Mapper; 20 | import fr.xebia.extras.selma.Maps; 21 | import fr.xebia.extras.selma.beans.AddressIn; 22 | import fr.xebia.extras.selma.beans.AddressOutWithDataSource; 23 | import fr.xebia.extras.selma.beans.DataSource; 24 | 25 | /** 26 | * 27 | */ 28 | @Mapper(withCustom = CustomMapper.class, withSources = DataSource.class) 29 | public interface CustomSourcedBeanMapper { 30 | 31 | AddressOutWithDataSource asAddressOut(AddressIn in); 32 | 33 | @Maps(withCustom = CustomMapperWithoutSource.class) 34 | AddressOutWithDataSource asAddressOutWithoutDataSource(AddressIn in); 35 | 36 | } 37 | -------------------------------------------------------------------------------- /processor/src/test/java/fr/xebia/extras/selma/it/mappers/EmptyCustomMapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Xebia and Séven Le Mesle 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package fr.xebia.extras.selma.it.mappers; 18 | 19 | /** 20 | * 21 | */ 22 | public class EmptyCustomMapper { 23 | 24 | 25 | } 26 | -------------------------------------------------------------------------------- /processor/src/test/java/fr/xebia/extras/selma/it/mappers/FailingCustomMapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Xebia and Séven Le Mesle 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package fr.xebia.extras.selma.it.mappers; 18 | 19 | import fr.xebia.extras.selma.Mapper; 20 | import fr.xebia.extras.selma.beans.AddressIn; 21 | import fr.xebia.extras.selma.beans.AddressOut; 22 | 23 | /** 24 | * 25 | */ 26 | @Mapper(withCustom = {BadCustomMapper.class, EmptyCustomMapper.class, NoDefaultConstructorCustomMapper.class}) 27 | public interface FailingCustomMapper { 28 | 29 | AddressOut asAddressOut(AddressIn in); 30 | } 31 | -------------------------------------------------------------------------------- /processor/src/test/java/fr/xebia/extras/selma/it/mappers/FailingEnumMapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Séven Le Mesle 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package fr.xebia.extras.selma.it.mappers; 18 | 19 | import fr.xebia.extras.selma.EnumMapper; 20 | import fr.xebia.extras.selma.Mapper; 21 | import fr.xebia.extras.selma.beans.EnumA; 22 | import fr.xebia.extras.selma.beans.EnumB; 23 | 24 | /** 25 | * Created by slemesle on 12/03/2014. 26 | */ 27 | @Mapper 28 | public interface FailingEnumMapper { 29 | 30 | @EnumMapper(defaultValue = "c") EnumB asEnumB(EnumA in); 31 | 32 | } 33 | -------------------------------------------------------------------------------- /processor/src/test/java/fr/xebia/extras/selma/it/mappers/HomeMapper.java: -------------------------------------------------------------------------------- 1 | package fr.xebia.extras.selma.it.mappers; 2 | 3 | import fr.xebia.extras.selma.Field; 4 | import fr.xebia.extras.selma.Mapper; 5 | import fr.xebia.extras.selma.Maps; 6 | import fr.xebia.extras.selma.beans.Home; 7 | import fr.xebia.extras.selma.beans.HomeDto; 8 | 9 | /** 10 | * @author FaniloRandria 11 | */ 12 | @Mapper 13 | public interface HomeMapper { 14 | 15 | @Maps(withCustomFields = { 16 | @Field(value = {"phone", "phoneHome.phoneNumber"}) 17 | }) HomeDto toDto (Home in); 18 | 19 | } 20 | -------------------------------------------------------------------------------- /processor/src/test/java/fr/xebia/extras/selma/it/mappers/IbanMapper.java: -------------------------------------------------------------------------------- 1 | package fr.xebia.extras.selma.it.mappers; 2 | 3 | import fr.xebia.extras.selma.Field; 4 | import fr.xebia.extras.selma.Mapper; 5 | import fr.xebia.extras.selma.beans.IbanRest; 6 | import fr.xebia.extras.selma.beans.Rib; 7 | 8 | @Mapper(withCustomFields = {@Field({"IbanRest.codeBanque", "Rib.codeBanque"}), @Field({"IbanRest.codeBanqueDomiciliation", "Rib.codeBanqueCompensation"}),}) 9 | public interface IbanMapper { 10 | 11 | IbanRest convert(Rib rib); 12 | 13 | Rib convert(IbanRest iban); 14 | } 15 | -------------------------------------------------------------------------------- /processor/src/test/java/fr/xebia/extras/selma/it/mappers/IgnoreFullyQualifiedNameClassField.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Séven Le Mesle 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package fr.xebia.extras.selma.it.mappers; 18 | 19 | import fr.xebia.extras.selma.Mapper; 20 | import fr.xebia.extras.selma.beans.Library; 21 | import fr.xebia.extras.selma.beans.LibraryDTO; 22 | 23 | /** 24 | * Created by slemesle on 21/06/2014. 25 | */ 26 | @Mapper(withIgnoreFields = "fr.xebia.extras.selma.beans.Library.name") 27 | public interface IgnoreFullyQualifiedNameClassField { 28 | 29 | LibraryDTO asLibraryDTO(Library in); 30 | 31 | Library asLibrary(LibraryDTO in); 32 | } 33 | -------------------------------------------------------------------------------- /processor/src/test/java/fr/xebia/extras/selma/it/mappers/IgnoreFullyQualifiedNameClassFieldMappingsMapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Séven Le Mesle 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package fr.xebia.extras.selma.it.mappers; 18 | 19 | import fr.xebia.extras.selma.Mapper; 20 | import fr.xebia.extras.selma.beans.Library; 21 | import fr.xebia.extras.selma.beans.LibraryDTO; 22 | 23 | /** 24 | * Created by slemesle on 21/06/2014. 25 | */ 26 | @Mapper(withIgnoreFields = "fr.xebia.extras.selma.beans.Library.name") 27 | public interface IgnoreFullyQualifiedNameClassFieldMappingsMapper { 28 | 29 | LibraryDTO asLibraryDTO(Library in); 30 | 31 | Library asLibrary(LibraryDTO in); 32 | } 33 | -------------------------------------------------------------------------------- /processor/src/test/java/fr/xebia/extras/selma/it/mappers/IgnoreSimpleNameClassField.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Séven Le Mesle 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package fr.xebia.extras.selma.it.mappers; 18 | 19 | import fr.xebia.extras.selma.Mapper; 20 | import fr.xebia.extras.selma.beans.Library; 21 | import fr.xebia.extras.selma.beans.LibraryDTO; 22 | 23 | /** 24 | * Created by slemesle on 21/06/2014. 25 | */ 26 | @Mapper(withIgnoreFields = "Library.name") 27 | public interface IgnoreSimpleNameClassField { 28 | 29 | LibraryDTO asLibraryDTO(Library in); 30 | 31 | Library asLibrary(LibraryDTO in); 32 | } 33 | -------------------------------------------------------------------------------- /processor/src/test/java/fr/xebia/extras/selma/it/mappers/IgnoreSimpleNameClassFieldMappingsMapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Séven Le Mesle 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package fr.xebia.extras.selma.it.mappers; 18 | 19 | import fr.xebia.extras.selma.Mapper; 20 | import fr.xebia.extras.selma.beans.Library; 21 | import fr.xebia.extras.selma.beans.LibraryDTO; 22 | 23 | /** 24 | * Created by slemesle on 21/06/2014. 25 | */ 26 | @Mapper(withIgnoreFields = "Library.name") 27 | public interface IgnoreSimpleNameClassFieldMappingsMapper { 28 | 29 | LibraryDTO asLibraryDTO(Library in); 30 | 31 | Library asLibrary(LibraryDTO in); 32 | } 33 | -------------------------------------------------------------------------------- /processor/src/test/java/fr/xebia/extras/selma/it/mappers/ImmutablePackageMapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Xebia and Séven Le Mesle 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package fr.xebia.extras.selma.it.mappers; 18 | 19 | import fr.xebia.extras.selma.Mapper; 20 | import fr.xebia.extras.selma.beans.immutable.ImmutablePackageBean; 21 | 22 | /** 23 | * 24 | */ 25 | @Mapper(withImmutablesPackages = "fr.xebia.extras.selma.beans.immutable") 26 | public interface ImmutablePackageMapper { 27 | 28 | ImmutablePackageBean as(ImmutablePackageBean in); 29 | 30 | } 31 | -------------------------------------------------------------------------------- /processor/src/test/java/fr/xebia/extras/selma/it/mappers/ImmutableTypesMapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Séven Le Mesle 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package fr.xebia.extras.selma.it.mappers; 18 | 19 | import fr.xebia.extras.selma.Mapper; 20 | import fr.xebia.extras.selma.beans.TicketIn; 21 | import fr.xebia.extras.selma.beans.TicketOut; 22 | import fr.xebia.extras.selma.beans.TicketTocken; 23 | 24 | /** 25 | * Created by slemesle on 17/10/2014. 26 | */ 27 | @Mapper(withImmutables = {TicketTocken.class, java.lang.Byte.class}, 28 | withIgnoreFields = "fr.xebia.extras.selma.beans.TicketIn.password") 29 | public interface ImmutableTypesMapper { 30 | 31 | TicketOut asTicketOut(TicketIn source); 32 | 33 | 34 | TicketOut asTicketOut(TicketIn source, TicketOut dest); 35 | 36 | } 37 | -------------------------------------------------------------------------------- /processor/src/test/java/fr/xebia/extras/selma/it/mappers/IncompleteEnumMatchingMapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Séven Le Mesle 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package fr.xebia.extras.selma.it.mappers; 18 | 19 | import fr.xebia.extras.selma.Mapper; 20 | import fr.xebia.extras.selma.beans.EnumA; 21 | import fr.xebia.extras.selma.beans.EnumB; 22 | 23 | /** 24 | * Created by slemesle on 12/03/2014. 25 | */ 26 | @Mapper 27 | public interface IncompleteEnumMatchingMapper { 28 | 29 | EnumB asEnumB(EnumA in); 30 | } 31 | -------------------------------------------------------------------------------- /processor/src/test/java/fr/xebia/extras/selma/it/mappers/InheritedMapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Xebia and Séven Le Mesle 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package fr.xebia.extras.selma.it.mappers; 18 | 19 | import fr.xebia.extras.selma.Mapper; 20 | import fr.xebia.extras.selma.beans.ExtendedCityIn; 21 | import fr.xebia.extras.selma.beans.ExtendedCityOut; 22 | 23 | /** 24 | * 25 | */ 26 | @Mapper 27 | public interface InheritedMapper { 28 | 29 | ExtendedCityOut asExtendedCity(ExtendedCityIn in); 30 | 31 | 32 | } 33 | -------------------------------------------------------------------------------- /processor/src/test/java/fr/xebia/extras/selma/it/mappers/MapperForIssue167.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Xebia and Séven Le Mesle 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package fr.xebia.extras.selma.it.mappers; 18 | 19 | import fr.xebia.extras.selma.IgnoreMissing; 20 | import fr.xebia.extras.selma.Mapper; 21 | import fr.xebia.extras.selma.beans.NoEmptyConstructorPersonOut; 22 | import fr.xebia.extras.selma.beans.PersonIn; 23 | 24 | /** 25 | * 26 | */ 27 | @Mapper(withIgnoreMissing = IgnoreMissing.ALL) 28 | public abstract class MapperForIssue167 { 29 | 30 | public abstract NoEmptyConstructorPersonOut merge(PersonIn in, NoEmptyConstructorPersonOut out); 31 | 32 | } 33 | -------------------------------------------------------------------------------- /processor/src/test/java/fr/xebia/extras/selma/it/mappers/MappingInterceptor.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Séven Le Mesle 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package fr.xebia.extras.selma.it.mappers; 18 | 19 | import fr.xebia.extras.selma.beans.PersonIn; 20 | import fr.xebia.extras.selma.beans.PersonOut; 21 | 22 | /** 23 | * Created by slemesle on 26/03/2014. 24 | */ 25 | public class MappingInterceptor { 26 | 27 | 28 | /** 29 | * Simply intercept in and out person after mapping process 30 | * 31 | * @param in 32 | * @param out 33 | */ 34 | public void intercept(PersonIn in, PersonOut out) { 35 | 36 | out.setBiography(in.getFirstName() + " BIO"); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /processor/src/test/java/fr/xebia/extras/selma/it/mappers/MappingInterceptorSupport.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Xebia and Séven Le Mesle 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package fr.xebia.extras.selma.it.mappers; 18 | 19 | import fr.xebia.extras.selma.IgnoreMissing; 20 | import fr.xebia.extras.selma.Mapper; 21 | import fr.xebia.extras.selma.beans.PersonIn; 22 | import fr.xebia.extras.selma.beans.PersonOut; 23 | 24 | /** 25 | * 26 | * 27 | */ 28 | @Mapper(withCustom = MappingInterceptor.class, withIgnoreMissing = IgnoreMissing.ALL) 29 | public interface MappingInterceptorSupport { 30 | 31 | PersonOut mapWithInterceptor(PersonIn in); 32 | 33 | 34 | PersonOut mapWithInterceptor(PersonIn in, PersonOut out); 35 | 36 | } 37 | -------------------------------------------------------------------------------- /processor/src/test/java/fr/xebia/extras/selma/it/mappers/MissingPropertyMapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Xebia and Séven Le Mesle 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package fr.xebia.extras.selma.it.mappers; 18 | 19 | import fr.xebia.extras.selma.Mapper; 20 | import fr.xebia.extras.selma.beans.PersonIn; 21 | import fr.xebia.extras.selma.beans.PersonOut; 22 | 23 | /** 24 | * 25 | */ 26 | @Mapper 27 | public interface MissingPropertyMapper { 28 | 29 | PersonOut map(PersonIn in); 30 | 31 | } 32 | -------------------------------------------------------------------------------- /processor/src/test/java/fr/xebia/extras/selma/it/mappers/MissingPropertyMapsMapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Xebia and Séven Le Mesle 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package fr.xebia.extras.selma.it.mappers; 18 | 19 | import fr.xebia.extras.selma.Mapper; 20 | import fr.xebia.extras.selma.beans.NoGetterBean; 21 | import fr.xebia.extras.selma.beans.PersonIn; 22 | import fr.xebia.extras.selma.beans.PersonOut; 23 | 24 | /** 25 | * 26 | */ 27 | @Mapper 28 | public interface MissingPropertyMapsMapper { 29 | 30 | PersonOut map(PersonIn in); 31 | 32 | NoGetterBean clone(NoGetterBean in); 33 | 34 | } 35 | -------------------------------------------------------------------------------- /processor/src/test/java/fr/xebia/extras/selma/it/mappers/NestedMapAndCollectionMapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Xebia and Séven Le Mesle 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package fr.xebia.extras.selma.it.mappers; 18 | 19 | import fr.xebia.extras.selma.Mapper; 20 | 21 | import java.util.*; 22 | 23 | /** 24 | * Mapper used to demonstrate nested collections and Map support 25 | */ 26 | @Mapper 27 | public interface NestedMapAndCollectionMapper { 28 | 29 | 30 | List> convertListOfSet(ArrayList> list); 31 | 32 | 33 | List> convertListOfMap(ArrayList> list); 34 | 35 | 36 | Map> convertMapOfList(Map> map); 37 | 38 | 39 | Map, Map> convertMapOfListForMap(Map, Map> map); 40 | 41 | 42 | } 43 | -------------------------------------------------------------------------------- /processor/src/test/java/fr/xebia/extras/selma/it/mappers/NoDefaultConstructorCustomMapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Séven Le Mesle 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package fr.xebia.extras.selma.it.mappers; 18 | 19 | /** 20 | * Created by slemesle on 07/05/2014. 21 | */ 22 | public class NoDefaultConstructorCustomMapper { 23 | 24 | private final String test; 25 | 26 | public NoDefaultConstructorCustomMapper(String test) { 27 | 28 | this.test = test; 29 | } 30 | 31 | 32 | public String longAsString(Long id) { 33 | return (id != null ? id.toString() : null); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /processor/src/test/java/fr/xebia/extras/selma/it/mappers/NotNullMapper.java: -------------------------------------------------------------------------------- 1 | package fr.xebia.extras.selma.it.mappers; 2 | 3 | import fr.xebia.extras.selma.IgnoreMissing; 4 | import fr.xebia.extras.selma.Mapper; 5 | import fr.xebia.extras.selma.Maps; 6 | import fr.xebia.extras.selma.beans.CityIn; 7 | import fr.xebia.extras.selma.beans.CityOut; 8 | import fr.xebia.extras.selma.beans.Library; 9 | import fr.xebia.extras.selma.beans.LibraryDTO; 10 | 11 | @Mapper(withIgnoreNullValue = true) 12 | public interface NotNullMapper { 13 | CityOut mapCity(CityIn cityIn, CityOut out); 14 | 15 | @Maps(withIgnoreMissing = IgnoreMissing.DESTINATION) 16 | LibraryDTO mapLibrary(Library in, LibraryDTO out); 17 | 18 | StringContainer mapStringContainer(StringContainer in, StringContainer out); 19 | 20 | class StringContainer { 21 | private String text; 22 | 23 | public String getText() { 24 | return text; 25 | } 26 | 27 | public void setText(String text) { 28 | this.text = text; 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /processor/src/test/java/fr/xebia/extras/selma/it/mappers/NotSupportedMapping.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Xebia and Séven Le Mesle 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package fr.xebia.extras.selma.it.mappers; 18 | 19 | import fr.xebia.extras.selma.IgnoreMissing; 20 | import fr.xebia.extras.selma.Mapper; 21 | 22 | import java.io.File; 23 | 24 | /** 25 | * Created with IntelliJ IDEA. 26 | * User: slemesle 27 | * Date: 22/11/2013 28 | * Time: 13:51 29 | * To change this template use File | Settings | File Templates. 30 | */ 31 | @Mapper(ignoreNotSupported = false, withIgnoreMissing = IgnoreMissing.ALL) 32 | public interface NotSupportedMapping { 33 | 34 | File map(File in); 35 | 36 | 37 | } 38 | -------------------------------------------------------------------------------- /processor/src/test/java/fr/xebia/extras/selma/it/mappers/PersonMapper.java: -------------------------------------------------------------------------------- 1 | package fr.xebia.extras.selma.it.mappers; 2 | 3 | import fr.xebia.extras.selma.Mapper; 4 | import fr.xebia.extras.selma.beans.Person; 5 | import fr.xebia.extras.selma.beans.PersonDto; 6 | 7 | /** 8 | * Created by dtente on 28/09/2016. 9 | */ 10 | @Mapper 11 | public interface PersonMapper { 12 | 13 | PersonDto toDto(Person patient); 14 | 15 | } 16 | -------------------------------------------------------------------------------- /processor/src/test/java/fr/xebia/extras/selma/it/mappers/SameEnumMapperIt.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Séven Le Mesle 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package fr.xebia.extras.selma.it.mappers; 18 | 19 | import fr.xebia.extras.selma.Mapper; 20 | import fr.xebia.extras.selma.beans.EnumBeanIn; 21 | import fr.xebia.extras.selma.beans.EnumBeanOut; 22 | import fr.xebia.extras.selma.beans.EnumIn; 23 | 24 | /** 25 | * Created by slemesle on 18/06/2014. 26 | */ 27 | @Mapper 28 | public interface SameEnumMapperIt { 29 | 30 | EnumIn asEnumIn(EnumIn in); 31 | 32 | 33 | EnumBeanOut asEnumBean(EnumBeanIn in); 34 | } 35 | -------------------------------------------------------------------------------- /processor/src/test/java/fr/xebia/extras/selma/it/mappers/SelmaCustomTestMapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Xebia and Séven Le Mesle 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package fr.xebia.extras.selma.it.mappers; 18 | 19 | /** 20 | * Created with IntelliJ IDEA. 21 | * User: slemesle 22 | * Date: 29/11/2013 23 | * Time: 01:44 24 | * To change this template use File | Settings | File Templates. 25 | */ 26 | 27 | import fr.xebia.extras.selma.Mapper; 28 | import fr.xebia.extras.selma.beans.DataSource; 29 | 30 | /** 31 | * 32 | */ 33 | @Mapper(withSources = DataSource.class, withCustom = CustomMapper.class) 34 | public interface SelmaCustomTestMapper { 35 | 36 | String asString(String in); 37 | 38 | } 39 | -------------------------------------------------------------------------------- /processor/src/test/java/fr/xebia/extras/selma/it/mappers/SelmaSourcedTestMapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Xebia and Séven Le Mesle 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package fr.xebia.extras.selma.it.mappers; 18 | 19 | /** 20 | * Created with IntelliJ IDEA. 21 | * User: slemesle 22 | * Date: 29/11/2013 23 | * Time: 01:44 24 | * To change this template use File | Settings | File Templates. 25 | */ 26 | 27 | import fr.xebia.extras.selma.Mapper; 28 | import fr.xebia.extras.selma.beans.DataSource; 29 | 30 | /** 31 | * 32 | */ 33 | @Mapper(withSources = DataSource.class) 34 | public interface SelmaSourcedTestMapper { 35 | 36 | String asString(String in); 37 | 38 | } 39 | -------------------------------------------------------------------------------- /processor/src/test/java/fr/xebia/extras/selma/it/mappers/SelmaTestMapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Xebia and Séven Le Mesle 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package fr.xebia.extras.selma.it.mappers; 18 | 19 | import fr.xebia.extras.selma.Mapper; 20 | 21 | /** 22 | * 23 | */ 24 | @Mapper 25 | public interface SelmaTestMapper { 26 | 27 | String asString(String in); 28 | 29 | } 30 | -------------------------------------------------------------------------------- /processor/src/test/java/fr/xebia/extras/selma/it/mappers/SourcedBeanMapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Xebia and Séven Le Mesle 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package fr.xebia.extras.selma.it.mappers; 18 | 19 | import fr.xebia.extras.selma.Mapper; 20 | import fr.xebia.extras.selma.beans.AddressIn; 21 | import fr.xebia.extras.selma.beans.AddressOut; 22 | import fr.xebia.extras.selma.beans.AddressOutWithDataSource; 23 | import fr.xebia.extras.selma.beans.DataSource; 24 | 25 | /** 26 | * Demonstrate Sourced beans 27 | */ 28 | @Mapper(withSources = DataSource.class) 29 | public interface SourcedBeanMapper { 30 | 31 | 32 | AddressOutWithDataSource asAddressOutWithDataSource(AddressIn in); 33 | 34 | AddressOut asAddressOut(AddressIn in); 35 | 36 | 37 | } 38 | -------------------------------------------------------------------------------- /processor/src/test/java/fr/xebia/extras/selma/it/mappers/UpdateGraphBeanMapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Xebia and Séven Le Mesle 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package fr.xebia.extras.selma.it.mappers; 18 | 19 | import fr.xebia.extras.selma.Mapper; 20 | import fr.xebia.extras.selma.beans.AddressIn; 21 | import fr.xebia.extras.selma.beans.AddressOut; 22 | 23 | /** 24 | * 25 | */ 26 | @Mapper 27 | public interface UpdateGraphBeanMapper { 28 | 29 | AddressOut asAddressOut(AddressIn in, AddressOut out); 30 | 31 | AddressOut updateOrDuplicate(AddressOut in, AddressOut out); 32 | 33 | } 34 | -------------------------------------------------------------------------------- /processor/src/test/java/fr/xebia/extras/selma/it/parent/SourceStringMapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Séven Le Mesle 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package fr.xebia.extras.selma.it.parent; 18 | 19 | import fr.xebia.extras.selma.Mapper; 20 | import fr.xebia.extras.selma.beans.DestinationString; 21 | import fr.xebia.extras.selma.beans.SourceString; 22 | 23 | /** 24 | * Created by slemesle on 15/04/2017. 25 | */ 26 | @Mapper 27 | public interface SourceStringMapper { 28 | 29 | DestinationString asDestination(SourceString src); 30 | 31 | } 32 | -------------------------------------------------------------------------------- /processor/src/test/java/fr/xebia/extras/selma/it/utils/Compile.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Xebia and Séven Le Mesle 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package fr.xebia.extras.selma.it.utils; 18 | 19 | 20 | import java.lang.annotation.*; 21 | 22 | /** 23 | * 24 | */ 25 | @Documented 26 | @Retention(RetentionPolicy.RUNTIME) 27 | @Target({ElementType.TYPE, ElementType.METHOD}) 28 | @Inherited 29 | public @interface Compile { 30 | 31 | /** 32 | * Add all classes inside the package to compilation 33 | * 34 | * @return 35 | */ 36 | String[] withPackage() default {}; 37 | 38 | /** 39 | * Add listed classes to compilation 40 | * 41 | * @return 42 | */ 43 | Class[] withClasses() default {}; 44 | 45 | boolean shouldFail() default false; 46 | } 47 | -------------------------------------------------------------------------------- /resources/S3lm4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/publicissapient-france/selma/b1a2972c3d5a61f42458b29351371b4d0f004d2d/resources/S3lm4.png -------------------------------------------------------------------------------- /resources/logo-v2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/publicissapient-france/selma/b1a2972c3d5a61f42458b29351371b4d0f004d2d/resources/logo-v2.png -------------------------------------------------------------------------------- /resources/logo-v6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/publicissapient-france/selma/b1a2972c3d5a61f42458b29351371b4d0f004d2d/resources/logo-v6.png -------------------------------------------------------------------------------- /selma/.gitignore: -------------------------------------------------------------------------------- 1 | /target/ 2 | -------------------------------------------------------------------------------- /selma/src/main/java/fr/xebia/extras/selma/CollectionMappingStrategy.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Séven Le Mesle 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package fr.xebia.extras.selma; 18 | 19 | /** 20 | * Created by slemesle on 22/04/15. 21 | */ 22 | public enum CollectionMappingStrategy { 23 | DEFAULT, 24 | SETTER_ONLY, 25 | ALLOW_GETTER 26 | } 27 | -------------------------------------------------------------------------------- /selma/src/main/java/fr/xebia/extras/selma/InstanceCache.java: -------------------------------------------------------------------------------- 1 | package fr.xebia.extras.selma; 2 | 3 | public interface InstanceCache { 4 | OUT get(IN in); 5 | 6 | void put(IN in, OUT out); 7 | 8 | void push(); 9 | void pop(); 10 | } 11 | -------------------------------------------------------------------------------- /selma/src/main/java/fr/xebia/extras/selma/IoC.java: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright 2013 Séven Le Mesle 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package fr.xebia.extras.selma; 18 | 19 | /** 20 | * Created by slemesle on 27/03/15. 21 | */ 22 | public enum IoC { 23 | /** Adds no annotation for IoC */ 24 | NO, 25 | /** Adds @Service annotation to the generated mapper */ 26 | SPRING, 27 | /** Adds @Named annotation to the generated mapper */ 28 | CDI, 29 | /** Adds @Named and @Singleton annotations to the generated mapper */ 30 | CDI_SINGLETON, 31 | /** Adds @ApplicationScoped annotation to the generated mapper */ 32 | CDI_APPLICATION_SCOPED 33 | } 34 | -------------------------------------------------------------------------------- /selma/src/main/java/fr/xebia/extras/selma/SelmaException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Séven Le Mesle 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package fr.xebia.extras.selma; 18 | 19 | /** 20 | * Created by slemesle on 02/06/2014. 21 | */ 22 | public class SelmaException extends RuntimeException { 23 | public SelmaException(Exception e) { 24 | super(e); 25 | } 26 | 27 | public SelmaException(Exception e, String messageFormat, Object... params) { 28 | super(String.format(messageFormat, params), e); 29 | } 30 | 31 | public SelmaException(String messageFormat, Object... params) { 32 | super(String.format(messageFormat, params)); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /selma/src/main/java/fr/xebia/extras/selma/SelmaUtils.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Séven Le Mesle 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package fr.xebia.extras.selma; 18 | 19 | /** 20 | * Created by slemesle on 17/04/2017. 21 | */ 22 | public class SelmaUtils { 23 | 24 | /** 25 | * Checks if all given objects are null 26 | * @param vars 27 | * @return 28 | */ 29 | public static boolean areNull(Object ... vars){ 30 | boolean res = true; 31 | for (Object obj : vars) { 32 | if (obj != null){ 33 | res = false; 34 | break; 35 | } 36 | } 37 | return res; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /selma/src/main/resources/selma.properties: -------------------------------------------------------------------------------- 1 | selma.version=${project.version} 2 | selma.githash=${project.scm.tag} 3 | selma.git.desc=${git.commit.id.describe} 4 | selma.git.commit=${git.commit.id.describe-short} 5 | selma.git.commit-full=${git.commit.id} 6 | selma.build.version=${git.build.version} -------------------------------------------------------------------------------- /travis.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | env 4 | 5 | mvn clean verify --settings target/travis/settings.xml 6 | --------------------------------------------------------------------------------