public static final <T> T parseObject(String input, Type clazz, ParserConfig config, ParseProcess processor, int featureValues, Feature... features) { if (input == null) { return null; } 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); } T value = parser.parseObject(clazz); parser.handleResovleTask(value); parser.close(); return value; }
@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; }
public static Type getExtratype(DefaultJSONParser parser, Object object, String key) { List<ExtraTypeProvider> extraTypeProviders = parser.getExtraTypeProvidersDirect(); if (extraTypeProviders == null) { return null; } Type type = null; for (ExtraTypeProvider extraProvider : extraTypeProviders) { type = extraProvider.getExtraType(object, key); } return type; }
@SuppressWarnings("unchecked") public static final <T> T parseObject(String input, Type clazz, ParserConfig config, ParseProcess processor, int featureValues, Feature... features) { if (input == null) { return null; } 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); } T value = (T) parser.parseObject(clazz); parser.handleResovleTask(value); parser.close(); return (T) value; }
@SuppressWarnings("unchecked") public static final <T> T parseObject(String input, Type clazz, ParserConfig config, ParseProcess processor, int featureValues, Feature... features) { if (input == null) { return null; } 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); } T value = (T) parser.parseObject(clazz); handleResovleTask(parser, value); parser.close(); return (T) value; }
public List<ExtraTypeProvider> getExtraTypeProviders() { if (this.extraTypeProviders == null) { this.extraTypeProviders = new ArrayList(2); } return this.extraTypeProviders; }
public List<ExtraTypeProvider> getExtraTypeProvidersDirect() { return this.extraTypeProviders; }
public List<ExtraTypeProvider> getExtraTypeProviders() { if (extraTypeProviders == null) { extraTypeProviders = new ArrayList<ExtraTypeProvider>(2); } return extraTypeProviders; }
public List<ExtraTypeProvider> getExtraTypeProvidersDirect() { return extraTypeProviders; }