List of usage examples for com.fasterxml.jackson.core JsonParser configure
public JsonParser configure(Feature f, boolean state)
From source file:de.odysseus.staxon.json.stream.jackson.JacksonStreamFactory.java
protected JsonParser configure(JsonParser parser) { return parser.configure(JsonParser.Feature.AUTO_CLOSE_SOURCE, false); }
From source file:org.jberet.support.io.JsonItemReader.java
protected static JsonParser configureJsonParser(final JsonItemReaderWriterBase batchReaderArtifact, final Class<?> inputDecorator, final String deserializationProblemHandlers, final Map<String, String> jsonParserFeatures) throws Exception { final JsonParser jsonParser; if (inputDecorator != null) { batchReaderArtifact.jsonFactory.setInputDecorator((InputDecorator) inputDecorator.newInstance()); }/* w w w. j ava2 s.c o m*/ jsonParser = batchReaderArtifact.jsonFactory .createParser(getInputStream(batchReaderArtifact.resource, false)); if (deserializationProblemHandlers != null) { MappingJsonFactoryObjectFactory.configureDeserializationProblemHandlers( batchReaderArtifact.objectMapper, deserializationProblemHandlers, batchReaderArtifact.getClass().getClassLoader()); } SupportLogger.LOGGER.openingResource(batchReaderArtifact.resource, batchReaderArtifact.getClass()); if (jsonParserFeatures != null) { for (final Map.Entry<String, String> e : jsonParserFeatures.entrySet()) { final String key = e.getKey(); final String value = e.getValue(); final JsonParser.Feature feature; try { feature = JsonParser.Feature.valueOf(key); } catch (final Exception e1) { throw SupportMessages.MESSAGES.unrecognizedReaderWriterProperty(key, value); } if ("true".equals(value)) { if (!feature.enabledByDefault()) { jsonParser.configure(feature, true); } } else if ("false".equals(value)) { if (feature.enabledByDefault()) { jsonParser.configure(feature, false); } } else { throw SupportMessages.MESSAGES.invalidReaderWriterProperty(null, value, key); } } } return jsonParser; }