saifali40 / mapper

Light weight mapper for models to DTO without using any constructor or the setters, easily map to new modesl with annotations

Home Page:https://saifali40.github.io/mapper/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

mapper

Quality gate FOSSA Status

License Build Status Quality Gate Status

Light weight mapper for models to DTO without using any constructor or the setters, easily map to new modesl with annotations

Example


public class TestModel{
    private String field1 = "10";
    private String field2 = "20";
    private String field3 = "30";
    private String field4 = "40";
    private Integer field5 = 50;
}

public class TestDTO {

    @FieldMapper(field="field1")
    private String testField1;

    @FieldMapper(field="field2")
    private String testField2;

    @FieldMapper(field="field3")
    private String testField3;

    @FieldMapper(field="field4")
    private Integer testField4;
    private Integer field5;

}

Equivalent output will be


private String testField1 = "10";
private String testField2 = "20";
private String testField3 = "30";
private String testField4 = "40";
private Integer field5 = 50;

Mapping use the following helper

TestDTO dto = new in.saifali.mapper.Impl.Processor().map(TestDTO.class, model);

Please follow the test case for more information

Note

You can use the same annotation and map dto to model and use the following Method reverse(Model.class, dto)

Model model = new in.saifali.mapper.Impl.Processor().reverse(Model.class, dto);

Dependency

Gson Library Which one to convert The Model which is passed.

API documentation

https://saifali40.github.io/mapper/

License

See the LICENSE file for license rights and limitations (Apache).

FOSSA Status

About

Light weight mapper for models to DTO without using any constructor or the setters, easily map to new modesl with annotations

https://saifali40.github.io/mapper/

License:Apache License 2.0


Languages

Language:HTML 51.4%Language:JavaScript 35.2%Language:Java 9.3%Language:CSS 4.2%