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();
}
Aggregations