com.alibaba.fastjson.parser.deserializer.ExtraProcessor Java Examples
The following examples show how to use
com.alibaba.fastjson.parser.deserializer.ExtraProcessor.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ReflectUtil.java From game-server with MIT License | 6 votes |
/** * 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(); }
Example #2
Source File: JSON.java From uavstack with Apache License 2.0 | 5 votes |
@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; }