//json to java用到的
//很重要,很常用
//jsonConfig.setClassMap(classMap);
//jsonConfig.setCollectionType(collectionType);
//jsonConfig.setArrayMode(arrayMode);
//没用到
//jsonConfig.setEnclosedType(enclosedType);
//是否废弃掉""的json转换成java
//jsonConfig.setHandleJettisonEmptyElement(handleJettisonEmptyElement);
//jsonConfig.setJavaIdentifierTransformer(javaIdentifierTransformer);
//jsonConfig.setJavaPropertyFilter(javaPropertyFilter);
//jsonConfig.setJavaPropertyNameProcessorMatcher(propertyNameProcessorMatcher);
//jsonConfig.setNewBeanInstanceStrategy(newBeanInstanceStrategy);
//jsonConfig.setPropertyExclusionClassMatcher(propertyExclusionClassMatcher);
//被代替setJavaPropertyNameProcessorMatcher
//jsonConfig.setPropertyNameProcessorMatcher(propertyNameProcessorMatcher);
//jsonConfig.setPropertySetStrategy(propertySetStrategy);
//设置根的class
//jsonConfig.setRootClass(rootClass);
//设置JavaIdentifierTransformationInMapKeys是否忽略
//jsonConfig.setSkipJavaIdentifierTransformationInMapKeys(skipJavaIdentifierTransformationInMapKeys);
//可以对class中的单个属性名字改变
// jsonConfig.registerJavaPropertyNameProcessor(Person.class, new PropertyNameProcessor() {
//
// @Override
// public String processPropertyName(Class beanClass, String name) {
// System.out.println("---name" + name);
// if(name.equals("age")){
// return "99";
// }
// return name;
// }
// });
//jsonConfig.setNewBeanInstanceStrategy(newBeanInstanceStrategy);
/**
* Activate/Deactivate handling this jettison convention when converting to Java.<br> * Jettison
* states the following JSON {'media':{'title':'hello'}} can be set as a single element JSONArray
* (media is the array).<br>
* [JSON -> Java]
*/
//jsonConfig.setHandleJettisonSingleElementArray(handleJettisonSingleElementArray);
Json系列之五 揭开JsonConfig的神秘面纱 json to java
最新推荐文章于 2021-11-15 14:11:44 发布