Json系列之五 揭开JsonConfig的神秘面纱 json to java

来源:互联网 发布:sd卡数据删除不了 编辑:程序博客网 时间:2024/05/21 15:46
//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);

0 0
原创粉丝点击