當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。