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


Java RmObjectMapper类代码示例

本文整理汇总了Java中org.quickbundle.project.serializer.RmObjectMapper的典型用法代码示例。如果您正苦于以下问题:Java RmObjectMapper类的具体用法?Java RmObjectMapper怎么用?Java RmObjectMapper使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: getJsonKeyCount

import org.quickbundle.project.serializer.RmObjectMapper; //导入依赖的package包/类
public String getJsonKeyCount() {
	List<Map<String, Object>> result = new ArrayList<Map<String, Object>>();
	for (Map.Entry<E, Long> en : mkc.entrySet()) {
		E key = en.getKey();
		long count = en.getValue();
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("value", count);
		map.put("text", key);
		result.add(map);
	}
	try {
		return RmObjectMapper.getInstance().writeValueAsString(result);
	} catch (JsonProcessingException e) {
		throw new RuntimeException(e);
	}
}
 
开发者ID:quickbundle,项目名称:qb-core,代码行数:17,代码来源:RmKeyCountList.java

示例2: getJsonCount

import org.quickbundle.project.serializer.RmObjectMapper; //导入依赖的package包/类
public String getJsonCount() {
	List<Long> result = new ArrayList<Long>();
	for (Map.Entry<E, Long> en : mkc.entrySet()) {
		Long count = en.getValue();
		result.add(count);
	}
	try {
		return RmObjectMapper.getInstance().writeValueAsString(result);
	} catch (JsonProcessingException e) {
		throw new RuntimeException(e);
	}
}
 
开发者ID:quickbundle,项目名称:qb-core,代码行数:13,代码来源:RmKeyCountList.java

示例3: getJsonKey

import org.quickbundle.project.serializer.RmObjectMapper; //导入依赖的package包/类
public String getJsonKey() {
	List<E> result = new ArrayList<E>();
	for (Map.Entry<E, Long> en : mkc.entrySet()) {
		E key = en.getKey();
		result.add(key);
	}
	try {
		return RmObjectMapper.getInstance().writeValueAsString(result);
	} catch (JsonProcessingException e) {
		throw new RuntimeException(e);
	}
}
 
开发者ID:quickbundle,项目名称:qb-core,代码行数:13,代码来源:RmKeyCountList.java

示例4: main

import org.quickbundle.project.serializer.RmObjectMapper; //导入依赖的package包/类
public static void main(String[] args) {
	List<Message> lvo = new ArrayList<Message>();
	lvo.add(new Message("1","a","a1"));
	lvo.add(new Message("2","b","a1bbb"));
	lvo.add(new Message("3","c","a1ccc"));
		String result = writeBackListToRowTable("a", lvo, new String[]{"age"}, null);
		System.out.println(result);
	
	try {
		System.out.println(RmObjectMapper.getInstance().readValue("{\"a\":{\"1\":1,\"2\":2},\"b\":3}", HashMap.class).get("a").getClass());
	} catch (Exception e) {
		e.printStackTrace();
	}
}
 
开发者ID:quickbundle,项目名称:qb-core,代码行数:15,代码来源:TestJackson.java

示例5: saveReceiptInfo

import org.quickbundle.project.serializer.RmObjectMapper; //导入依赖的package包/类
@RequestMapping(value = "/saveReceiptInfo", method = RequestMethod.GET, produces = MediaType.TEXT_PLAIN_VALUE)
@ResponseBody
public String saveReceiptInfo(@RequestParam String receiptApplicant, @RequestParam String receiptDate, @RequestParam String receiptTitle,
		@RequestParam String receiptDetail, @RequestParam String jsoncallback) throws JsonProcessingException {
	System.out.println("receipt is saved!" + receiptApplicant + " " + receiptTitle + " " + receiptDetail);
	String json = RmObjectMapper.getInstance().writeValueAsString("success!");
	return jsoncallback + "(" + json + ")";
}
 
开发者ID:quickbundle,项目名称:qb-archetype,代码行数:9,代码来源:PhonegapDemoRestController.java

示例6: deleteReceiptInfo

import org.quickbundle.project.serializer.RmObjectMapper; //导入依赖的package包/类
@RequestMapping(value = "/deleteReceiptInfo", method = RequestMethod.GET, produces = MediaType.TEXT_PLAIN_VALUE)
@ResponseBody
public String deleteReceiptInfo(@RequestParam String receiptNum, @RequestParam String jsoncallback) throws JsonProcessingException {
	System.out.println("receipt is delete!" + receiptNum);
	String json = RmObjectMapper.getInstance().writeValueAsString("success!");
	return jsoncallback + "(" + json + ")";
}
 
开发者ID:quickbundle,项目名称:qb-archetype,代码行数:8,代码来源:PhonegapDemoRestController.java

示例7: parseJson

import org.quickbundle.project.serializer.RmObjectMapper; //导入依赖的package包/类
@SuppressWarnings({ "rawtypes", "unchecked" })
static JobDataMap parseJson(String json) throws JsonParseException, JsonMappingException, IOException {
	JobDataMap dataMap = new JobDataMap();
	//转换json为map
	Map map = RmObjectMapper.getInstance().readValue(json, HashMap.class);
	List<Map<String, String>> paramsJo = (List<Map<String, String>>)map.get("params");
	for(Map keyValue : paramsJo) {
		if(!"".equals(keyValue.get("name"))) {
			dataMap.put(String.valueOf(keyValue.get("name")), String.valueOf(keyValue.get("des")));
			System.out.println(String.valueOf(keyValue.get("name")) + "\t" + String.valueOf(keyValue.get("des")));
		}
	}
	return dataMap;
}
 
开发者ID:quickbundle,项目名称:qb-archetype,代码行数:15,代码来源:SchedulerHelper.java

示例8: writeBackListToRowTable

import org.quickbundle.project.serializer.RmObjectMapper; //导入依赖的package包/类
/**
   * 回写List对象到行编辑模式的表格
   * @param namespace
   * @param lvo
   * @param ignoreName
   * @param om
   * @return
   * @throws JsonProcessingException
   */
  public static String writeBackListToRowTable(String namespace, List lvo, final String[] ignoreName, ObjectMapper objectMapper) {
  	if(lvo == null || lvo.size() == 0) {
  		return "";
  	}
  	StringBuilder result = new StringBuilder();
  	result.append("jQuery(function(){\n");
  	result.append("writeBackListToRowTable(");
  	result.append("'");
  	result.append(namespace);
  	result.append("'");
  	result.append(", ");
  	try {
      	if(objectMapper == null) {
      		objectMapper = RmObjectMapper.getInstance();
      	}
      	
  		// 排除
      	if(ignoreName != null) {
      		SimpleFilterProvider fileter = new SimpleFilterProvider();
      		fileter.addFilter("executeFilter", SimpleBeanPropertyFilter.serializeAllExcept(ignoreName));
      		objectMapper.setFilters(fileter);
      	}

  		// 设置日期格式化
  		objectMapper.setDateFormat(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"));

          SegmentedStringWriter sw = new SegmentedStringWriter(objectMapper.getFactory()._getBufferRecycler());
  		JsonGenerator generator = objectMapper.getFactory().createGenerator(sw);
  		RmBeanSerializerFactory rmBeanFactory = RmBeanSerializerFactory.instance;
  		if(ignoreName != null) {
  			rmBeanFactory.setFilterId("executeFilter");
  		}
  		objectMapper.setSerializerFactory(rmBeanFactory);

  		objectMapper.writeValue(generator, lvo);

	result.append( sw.getAndClear());
} catch (Exception e) {
	throw new RuntimeException(e);
}
  	result.append(");");
  	result.append("\n});");
  	return result.toString();
  }
 
开发者ID:quickbundle,项目名称:qb-core,代码行数:54,代码来源:RmVoHelper.java

示例9: writeBackListToRowTable

import org.quickbundle.project.serializer.RmObjectMapper; //导入依赖的package包/类
public static String writeBackListToRowTable(String namespace, List lvo, final String[] ignoreName, ObjectMapper objectMapper) {
    	if(lvo == null || lvo.size() == 0) {
    		return "";
    	}
    	//TODO ignoreName
    	if(objectMapper == null) {
    		objectMapper = RmObjectMapper.getInstance();
    	}
    	JsonEncoding encoding = JsonEncoding.UTF8;
    	objectMapper.setDateFormat(new SimpleDateFormat("yyyy-MM-dd"));
    	
    	StringBuilder result = new StringBuilder();
    	result.append("jQuery(function(){\n");
    	result.append("writeBackListToRowTable(");
    	result.append("'");
    	result.append(namespace);
    	result.append("'");
    	result.append(", \n");
    	try {
    		// 排除
    		SimpleFilterProvider fileter = new SimpleFilterProvider();
    		fileter.addFilter("executeFilter", SimpleBeanPropertyFilter.serializeAllExcept(ignoreName));
    		objectMapper.setFilters(fileter);

//    		// 仅包含
//    		SimpleFilterProvider fileter2 = new SimpleFilterProvider();
//    		fileter2.addFilter("includeFilter", SimpleBeanPropertyFilter.filterOutAllExcept(new String[] { "id", "quality" }));
//    		objectMapper.setFilters(fileter2);

    		// 设置日期格式化
    		objectMapper.setDateFormat(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"));

            SegmentedStringWriter sw = new SegmentedStringWriter(objectMapper.getFactory()._getBufferRecycler());
    		JsonGenerator generator = objectMapper.getFactory().createJsonGenerator(sw);
    		RmBeanSerializerFactory bidBeanFactory = RmBeanSerializerFactory.instance;
    		bidBeanFactory.setFilterId("executeFilter"); // 如果是仅包含这里填写 includeFilter
    		objectMapper.setSerializerFactory(bidBeanFactory);

    		objectMapper.writeValue(generator, lvo);

			result.append( sw.getAndClear());
		} catch (Exception e) {
			throw new RuntimeException(e);
		}
    	result.append("\n);");
    	result.append("\n});");
    	return result.toString();
    }
 
开发者ID:quickbundle,项目名称:qb-core,代码行数:49,代码来源:TestJackson.java


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