本文整理汇总了Java中com.alibaba.fastjson.util.FieldInfo类的典型用法代码示例。如果您正苦于以下问题:Java FieldInfo类的具体用法?Java FieldInfo怎么用?Java FieldInfo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
FieldInfo类属于com.alibaba.fastjson.util包,在下文中一共展示了FieldInfo类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: _batchSet
import com.alibaba.fastjson.util.FieldInfo; //导入依赖的package包/类
private void _batchSet(Context context, MethodVisitor mw, boolean flag) {
for (int i = 0, size = context.fieldInfoList.length; i < size; ++i) {
Label notSet_ = new Label();
if (flag) {
_isFlag(mw, context, i, notSet_);
}
FieldInfo fieldInfo = context.fieldInfoList[i];
_loadAndSet(context, mw, fieldInfo);
if (flag) {
mw.visitLabel(notSet_);
}
}
}
示例2: _getCollectionFieldItemDeser
import com.alibaba.fastjson.util.FieldInfo; //导入依赖的package包/类
private void _getCollectionFieldItemDeser(Context context, MethodVisitor mw, FieldInfo fieldInfo,
Class<?> itemType) {
Label notNull_ = new Label();
mw.visitVarInsn(ALOAD, 0);
mw.visitFieldInsn(GETFIELD, context.className, fieldInfo.name + "_asm_list_item_deser__",
desc(ObjectDeserializer.class));
mw.visitJumpInsn(IFNONNULL, notNull_);
mw.visitVarInsn(ALOAD, 0);
mw.visitVarInsn(ALOAD, 1);
mw.visitMethodInsn(INVOKEVIRTUAL, DefaultJSONParser, "getConfig", "()" + desc(ParserConfig.class));
mw.visitLdcInsn(com.alibaba.fastjson.asm.Type.getType(desc(itemType)));
mw.visitMethodInsn(INVOKEVIRTUAL, type(ParserConfig.class), "getDeserializer",
"(Ljava/lang/reflect/Type;)" + desc(ObjectDeserializer.class));
mw.visitFieldInsn(PUTFIELD, context.className, fieldInfo.name + "_asm_list_item_deser__",
desc(ObjectDeserializer.class));
mw.visitLabel(notNull_);
mw.visitVarInsn(ALOAD, 0);
mw.visitFieldInsn(GETFIELD, context.className, fieldInfo.name + "_asm_list_item_deser__",
desc(ObjectDeserializer.class));
}
示例3: _getFieldDeser
import com.alibaba.fastjson.util.FieldInfo; //导入依赖的package包/类
private void _getFieldDeser(Context context, MethodVisitor mw, FieldInfo fieldInfo) {
Label notNull_ = new Label();
mw.visitVarInsn(ALOAD, 0);
mw.visitFieldInsn(GETFIELD, context.className, fieldInfo.name + "_asm_deser__", desc(ObjectDeserializer.class));
mw.visitJumpInsn(IFNONNULL, notNull_);
mw.visitVarInsn(ALOAD, 0);
mw.visitVarInsn(ALOAD, 1);
mw.visitMethodInsn(INVOKEVIRTUAL, DefaultJSONParser, "getConfig", "()" + desc(ParserConfig.class));
mw.visitLdcInsn(com.alibaba.fastjson.asm.Type.getType(desc(fieldInfo.fieldClass)));
mw.visitMethodInsn(INVOKEVIRTUAL, type(ParserConfig.class), "getDeserializer",
"(Ljava/lang/reflect/Type;)" + desc(ObjectDeserializer.class));
mw.visitFieldInsn(PUTFIELD, context.className, fieldInfo.name + "_asm_deser__", desc(ObjectDeserializer.class));
mw.visitLabel(notNull_);
mw.visitVarInsn(ALOAD, 0);
mw.visitFieldInsn(GETFIELD, context.className, fieldInfo.name + "_asm_deser__", desc(ObjectDeserializer.class));
}
示例4: _double
import com.alibaba.fastjson.util.FieldInfo; //导入依赖的package包/类
private void _double(Class<?> clazz, MethodVisitor mw, FieldInfo property, Context context) {
Label _end = new Label();
_nameApply(mw, property, context, _end);
_get(mw, context, property);
mw.visitVarInsn(DSTORE, context.var("double", 2));
_filters(mw, property, context, _end);
mw.visitVarInsn(ALOAD, context.var("out"));
mw.visitVarInsn(ILOAD, context.var("seperator"));
mw.visitVarInsn(ALOAD, context.fieldName());
mw.visitVarInsn(DLOAD, context.var("double", 2));
mw.visitMethodInsn(INVOKEVIRTUAL, "com/alibaba/fastjson/serializer/SerializeWriter", "writeFieldValue", "(CLjava/lang/String;D)V");
_seperator(mw, context);
mw.visitLabel(_end);
}
示例5: _int
import com.alibaba.fastjson.util.FieldInfo; //导入依赖的package包/类
private void _int(Class<?> clazz, MethodVisitor mw, FieldInfo property, Context context) {
Label _end = new Label();
_nameApply(mw, property, context, _end);
_get(mw, context, property);
mw.visitVarInsn(ISTORE, context.var("int"));
_filters(mw, property, context, _end);
mw.visitVarInsn(ALOAD, context.var("out"));
mw.visitVarInsn(ILOAD, context.var("seperator"));
mw.visitVarInsn(ALOAD, context.fieldName());
mw.visitVarInsn(ILOAD, context.var("int"));
mw.visitMethodInsn(INVOKEVIRTUAL, "com/alibaba/fastjson/serializer/SerializeWriter", "writeFieldValue", "(CLjava/lang/String;I)V");
_seperator(mw, context);
mw.visitLabel(_end);
}
示例6: FieldSerializer
import com.alibaba.fastjson.util.FieldInfo; //导入依赖的package包/类
public FieldSerializer(FieldInfo fieldInfo){
super();
this.fieldInfo = fieldInfo;
fieldInfo.setAccessible(true);
this.double_quoted_fieldPrefix = '"' + fieldInfo.getName() + "\":";
this.single_quoted_fieldPrefix = '\'' + fieldInfo.getName() + "\':";
this.un_quoted_fieldPrefix = fieldInfo.getName() + ":";
JSONField annotation = fieldInfo.getAnnotation(JSONField.class);
if (annotation != null) {
for (SerializerFeature feature : annotation.serialzeFeatures()) {
if (feature == SerializerFeature.WriteMapNullValue) {
writeNull = true;
}
}
}
}
示例7: _long
import com.alibaba.fastjson.util.FieldInfo; //导入依赖的package包/类
private void _long(Class<?> clazz, MethodVisitor mw, FieldInfo property, Context context) {
Label end_ = new Label();
_nameApply(mw, property, context, end_);
_get(mw, context, property);
mw.visitVarInsn(LSTORE, context.var("long", 2));
_filters(mw, property, context, end_);
mw.visitVarInsn(ALOAD, context.var("out"));
mw.visitVarInsn(ILOAD, context.var("seperator"));
mw.visitVarInsn(ALOAD, Context.fieldName);
mw.visitVarInsn(LLOAD, context.var("long", 2));
mw.visitMethodInsn(INVOKEVIRTUAL, SerializeWriter, "writeFieldValue", "(CLjava/lang/String;J)V");
_seperator(mw, context);
mw.visitLabel(end_);
}
示例8: _float
import com.alibaba.fastjson.util.FieldInfo; //导入依赖的package包/类
private void _float(Class<?> clazz, MethodVisitor mw, FieldInfo property, Context context) {
Label end_ = new Label();
_nameApply(mw, property, context, end_);
_get(mw, context, property);
mw.visitVarInsn(FSTORE, context.var("float"));
_filters(mw, property, context, end_);
mw.visitVarInsn(ALOAD, context.var("out"));
mw.visitVarInsn(ILOAD, context.var("seperator"));
mw.visitVarInsn(ALOAD, Context.fieldName);
mw.visitVarInsn(FLOAD, context.var("float"));
mw.visitMethodInsn(INVOKEVIRTUAL, SerializeWriter, "writeFieldValue", "(CLjava/lang/String;F)V");
_seperator(mw, context);
mw.visitLabel(end_);
}
示例9: _double
import com.alibaba.fastjson.util.FieldInfo; //导入依赖的package包/类
private void _double(Class<?> clazz, MethodVisitor mw, FieldInfo property, Context context) {
Label end_ = new Label();
_nameApply(mw, property, context, end_);
_get(mw, context, property);
mw.visitVarInsn(DSTORE, context.var("double", 2));
_filters(mw, property, context, end_);
mw.visitVarInsn(ALOAD, context.var("out"));
mw.visitVarInsn(ILOAD, context.var("seperator"));
mw.visitVarInsn(ALOAD, Context.fieldName);
mw.visitVarInsn(DLOAD, context.var("double", 2));
mw.visitMethodInsn(INVOKEVIRTUAL, SerializeWriter, "writeFieldValue", "(CLjava/lang/String;D)V");
_seperator(mw, context);
mw.visitLabel(end_);
}
示例10: _byte
import com.alibaba.fastjson.util.FieldInfo; //导入依赖的package包/类
private void _byte(Class<?> clazz, MethodVisitor mw, FieldInfo property, Context context) {
Label _end = new Label();
_nameApply(mw, property, context, _end);
_get(mw, context, property);
mw.visitVarInsn(ISTORE, context.var("byte"));
_filters(mw, property, context, _end);
mw.visitVarInsn(ALOAD, context.var("out"));
mw.visitVarInsn(ILOAD, context.var("seperator"));
mw.visitVarInsn(ALOAD, context.fieldName());
mw.visitVarInsn(ILOAD, context.var("byte"));
mw.visitMethodInsn(INVOKEVIRTUAL, "com/alibaba/fastjson/serializer/SerializeWriter", "writeFieldValue", "(CLjava/lang/String;I)V");
_seperator(mw, context);
mw.visitLabel(_end);
}
示例11: _filters
import com.alibaba.fastjson.util.FieldInfo; //导入依赖的package包/类
private void _filters(MethodVisitor mw, FieldInfo property, Context context, Label _end) {
if (property.fieldTransient) {
mw.visitVarInsn(ALOAD, context.var("out"));
mw.visitLdcInsn(SerializerFeature.SkipTransientField.mask);
mw.visitMethodInsn(INVOKEVIRTUAL, SerializeWriter, "isEnabled", "(I)Z");
mw.visitJumpInsn(IFNE, _end);
}
_notWriteDefault(mw, property, context, _end);
if (context.writeDirect) {
return;
}
_apply(mw, property, context);
mw.visitJumpInsn(IFEQ, _end);
_processKey(mw, property, context);
_processValue(mw, property, context, _end);
}
示例12: _nameApply
import com.alibaba.fastjson.util.FieldInfo; //导入依赖的package包/类
private void _nameApply(MethodVisitor mw, FieldInfo property, Context context, Label _end) {
if (!context.writeDirect) {
mw.visitVarInsn(ALOAD, 0);
mw.visitVarInsn(ALOAD, Context.serializer);
mw.visitVarInsn(ALOAD, Context.obj);
mw.visitVarInsn(ALOAD, Context.fieldName);
mw.visitMethodInsn(INVOKEVIRTUAL, JavaBeanSerializer, "applyName",
"(L" + JSONSerializer + ";Ljava/lang/Object;Ljava/lang/String;)Z");
mw.visitJumpInsn(IFEQ, _end);
_labelApply(mw, property, context, _end);
}
if (property.field == null) {
mw.visitVarInsn(ALOAD, context.var("out"));
mw.visitLdcInsn(SerializerFeature.IgnoreNonFieldGetter.mask);
mw.visitMethodInsn(INVOKEVIRTUAL, SerializeWriter, "isEnabled", "(I)Z");
// if true
mw.visitJumpInsn(IFNE, _end);
}
}
示例13: createFieldDeserializer
import com.alibaba.fastjson.util.FieldInfo; //导入依赖的package包/类
public FieldDeserializer createFieldDeserializer(ParserConfig mapping, Class<?> clazz, FieldInfo fieldInfo) {
return mapping.createFieldDeserializer(mapping, clazz, fieldInfo);
}
示例14: _getCollectionFieldItemDeser
import com.alibaba.fastjson.util.FieldInfo; //导入依赖的package包/类
private void _getCollectionFieldItemDeser(Context context, MethodVisitor mw, FieldInfo fieldInfo, Class<?> itemType) {
Label notNull_ = new Label();
mw.visitVarInsn(ALOAD, 0);
mw.visitFieldInsn(GETFIELD, context.getClassName(), fieldInfo.getName() + "_asm_list_item_deser__",
"Lcom/alibaba/fastjson/parser/deserializer/ObjectDeserializer;");
mw.visitJumpInsn(IFNONNULL, notNull_);
mw.visitVarInsn(ALOAD, 0);
mw.visitVarInsn(ALOAD, 1);
mw.visitMethodInsn(INVOKEVIRTUAL, "com/alibaba/fastjson/parser/DefaultJSONParser", "getConfig", "()"
+ "Lcom/alibaba/fastjson/parser/ParserConfig;");
mw.visitLdcInsn(com.alibaba.fastjson.asm.Type.getType(getDesc(itemType)));
mw.visitMethodInsn(INVOKEVIRTUAL, "com/alibaba/fastjson/parser/ParserConfig", "getDeserializer",
"(Ljava/lang/reflect/Type;)Lcom/alibaba/fastjson/parser/deserializer/ObjectDeserializer;");
mw.visitFieldInsn(PUTFIELD, context.getClassName(), fieldInfo.getName() + "_asm_list_item_deser__",
"Lcom/alibaba/fastjson/parser/deserializer/ObjectDeserializer;");
mw.visitLabel(notNull_);
mw.visitVarInsn(ALOAD, 0);
mw.visitFieldInsn(GETFIELD, context.getClassName(), fieldInfo.getName() + "_asm_list_item_deser__",
"Lcom/alibaba/fastjson/parser/deserializer/ObjectDeserializer;");
}
示例15: _getListFieldItemSer
import com.alibaba.fastjson.util.FieldInfo; //导入依赖的package包/类
private void _getListFieldItemSer(Context context, MethodVisitor mw, FieldInfo fieldInfo, Class<?> itemType) {
Label notNull_ = new Label();
mw.visitVarInsn(ALOAD, 0);
mw.visitFieldInsn(GETFIELD, context.className, fieldInfo.name + "_asm_list_item_ser_",
ObjectSerializer_desc);
mw.visitJumpInsn(IFNONNULL, notNull_);
mw.visitVarInsn(ALOAD, 0); // this
mw.visitVarInsn(ALOAD, Context.serializer);
mw.visitLdcInsn(com.alibaba.fastjson.asm.Type.getType(desc(itemType)));
mw.visitMethodInsn(INVOKEVIRTUAL, JSONSerializer, "getObjectWriter",
"(Ljava/lang/Class;)" + ObjectSerializer_desc);
mw.visitFieldInsn(PUTFIELD, context.className, fieldInfo.name + "_asm_list_item_ser_",
ObjectSerializer_desc);
mw.visitLabel(notNull_);
mw.visitVarInsn(ALOAD, 0);
mw.visitFieldInsn(GETFIELD, context.className, fieldInfo.name + "_asm_list_item_ser_",
ObjectSerializer_desc);
}