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


Java FieldDeserializer.setValue方法代码示例

本文整理汇总了Java中com.alibaba.fastjson.parser.deserializer.FieldDeserializer.setValue方法的典型用法代码示例。如果您正苦于以下问题:Java FieldDeserializer.setValue方法的具体用法?Java FieldDeserializer.setValue怎么用?Java FieldDeserializer.setValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.alibaba.fastjson.parser.deserializer.FieldDeserializer的用法示例。


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

示例1: handleResovleTask

import com.alibaba.fastjson.parser.deserializer.FieldDeserializer; //导入方法依赖的package包/类
public void handleResovleTask(Object value) {
    if (this.resolveTaskList != null) {
        int size = this.resolveTaskList.size();
        for (int i = 0; i < size; i++) {
            ResolveTask task = (ResolveTask) this.resolveTaskList.get(i);
            FieldDeserializer fieldDeser = task.getFieldDeserializer();
            if (fieldDeser != null) {
                Object refValue;
                Object object = null;
                if (task.getOwnerContext() != null) {
                    object = task.getOwnerContext().getObject();
                }
                String ref = task.getReferenceValue();
                if (ref.startsWith("$")) {
                    refValue = getObject(ref);
                } else {
                    refValue = task.getContext().getObject();
                }
                fieldDeser.setValue(object, refValue);
            }
        }
    }
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:24,代码来源:DefaultJSONParser.java

示例2: handleResovleTask

import com.alibaba.fastjson.parser.deserializer.FieldDeserializer; //导入方法依赖的package包/类
public void handleResovleTask(Object value) {
    if (resolveTaskList == null) {
        return;
    }

    int size = resolveTaskList.size();
    for (int i = 0; i < size; ++i) {
        ResolveTask task = resolveTaskList.get(i);
        FieldDeserializer fieldDeser = task.getFieldDeserializer();

        if (fieldDeser == null) {
            continue;
        }

        Object object = null;
        if (task.getOwnerContext() != null) {
            object = task.getOwnerContext().getObject();
        }

        String ref = task.getReferenceValue();
        Object refValue;
        if (ref.startsWith("$")) {
            refValue = getObject(ref);
        } else {
            refValue = task.getContext().getObject();
        }
        fieldDeser.setValue(object, refValue);
    }
}
 
开发者ID:uavorg,项目名称:uavstack,代码行数:30,代码来源:DefaultJSONParser.java

示例3: handleResovleTask

import com.alibaba.fastjson.parser.deserializer.FieldDeserializer; //导入方法依赖的package包/类
public static void handleResovleTask(DefaultJSONParser parser, Object value) {
    List<ResolveTask> resolveTaskList = parser.getResolveTaskListDirect();
    if (resolveTaskList == null) {
        return;
    }
    int size = resolveTaskList.size();
    for (int i = 0; i < size; ++i) {
        ResolveTask task = resolveTaskList.get(i);
        FieldDeserializer fieldDeser = task.getFieldDeserializer();
        
        if (fieldDeser == null) {
            continue;
        }

        Object object = null;
        if (task.getOwnerContext() != null) {
            object = task.getOwnerContext().getObject();
        }

        String ref = task.getReferenceValue();
        Object refValue;
        if (ref.startsWith("$")) {
            refValue = parser.getObject(ref);
        } else {
            refValue = task.getContext().getObject();
        }
        fieldDeser.setValue(object, refValue);
    }
}
 
开发者ID:liufeiit,项目名称:itmarry,代码行数:30,代码来源:JSON.java

示例4: handleResovleTask

import com.alibaba.fastjson.parser.deserializer.FieldDeserializer; //导入方法依赖的package包/类
public static <T> int handleResovleTask(DefaultJSONParser parser, T value) {
    if (parser.isEnabled(Feature.DisableCircularReferenceDetect)) {
        return 0;
    }

    int size = parser.getResolveTaskList().size();
    for (int i = 0; i < size; ++i) {
        ResolveTask task = parser.getResolveTaskList().get(i);
        FieldDeserializer fieldDeser = task.getFieldDeserializer();

        Object object = null;
        if (task.getOwnerContext() != null) {
            object = task.getOwnerContext().getObject();
        }

        String ref = task.getReferenceValue();
        Object refValue;
        if (ref.startsWith("$")) {
            refValue = parser.getObject(ref);
        } else {
            refValue = task.getContext().getObject();
        }
        fieldDeser.setValue(object, refValue);
    }
    
    return size;
}
 
开发者ID:baogongtc,项目名称:android_http_demo,代码行数:28,代码来源:JSON.java

示例5: parseObject

import com.alibaba.fastjson.parser.deserializer.FieldDeserializer; //导入方法依赖的package包/类
public void parseObject(Object object) {
    Class<?> clazz = object.getClass();
    Map<String, FieldDeserializer> setters = config.getFieldDeserializers(clazz);

    if (lexer.token() != JSONToken.LBRACE && lexer.token() != JSONToken.COMMA) {
        throw new JSONException("syntax error, expect {, actual " + lexer.tokenName());
    }

    for (;;) {
        // lexer.scanSymbol
        String key = lexer.scanSymbol(symbolTable);

        if (key == null) {
            if (lexer.token() == JSONToken.RBRACE) {
                lexer.nextToken(JSONToken.COMMA);
                break;
            }
            if (lexer.token() == JSONToken.COMMA) {
                if (isEnabled(Feature.AllowArbitraryCommas)) {
                    continue;
                }
            }
        }

        FieldDeserializer fieldDeser = setters.get(key);
        if (fieldDeser == null) {
            if (!isEnabled(Feature.IgnoreNotMatch)) {
                throw new JSONException("setter not found, class " + clazz.getName() + ", property " + key);
            }

            lexer.nextTokenWithColon();
            parse(); // skip

            if (lexer.token() == JSONToken.RBRACE) {
                lexer.nextToken();
                return;
            }

            continue;
        } else {
            Class<?> fieldClass = fieldDeser.getFieldClass();
            Type fieldType = fieldDeser.getFieldType();
            Object fieldValue;
            if (fieldClass == int.class) {
                lexer.nextTokenWithColon(JSONToken.LITERAL_INT);
                fieldValue = IntegerCodec.instance.deserialze(this, fieldType, null);
            } else if (fieldClass == String.class) {
                lexer.nextTokenWithColon(JSONToken.LITERAL_STRING);
                fieldValue = StringCodec.deserialze(this);
            } else if (fieldClass == long.class) {
                lexer.nextTokenWithColon(JSONToken.LITERAL_INT);
                fieldValue = LongCodec.instance.deserialze(this, fieldType, null);
            } else {
                ObjectDeserializer fieldValueDeserializer = config.getDeserializer(fieldClass, fieldType);

                lexer.nextTokenWithColon(fieldValueDeserializer.getFastMatchToken());
                fieldValue = fieldValueDeserializer.deserialze(this, fieldType, null);
            }

            fieldDeser.setValue(object, fieldValue);
        }

        if (lexer.token() == JSONToken.COMMA) {
            continue;
        }

        if (lexer.token() == JSONToken.RBRACE) {
            lexer.nextToken(JSONToken.COMMA);
            return;
        }
    }
}
 
开发者ID:liufeiit,项目名称:itmarry,代码行数:73,代码来源:DefaultJSONParser.java


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