Skip to content

brenooliveira/annotationmapper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Java Annotation Mapper Build Status#

Java annotation mapper is a lib to convert an object into another object using java annotations.

Exemple:

Convert class Person into Human

person.java

public class Person {

    @MapTo("fullname")
    private String name;

    @MapTo("ages")
    private Integer age;

    // getters and setters
}

human.java

public class Human {

    public String fullname;
    public Integer ages;
    //getters and setters
}

AnnotationMapperTest.java

public class AnnotationMapperTest {

    @Test
    public void deveReceberUmResourceQualquerERetornarUmOutroResourceQualquer() {
        Person person = new Person("Breno Oliveira", 30);

        Human human = AnnotationMapper.map(person, Human.class);
        assertEquals(person.getName(), human.getFullname());
        assertEquals(person.getAge(), human.getAges());
    }
}

About

Map object to an other object using java annotations

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published