Search in sources :

Example 1 with ResolveFieldDeserializer

use of com.alibaba.fastjson.parser.deserializer.ResolveFieldDeserializer in project fastjson by alibaba.

the class DefaultJSONParser method checkListResolve.

@SuppressWarnings("rawtypes")
public void checkListResolve(Collection array) {
    if (resolveStatus == NeedToResolve) {
        if (array instanceof List) {
            final int index = array.size() - 1;
            final List list = (List) array;
            ResolveTask task = getLastResolveTask();
            task.fieldDeserializer = new ResolveFieldDeserializer(this, list, index);
            task.ownerContext = context;
            setResolveStatus(DefaultJSONParser.NONE);
        } else {
            ResolveTask task = getLastResolveTask();
            task.fieldDeserializer = new ResolveFieldDeserializer(array);
            task.ownerContext = context;
            setResolveStatus(DefaultJSONParser.NONE);
        }
    }
}
Also used : ResolveFieldDeserializer(com.alibaba.fastjson.parser.deserializer.ResolveFieldDeserializer) ArrayList(java.util.ArrayList) List(java.util.List)

Example 2 with ResolveFieldDeserializer

use of com.alibaba.fastjson.parser.deserializer.ResolveFieldDeserializer in project fastjson by alibaba.

the class ResolveFieldDeserializerTest method test_0.

public void test_0() throws Exception {
    new ResolveFieldDeserializer(null, null).parseField(null, null, null, null);
    new ResolveFieldDeserializer(null, null, 0).parseField(null, null, null, null);
}
Also used : ResolveFieldDeserializer(com.alibaba.fastjson.parser.deserializer.ResolveFieldDeserializer)

Example 3 with ResolveFieldDeserializer

use of com.alibaba.fastjson.parser.deserializer.ResolveFieldDeserializer in project fastjson by alibaba.

the class DefaultJSONParser method checkMapResolve.

@SuppressWarnings("rawtypes")
public void checkMapResolve(Map object, Object fieldName) {
    if (resolveStatus == NeedToResolve) {
        ResolveFieldDeserializer fieldResolver = new ResolveFieldDeserializer(object, fieldName);
        ResolveTask task = getLastResolveTask();
        task.fieldDeserializer = fieldResolver;
        task.ownerContext = context;
        setResolveStatus(DefaultJSONParser.NONE);
    }
}
Also used : ResolveFieldDeserializer(com.alibaba.fastjson.parser.deserializer.ResolveFieldDeserializer)

Aggregations

ResolveFieldDeserializer (com.alibaba.fastjson.parser.deserializer.ResolveFieldDeserializer)3 ArrayList (java.util.ArrayList)1 List (java.util.List)1