com.alibaba.fastjson.parser.deserializer.ParseProcess源码实例Demo

类com.alibaba.fastjson.parser.deserializer.ParseProcess源码实例Demo

下面列出了com.alibaba.fastjson.parser.deserializer.ParseProcess 类实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: game-server   文件: ReflectUtil.java
/**
 * wzy扩展
 *
 * @param input
 * @param value
 * @param config
 * @param processor
 * @param featureValues
 * @param features
 */
private static void reflectObject(String input, Object value, ParserConfig config, ParseProcess processor,
		int featureValues, Feature... features) {
	if (input == null) {
		return;
	}
	for (Feature featrue : features) {
		featureValues = Feature.config(featureValues, featrue, true);
	}

	DefaultJSONParser parser = new DefaultJSONParser(input, config, featureValues);

	if (processor instanceof ExtraTypeProvider) {
		parser.getExtraTypeProviders().add((ExtraTypeProvider) processor);
	}

	if (processor instanceof ExtraProcessor) {
		parser.getExtraProcessors().add((ExtraProcessor) processor);
	}
	parser.parseObject(value);
	parser.handleResovleTask(value);
	parser.close();
}
 
源代码2 项目: uavstack   文件: JSON.java
@SuppressWarnings("unchecked")
public static <T> T parseObject(String input, Type clazz, ParserConfig config, ParseProcess processor,
                                      int featureValues, Feature... features) {
    if (input == null) {
        return null;
    }

    if (features != null) {
        for (Feature feature : features) {
            featureValues |= feature.mask;
        }
    }

    DefaultJSONParser parser = new DefaultJSONParser(input, config, featureValues);

    if (processor != null) {
        if (processor instanceof ExtraTypeProvider) {
            parser.getExtraTypeProviders().add((ExtraTypeProvider) processor);
        }

        if (processor instanceof ExtraProcessor) {
            parser.getExtraProcessors().add((ExtraProcessor) processor);
        }

        if (processor instanceof FieldTypeResolver) {
            parser.setFieldTypeResolver((FieldTypeResolver) processor);
        }
    }

    T value = (T) parser.parseObject(clazz, null);

    parser.handleResovleTask(value);

    parser.close();

    return (T) value;
}
 
源代码3 项目: ICERest   文件: Jsoner.java
public static <T> T toObject(String json, Class<T> clazz, ParseProcess processor) {
    try {
        if (deserializerFeatures != null) {
            return JSON.parseObject(json, clazz, processor, deserializerFeatures);
        } else {
            return JSON.parseObject(json, clazz, processor);
        }
    } catch (JSONException e) {
        throw new JsonException("Could not cast \"" + json + "\" to " + clazz.getName(), e);
    }
}
 
源代码4 项目: ICERest   文件: Jsoner.java
public static <T> T toObject(String json, Class<T> clazz, ParseProcess processor, Feature... features) {
    try {
        return JSON.parseObject(json, clazz, processor, features);
    } catch (JSONException e) {
        throw new JsonException("Could not cast \"" + json + "\" to " + clazz.getName(), e);
    }
}
 
源代码5 项目: ICERest   文件: Jsoner.java
public static <T> T toObject(String json, Type type, ParseProcess processor) {
    try {
        if (deserializerFeatures != null) {
            return JSON.parseObject(json, type, processor, deserializerFeatures);
        } else {
            return JSON.parseObject(json, type, processor);
        }
    } catch (JSONException e) {
        throw new JsonException("Could not cast \"" + json + "\" to " + type.getClass().getName(), e);
    }
}
 
源代码6 项目: ICERest   文件: Jsoner.java
public static <T> T toObject(String json, Type type, ParseProcess processor, Feature... features) {
    try {
        return JSON.parseObject(json, type, processor, features);
    } catch (JSONException e) {
        throw new JsonException("Could not cast \"" + json + "\" to " + type.getClass().getName(), e);
    }
}
 
源代码7 项目: uavstack   文件: JSON.java
@SuppressWarnings("unchecked")
public static <T> T parseObject(String text, Class<T> clazz, ParseProcess processor, Feature... features) {
    return (T) parseObject(text, (Type) clazz, ParserConfig.global, processor, DEFAULT_PARSER_FEATURE,
                           features);
}
 
源代码8 项目: uavstack   文件: JSON.java
@SuppressWarnings("unchecked")
public static <T> T parseObject(String input, Type clazz, ParseProcess processor, Feature... features) {
    return (T) parseObject(input, clazz, ParserConfig.global, processor, DEFAULT_PARSER_FEATURE, features);
}
 
源代码评论
动弹
沙发等你来抢
 类所在包
 类方法
 同包方法