Search in sources :

Example 1 with PropertyMap

use of org.modelmapper.PropertyMap in project useful-java-links by Vedenin.

the class ModelMapperHelloWorld method main.

public static void main(String[] args) {
    // init mapper
    PropertyMap<Source, Destination> orderMap = new PropertyMap<Source, Destination>() {

        protected void configure() {
            map().setText(source.getMessage());
        }
    };
    ModelMapper modelMapper = new ModelMapper();
    modelMapper.addMappings(orderMap);
    // convert
    Source source = new Source("Hello World!");
    Destination destObject = modelMapper.map(source, Destination.class);
    // print Hello World!
    destObject.print();
}
Also used : PropertyMap(org.modelmapper.PropertyMap) ModelMapper(org.modelmapper.ModelMapper)

Aggregations

ModelMapper (org.modelmapper.ModelMapper)1 PropertyMap (org.modelmapper.PropertyMap)1