本文整理汇总了Java中ma.glasnost.orika.MapperFacade.map方法的典型用法代码示例。如果您正苦于以下问题:Java MapperFacade.map方法的具体用法?Java MapperFacade.map怎么用?Java MapperFacade.map使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ma.glasnost.orika.MapperFacade
的用法示例。
在下文中一共展示了MapperFacade.map方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: list
import ma.glasnost.orika.MapperFacade; //导入方法依赖的package包/类
/**
* General convert method, it will convert VO to RO without any other logic
*
* @param vo converted object
* @param clazz class of converted object
* @param <I> Generic class of input
* @param <O> Generic class of output
* @return converted object
*/
public <I, O> O list(final I vo, Class<O> clazz) {
MapperFacade mapper = mapperFactory.getMapperFacade();
return mapper.map(vo, clazz);
}
示例2: doMapping
import ma.glasnost.orika.MapperFacade; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
private <From, To> To doMapping(final Class<To> toClass, From from, String mappingName, MappingType mappingType, boolean beenMappedWithOrika, To to) {
CustomMappingWrapper.Orika orikaOverrideSetting = CustomMappingWrapper.Orika.DEFAULT;
if (from == null) return null;
if (from instanceof CustomMappingWrapper) {
CustomMappingWrapper cmo = (CustomMappingWrapper) from;
from = (From)cmo.getObject();
mappingType = cmo.getMappingType();
mappingName = cmo.getMappingName();
orikaOverrideSetting = cmo.getOrika();
if (from == null) return null;
}
Class fromClass = from.getClass();
boolean mappedWithOrika = false;
if (orikaOverrideSetting == CustomMappingWrapper.Orika.FORCE_ON || (orikaOverrideSetting == CustomMappingWrapper.Orika.DEFAULT && (!beenMappedWithOrika && autoMapUsingOrika))) {
//TODO move to cache
MapperFacade orikaMapper;
if (!mapperFactory.existsRegisteredMapper(TypeFactory.valueOf(from.getClass()), TypeFactory.valueOf(toClass), false)) {
mapperFactory.classMap(fromClass, toClass)
.byDefault().register();
}
orikaMapper = mapperFactory.getMapperFacade();
to = orikaMapper.map(from, toClass);
beenMappedWithOrika = true;
mappedWithOrika = true;
}
if (to == null) {
try {
to = toClass.newInstance();
} catch (IllegalAccessException | InstantiationException e) {
throw new RuntimeException("Error creating instace of " + toClass, e);
}
}
doAudibleMapping(toClass, from, mappingName, mappingType, fromClass, to, beenMappedWithOrika, mappedWithOrika);
handlePostProcessor(to, toClass, from, mappingName);
return to;
}