Package ma.glasnost.orika

Examples of ma.glasnost.orika.MapperFactory.classMap()


  @Test
    public void testAdHocResolution_integration() {
       
        MapperFactory factory = new DefaultMapperFactory.Builder().build();
        factory.registerClassMap(
                factory.classMap(A.class, B.class)
                    .field("name:{readTheNameForThisBean|assignTheName}.firstName", "givenName")
                    .field("name:{readTheNameForThisBean|assignTheName}.lastName", "sirName")
                    .field("address.city", "city")
                    .field("address.street", "street")
                    .field("address.postalCode", "postalCode")
View Full Code Here


    @Test
    public void testAdHocResolution_integration_reuseName() {
       
        MapperFactory factory = new DefaultMapperFactory.Builder().build();
        factory.registerClassMap(
                factory.classMap(A.class, B.class)
                    .field("name:{readTheNameForThisBean|assignTheName}.firstName", "givenName")
                    .field("name.lastName", "sirName")
                    .field("address.city", "city")
                    .field("address.street", "street")
                    .field("address.postalCode", "postalCode")
View Full Code Here

    @Test
    public void testAdHocResolution_integration_programmaticPropertyBuilder() {
       
        MapperFactory factory = MappingUtil.getMapperFactory();
       
        ClassMapBuilder<Element,PersonDto> builder = factory.classMap(Element.class, PersonDto.class);
       
        {
            Property.Builder employment =
                    Property.Builder.propertyFor(Element.class, "employment")
                        .type(Element.class)
View Full Code Here

           
            String nameDef = "name:{getAttribute(\"name\")|setAttribute(\"name\",%s)|type=ma.glasnost.orika.test.property.PropertyResolverTestCase$Element}";
            String firstNameDef = "first:{getAttribute(\"first\")|setAttribute(\"first\", %s)|type=java.lang.String}";
            String lastNameDef = "last:{getAttribute(\"last\")|setAttribute(\"last\", %s)|type=java.lang.String}";
           
            factory.classMap(Element.class, PersonDto.class)
                .field(employmentDef + "." + jobTitleDef, "jobTitles")
                .field(employmentDef + "." + salaryDef, "salary")
                .field(nameDef + "." + firstNameDef, "firstName")
                .field(nameDef + "." + lastNameDef, "lastName")
                .register();
View Full Code Here

           
            String nameDef = "name:{getAttribute(\"name\")|setAttribute(\"name\",%s)|type=ma.glasnost.orika.test.property.PropertyResolverTestCase$Element}";
            String firstNameDef = "first:{getAttribute(\"first\")|setAttribute(\"first\", %s)|type=java.lang.String}";
            String lastNameDef = "last:{getAttribute(\"last\")|setAttribute(\"last\", %s)|type=java.lang.String}";
           
            factory.classMap(Element.class, PersonDto.class)
                .field(employmentDef + "." + jobTitleDef, "jobTitles")
                .field("employment." + salaryDef, "salary") // reuse the in-line declaration of 'employment' property
                .field(nameDef + "." + firstNameDef, "firstName")
                .field("name." + lastNameDef, "lastName") // reuses the in-line declaration of 'name' property
                .register();
View Full Code Here

           
            String nameDef = "name:{getAttribute('name')|setAttribute('name',%s)|type=ma.glasnost.orika.test.property.PropertyResolverTestCase.Element}";
            String firstNameDef = "first:{getAttribute('first')|setAttribute('first', %s)|type=java.lang.String}";
            String lastNameDef = "last:{getAttribute('last')|setAttribute('last', %s)|type=java.lang.String}";
           
            factory.classMap(Element.class, PersonDto.class)
                .field(employmentDef + "." + jobTitleDef, "jobTitles")
                .field("employment." + salaryDef, "salary") // reuse the in-line declaration of 'employment' property
                .field(nameDef + "." + firstNameDef, "firstName")
                .field("name." + lastNameDef, "lastName") // reuses the in-line declaration of 'name' property
                .register();
View Full Code Here

        MapperFactory mapperFactory = new DefaultMapperFactory.Builder()
            .compilerStrategy(new EclipseJdtCompilerStrategy())
            .classMapBuilderFactory(new ScoringClassMapBuilder.Factory())
            .build();
       
        mapperFactory.classMap(typeOf_FlatData, typeOf_Year).byDefault().register();
       
        MapperFacade mapper = mapperFactory.getMapperFacade();
       
       
        List<FlatData> flatData = new ArrayList<FlatData>();
View Full Code Here

    @Test
    public void mapNulls_True_ClassLevel() {

        MapperFactory mapperFactory = new DefaultMapperFactory.Builder().mapNulls(false).build();
       
        mapperFactory.classMap(Container.class, Container2.class)
            .mapNulls(true).byDefault().register();
       
        Container a = new Container();
        Container2 b = new Container2();
View Full Code Here

    @Test
    public void mapNulls_False_ClassLevel() {

        MapperFactory mapperFactory = new DefaultMapperFactory.Builder().mapNulls(true).build();
       
        mapperFactory.classMap(Container.class, Container2.class)
        .mapNulls(false).byDefault().register();
   
        Container a = new Container();
        Container2 b = new Container2();
View Full Code Here

    @Test
    public void mapNulls_FieldLevel() {

        MapperFactory mapperFactory = new DefaultMapperFactory.Builder().mapNulls(false).build();
       
        mapperFactory.classMap(Container.class, Container2.class)
            .mapNulls(false)
            .fieldMap("arrayOfString").mapNulls(true).add()
            .byDefault().register();
   
        Container a = new Container();
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.