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


Java DozerBeanMapper.map方法代码示例

本文整理汇总了Java中org.dozer.DozerBeanMapper.map方法的典型用法代码示例。如果您正苦于以下问题:Java DozerBeanMapper.map方法的具体用法?Java DozerBeanMapper.map怎么用?Java DozerBeanMapper.map使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.dozer.DozerBeanMapper的用法示例。


在下文中一共展示了DozerBeanMapper.map方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: map

import org.dozer.DozerBeanMapper; //导入方法依赖的package包/类
public static void map(final Object source, final Object destination, boolean ignoreNull) {
    DozerBeanMapper mapper = new DozerBeanMapper();
    if(ignoreNull) {
        mapper.addMapping(new BeanMappingBuilder() {
            protected void configure() {
                mapping(source.getClass(), destination.getClass(), mapNull(false), mapEmptyString(true));
            }
        });
    }

    mapper.map(source, destination);
}
 
开发者ID:Martion2017,项目名称:ApplicationDetection,代码行数:13,代码来源:BeanMapperUtil.java

示例2: executeInternal

import org.dozer.DozerBeanMapper; //导入方法依赖的package包/类
@Override
protected SavePropertyResult executeInternal(SaveProperty action, ExecutionContext context) throws ActionException {
	DozerBeanMapper mapper = new DozerBeanMapper();

	Properties property = mapper.map(action.getProperties(), Properties.class);

	Contentholder originalProperty = contentholderDAOProvider.get().get(action.getProperties().getId());
	property.setContentitems(originalProperty.getContentitems());
	property.setTimeStamp(System.currentTimeMillis());
	System.out.println("The property  being saved = " + property.getId());
	Users user = getUser();
	System.out.println("The user  =" + user);
	property.setUser(user);
	BaseWIPSvcHelper helper = new BaseWIPSvcHelper((Contentholder) property, contentholderDAOProvider.get(),
			itemDAOProvider.get());
	property = (Properties) helper.checkin();
	postSaveOrUpdateproperties(property);
	System.out.println("The property  that got checkedin =" + property.getId());
	PropertiesDTO pDTO = DozerBeanMapperSingletonWrapper.getInstance().map(property, PropertiesDTO.class);
	return new SavePropertyResult(pDTO);
}
 
开发者ID:jchaganti,项目名称:gharonda,代码行数:22,代码来源:SavePropertyHandler.java

示例3: sourceToDestinationMapping

import org.dozer.DozerBeanMapper; //导入方法依赖的package包/类
/**
 * @param source. The source object that needs to map to destination.
 * @param destination. The destination object that needs to map from source.
 * @return destination object
 */
public static Object sourceToDestinationMapping(Object source, Class destination) {

    DozerBeanMapper mapper = DozerBeanMapperSingletonWrapper.instance();
    Object destinationObj = mapper.map(source, destination);

    return destinationObj;
}
 
开发者ID:jaffa-projects,项目名称:jaffa-framework,代码行数:13,代码来源:MappingHelper.java

示例4: testDozer

import org.dozer.DozerBeanMapper; //导入方法依赖的package包/类
public Profiler testDozer(int invokeNum, String frameworkName) {
    DozerBeanMapper mapper = new DozerBeanMapper();
    long start = System.currentTimeMillis();
    for (int i = 0; i < invokeNum; i++) {
        Person7 p = getPerson();
        PersonDto dto = mapper.map(p, PersonDto.class);
        //System.out.println(dto);
    }
    return Profiler.apply(System.currentTimeMillis(), start)
            .setFrameworkName(frameworkName);
}
 
开发者ID:neoremind,项目名称:easy-mapper,代码行数:12,代码来源:BenchmarkTest.java

示例5: useJEntityGraphDataMapper

import org.dozer.DozerBeanMapper; //导入方法依赖的package包/类
/**
 * Combines using an entityGraph for accessing data from a database with
 * dozer mapping and returns a decoupled data object
 * 
 * @param em
 *            entity manager for database access
 * @param classTypeBE
 *            source object type
 * @param classTypeDO
 *            destination object type
 * @param entityGraphName
 *            name of the entity graph
 * @param id
 *            identification number for accessed entity
 * @return data object of type classTypeDO
 */
public <BE, DO> DO useJEntityGraphDataMapper(final EntityManager em, final Class<BE> classTypeBE,
		final Class<DO> classTypeDO, final String entityGraphName, final int id) {
	final BuildDozerMapping dozerMappingBuilder = new BuildDozerMapping();
	final BuildEntityGraph entityGraphBuilder = new BuildEntityGraph();

	BE businessEntity = null;
	DO dataObject = null;
	try {
		dataObject = classTypeDO.newInstance();
	} catch (InstantiationException | IllegalAccessException e) {
		e.printStackTrace();
	}

	@SuppressWarnings("unchecked")
	final EntityGraph<BE> xmlGraph = (EntityGraph<BE>) entityGraphBuilder.generateEntityGraphXPath(em,
			entityGraphName, classTypeBE);

	final Map<String, Object> hints = new HashMap<String, Object>();
	hints.put("javax.persistence.loadgraph", xmlGraph);

	businessEntity = em.find(classTypeBE, id, hints);

	final DozerBeanMapper mapper = dozerMappingBuilder.generateMappingRulesXPath(entityGraphName);
	mapper.map(businessEntity, dataObject);

	return dataObject;
}
 
开发者ID:doubleSlashde,项目名称:jEDM,代码行数:44,代码来源:JEntityGraphDataMapper.java

示例6: mapFromPerson

import org.dozer.DozerBeanMapper; //导入方法依赖的package包/类
public static PersonBean mapFromPerson(Person sourceObject) {
	List<String> myMappingFiles = new ArrayList<String>();
	myMappingFiles.add("dozerMappings.xml");

	DozerBeanMapper mapper = new DozerBeanMapper();
	mapper.setMappingFiles(myMappingFiles);

	System.out.println("Mapping Person to PersonBean...");
	return (PersonBean) mapper.map(sourceObject, PersonBean.class);
}
 
开发者ID:IntroSDE,项目名称:introsde,代码行数:11,代码来源:PersonBeanDelegate.java

示例7: mapToPerson

import org.dozer.DozerBeanMapper; //导入方法依赖的package包/类
public static Person mapToPerson(PersonBean sourceObject) {
	
	List<String> myMappingFiles = new ArrayList<String>();
	myMappingFiles.add("dozerMappings.xml");

	DozerBeanMapper mapper = new DozerBeanMapper();
	mapper.setMappingFiles(myMappingFiles);
	
	System.out.println("Mapping PersonBean to Person...");
	return (Person) mapper.map(sourceObject, Person.class);
}
 
开发者ID:IntroSDE,项目名称:introsde,代码行数:12,代码来源:PersonBeanDelegate.java

示例8: mapFromPerson

import org.dozer.DozerBeanMapper; //导入方法依赖的package包/类
public static PersonAnnotationBean mapFromPerson(Person sourceObject) {
	List<String> myMappingFiles = new ArrayList<String>();
	myMappingFiles.add("dozerMappings.xml");

	DozerBeanMapper mapper = new DozerBeanMapper();
	mapper.setMappingFiles(myMappingFiles);

	System.out.println("Mapping Person to PersonAnnotationBean...");
	return (PersonAnnotationBean) mapper.map(sourceObject, PersonAnnotationBean.class);
}
 
开发者ID:IntroSDE,项目名称:introsde,代码行数:11,代码来源:PersonAnnotationBeanDelegate.java

示例9: mapToPerson

import org.dozer.DozerBeanMapper; //导入方法依赖的package包/类
public static Person mapToPerson(PersonAnnotationBean sourceObject) {
	List<String> myMappingFiles = new ArrayList<String>();
	myMappingFiles.add("dozerMappings.xml");

	DozerBeanMapper mapper = new DozerBeanMapper();
	mapper.setMappingFiles(myMappingFiles);

	System.out.println("Mapping PersonAnnotationBean to Person...");
	return (Person) mapper.map(sourceObject, Person.class);
}
 
开发者ID:IntroSDE,项目名称:introsde,代码行数:11,代码来源:PersonAnnotationBeanDelegate.java


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