当前位置: 首页>>代码示例>>Java>>正文


Java MapperFacade.map方法代码示例

本文整理汇总了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);
}
 
开发者ID:petrleocompel,项目名称:docker-dash,代码行数:14,代码来源:ObjectFactory.java

示例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;
}
 
开发者ID:nfl,项目名称:audible,代码行数:57,代码来源:DomainMapper.java


注:本文中的ma.glasnost.orika.MapperFacade.map方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。