本文整理汇总了Java中com.alibaba.fastjson.parser.deserializer.JavaBeanDeserializer类的典型用法代码示例。如果您正苦于以下问题:Java JavaBeanDeserializer类的具体用法?Java JavaBeanDeserializer怎么用?Java JavaBeanDeserializer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
JavaBeanDeserializer类属于com.alibaba.fastjson.parser.deserializer包,在下文中一共展示了JavaBeanDeserializer类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: getFieldDeserializers
import com.alibaba.fastjson.parser.deserializer.JavaBeanDeserializer; //导入依赖的package包/类
public Map<String, FieldDeserializer> getFieldDeserializers(Class<?> clazz) {
ObjectDeserializer deserizer = getDeserializer(clazz);
if (deserizer instanceof JavaBeanDeserializer) {
return ((JavaBeanDeserializer) deserizer).getFieldDeserializerMap();
} else {
return Collections.emptyMap();
}
}
开发者ID:xiaoshutong,项目名称:AndroidNio,代码行数:10,代码来源:ParserConfig.java
示例2: getFieldDeserializers
import com.alibaba.fastjson.parser.deserializer.JavaBeanDeserializer; //导入依赖的package包/类
public Map<String, FieldDeserializer> getFieldDeserializers(Class<?> clazz) {
ObjectDeserializer deserizer = getDeserializer((Type) clazz);
if (deserizer instanceof JavaBeanDeserializer) {
return ((JavaBeanDeserializer) deserizer).getFieldDeserializerMap();
}
if (deserizer instanceof ASMJavaBeanDeserializer) {
return ((ASMJavaBeanDeserializer) deserizer).getInnterSerializer().getFieldDeserializerMap();
}
return Collections.emptyMap();
}
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:11,代码来源:ParserConfig.java
示例3: getFieldDeserializers
import com.alibaba.fastjson.parser.deserializer.JavaBeanDeserializer; //导入依赖的package包/类
public Map<String, FieldDeserializer> getFieldDeserializers(Class<?> clazz) {
ObjectDeserializer deserizer = getDeserializer(clazz);
if (deserizer instanceof JavaBeanDeserializer) {
return ((JavaBeanDeserializer) deserizer).getFieldDeserializerMap();
} else if (deserizer instanceof ASMJavaBeanDeserializer) {
return ((ASMJavaBeanDeserializer) deserizer).getInnterSerializer().getFieldDeserializerMap();
} else {
return Collections.emptyMap();
}
}
开发者ID:uavorg,项目名称:uavstack,代码行数:12,代码来源:ParserConfig.java
示例4: createJavaBeanDeserializer
import com.alibaba.fastjson.parser.deserializer.JavaBeanDeserializer; //导入依赖的package包/类
public ObjectDeserializer createJavaBeanDeserializer(Class<?> clazz, Type type) {
if (clazz == Class.class) {
return this.defaultSerializer;
}
return new JavaBeanDeserializer(this, clazz, type);
}
开发者ID:baogongtc,项目名称:android_http_demo,代码行数:8,代码来源:ParserConfig.java
示例5: parseField
import com.alibaba.fastjson.parser.deserializer.JavaBeanDeserializer; //导入依赖的package包/类
@Override
public void parseField(DefaultJSONParser parser, Object object, Type objectType, Map<String, Object> fieldValues) {
if (fieldValueDeserilizer == null) {
getFieldValueDeserilizer(parser.getConfig());
}
Type fieldType = fieldInfo.fieldType;
if (objectType instanceof ParameterizedType) {
ParseContext objContext = parser.getContext();
objContext.type = objectType;
fieldType = FieldInfo.getFieldType(this.clazz, objectType, fieldType);
}
// ContextObjectDeserializer
Object value;
if (fieldValueDeserilizer instanceof JavaBeanDeserializer) {
JavaBeanDeserializer javaBeanDeser = (JavaBeanDeserializer) fieldValueDeserilizer;
value = javaBeanDeser.deserialze(parser, fieldType, fieldInfo.name, fieldInfo.parserFeatures);
} else {
if (this.fieldInfo.format != null && fieldValueDeserilizer instanceof ContextObjectDeserializer) {
value = ((ContextObjectDeserializer) fieldValueDeserilizer) //
.deserialze(parser, fieldType,
fieldInfo.name,
fieldInfo.format,
fieldInfo.parserFeatures);
} else {
value = fieldValueDeserilizer.deserialze(parser, fieldType, fieldInfo.name);
}
}
if (parser.getResolveStatus() == DefaultJSONParser.NeedToResolve) {
DefaultJSONParser.ResolveTask task = parser.getLastResolveTask();
task.fieldDeserializer = this;
task.ownerContext = parser.getContext();
parser.setResolveStatus(DefaultJSONParser.NONE);
} else {
if (object == null) {
fieldValues.put(fieldInfo.name, value);
} else {
setValue(object, value);
}
}
}
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:43,代码来源:DefaultFieldDeserializerBug569.java
示例6: test_for_issue
import com.alibaba.fastjson.parser.deserializer.JavaBeanDeserializer; //导入依赖的package包/类
public void test_for_issue() throws Exception {
ParserConfig config = new ParserConfig();
ObjectDeserializer deser = config.getDeserializer(Model.class);
Assert.assertEquals(JavaBeanDeserializer.class, deser.getClass());
}
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:6,代码来源:Bug_for_issue_372.java
示例7: createJavaBeanDeserializer
import com.alibaba.fastjson.parser.deserializer.JavaBeanDeserializer; //导入依赖的package包/类
public ObjectDeserializer createJavaBeanDeserializer(Class<?> clazz, Type type) {
boolean asmEnable = this.asmEnable;
if (asmEnable) {
Class<?> superClass = clazz;
while (Modifier.isPublic(superClass.getModifiers())) {
superClass = superClass.getSuperclass();
if (superClass != Object.class) {
if (superClass == null) {
break;
}
}
break;
}
asmEnable = false;
}
if (clazz.getTypeParameters().length != 0) {
asmEnable = false;
}
if (asmEnable && this.asmFactory != null && this.asmFactory.isExternalClass(clazz)) {
asmEnable = false;
}
if (asmEnable) {
asmEnable = ASMUtils.checkName(clazz.getName());
}
if (asmEnable) {
if (clazz.isInterface()) {
asmEnable = false;
}
DeserializeBeanInfo beanInfo = DeserializeBeanInfo.computeSetters(clazz, type);
if (beanInfo.getFieldList().size() > 200) {
asmEnable = false;
}
if (beanInfo.getDefaultConstructor() == null && !clazz.isInterface()) {
asmEnable = false;
}
for (FieldInfo fieldInfo : beanInfo.getFieldList()) {
if (fieldInfo.isGetOnly()) {
asmEnable = false;
break;
}
Class<?> fieldClass = fieldInfo.getFieldClass();
if (!Modifier.isPublic(fieldClass.getModifiers())) {
asmEnable = false;
break;
}
if (fieldClass.isMemberClass() && !Modifier.isStatic(fieldClass.getModifiers())) {
asmEnable = false;
}
if (!ASMUtils.checkName(fieldInfo.getMember().getName())) {
asmEnable = false;
}
}
}
if (asmEnable && clazz.isMemberClass() && !Modifier.isStatic(clazz.getModifiers())) {
asmEnable = false;
}
if (!asmEnable) {
return new JavaBeanDeserializer(this, clazz, type);
}
try {
return this.asmFactory.createJavaBeanDeserializer(this, clazz, type);
} catch (NoSuchMethodException e) {
return new JavaBeanDeserializer(this, clazz, type);
} catch (ASMException e2) {
return new JavaBeanDeserializer(this, clazz, type);
} catch (Exception e3) {
throw new JSONException("create asm deserializer error, " + clazz.getName(), e3);
}
}
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:70,代码来源:ParserConfig.java
示例8: fastJsonGenericHttpMessageConverter
import com.alibaba.fastjson.parser.deserializer.JavaBeanDeserializer; //导入依赖的package包/类
@Bean
@Primary
@ConfigurationProperties(prefix = "fastjson")
public FastJsonGenericHttpMessageConverter fastJsonGenericHttpMessageConverter(EntityFactory entityFactory) {
JSON.DEFAULT_PARSER_FEATURE |= Feature.DisableFieldSmartMatch.getMask();
FastJsonGenericHttpMessageConverter converter = new FastJsonGenericHttpMessageConverter();
converter.setFeatures(
SerializerFeature.WriteNullListAsEmpty,
SerializerFeature.WriteNullNumberAsZero,
SerializerFeature.WriteNullBooleanAsFalse
);
converter.setConverters(converters);
ParserConfig.global = new ParserConfig() {
@Override
public ObjectDeserializer getDeserializer(Type type) {
ObjectDeserializer derializer = getDeserializers().get(type);
if (derializer != null) {
return derializer;
}
if (type instanceof Class) {
Class classType = ((Class) type);
if (classType.isEnum()) {
return super.getDeserializer(type);
}
checkAutoType(type.getTypeName(), ((Class) type));
if (Modifier.isAbstract(classType.getModifiers()) || Modifier.isInterface(classType.getModifiers())) {
Class realType;
if (entityFactory != null && (realType = entityFactory.getInstanceType(classType)) != null) {
return new JavaBeanDeserializer(this, realType, type);
}
} else {
return new JavaBeanDeserializer(this, classType);
}
}
return super.getDeserializer(type);
}
};
//fastjson.parser.autoTypeAccept
ParserConfig.global.addAccept("org.hswebframework.web.entity.");
ParserConfig.global.addDeny("org.hswebframework.ezorm.core.param.SqlTerm");
return converter;
}
开发者ID:hs-web,项目名称:hsweb-framework,代码行数:45,代码来源:HswebAutoConfiguration.java
示例9: createJavaBeanDeserializer
import com.alibaba.fastjson.parser.deserializer.JavaBeanDeserializer; //导入依赖的package包/类
public ObjectDeserializer createJavaBeanDeserializer(Class<?> clazz, Type type) {
boolean asmEnable = this.asmEnable;
if (asmEnable) {
Class<?> superClass = clazz;
for (;;) {
if (!Modifier.isPublic(superClass.getModifiers())) {
asmEnable = false;
break;
}
superClass = superClass.getSuperclass();
if (superClass == Object.class || superClass == null) {
break;
}
}
}
if (clazz.getTypeParameters().length != 0) {
asmEnable = false;
}
if (asmFactory.isExternalClass(clazz)) {
asmEnable = false;
}
if (asmEnable) {
if (clazz.isInterface()) {
asmEnable = false;
}
DeserializeBeanInfo beanInfo = DeserializeBeanInfo.computeSetters(clazz, type);
if (beanInfo.getFieldList().size() > 200) {
asmEnable = false;
}
Constructor<?> defaultConstructor = beanInfo.getDefaultConstructor();
if (defaultConstructor == null && !clazz.isInterface()) {
asmEnable = false;
}
for (FieldInfo fieldInfo : beanInfo.getFieldList()) {
if (fieldInfo.isGetOnly()) {
asmEnable = false;
break;
}
Class<?> fieldClass = fieldInfo.getFieldClass();
if (!Modifier.isPublic(fieldClass.getModifiers())) {
asmEnable = false;
break;
}
if (fieldClass.isMemberClass() && !Modifier.isStatic(fieldClass.getModifiers())) {
asmEnable = false;
}
}
}
if (asmEnable) {
if (clazz.isMemberClass() && !Modifier.isStatic(clazz.getModifiers())) {
asmEnable = false;
}
}
if (!asmEnable) {
return new JavaBeanDeserializer(this, clazz, type);
}
try {
return asmFactory.createJavaBeanDeserializer(this, clazz, type);
// } catch (VerifyError e) {
// e.printStackTrace();
// return new JavaBeanDeserializer(this, clazz, type);
} catch (NoSuchMethodException ex) {
return new JavaBeanDeserializer(this, clazz, type);
} catch (ASMException asmError) {
return new JavaBeanDeserializer(this, clazz, type);
} catch (Exception e) {
throw new JSONException("create asm deserializer error, " + clazz.getName(), e);
}
}
开发者ID:liufeiit,项目名称:itmarry,代码行数:82,代码来源:ParserConfig.java
注:本文中的com.alibaba.fastjson.parser.deserializer.JavaBeanDeserializer类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论