org.nomin.core.preprocessing.MapperPreprocessing Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of nomin Show documentation
Show all versions of nomin Show documentation
Nomin is a mapping engine for the Java platform. It provides abilities to transform object trees according to
declarative mapping rules. Main features of Nomin are no XML configuration, intuitively looking mapping,
using arbitrary expressions and method invocations in mappings, pre and postprocessing right in a mapping listing,
customizations. It's applicable for any Java compatible classes, not only JavaBeans.
package org.nomin.core.preprocessing;
import org.nomin.NominMapper;
import org.nomin.core.MappingCase;
/**
* Applies the mapper to get needed value.
* @author Dmitry Dobrynin
* Created 28.04.2010 15:44:50
*/
public class MapperPreprocessing extends Preprocessing {
private NominMapper mapper;
private Class> targetClass;
private MappingCase mappingCase;
public MapperPreprocessing(Class> targetClass, NominMapper mapper, MappingCase mappingCase) {
this.mapper = mapper;
this.targetClass = targetClass;
this.mappingCase = mappingCase;
}
public Object preprocess(Object source) {
return mapper.map(source, targetClass, mappingCase.get());
}
}