/** * Method for enabling specified {@link com.fasterxml.jackson.core.JsonParser.Feature}s * for parser instances this object mapper creates. *<p> * Note that this is equivalent to directly calling same method on {@link #getFactory}. *<p> * WARNING: since this method directly modifies state of underlying {@link JsonFactory}, * it will change observed configuration by {@link ObjectReader}s as well -- to avoid * this, use {@link ObjectReader#with(JsonParser.Feature)} instead. * * @since 2.5 */ public ObjectMapper enable(JsonParser.Feature... features) { for (JsonParser.Feature f : features) { _jsonFactory.enable(f); } return this; }
/** * Method for enabling specified {@link com.fasterxml.jackson.core.JsonGenerator.Feature}s * for parser instances this object mapper creates. *<p> * Note that this is equivalent to directly calling same method on {@link #getFactory}. *<p> * WARNING: since this method directly modifies state of underlying {@link JsonFactory}, * it will change observed configuration by {@link ObjectWriter}s as well -- to avoid * this, use {@link ObjectWriter#with(JsonGenerator.Feature)} instead. * * @since 2.5 */ public ObjectMapper enable(JsonGenerator.Feature... features) { for (JsonGenerator.Feature f : features) { _jsonFactory.enable(f); } return this; }
/** * Method for enabling or disabling specified parser feature * (check {@link JsonParser.Feature} for list of features) */ public final JsonFactory configure(JsonFactory.Feature f, boolean state) { return state ? enable(f) : disable(f); }
/** * Method for enabling or disabling specified parser feature * (check {@link JsonParser.Feature} for list of features) */ public final JsonFactory configure(JsonParser.Feature f, boolean state) { return state ? enable(f) : disable(f); }
/** * Method for enabling or disabling specified generator feature * (check {@link JsonGenerator.Feature} for list of features) */ public final JsonFactory configure(JsonGenerator.Feature f, boolean state) { return state ? enable(f) : disable(f); }
protected Builder() { factory.disable(JsonParser.Feature.AUTO_CLOSE_SOURCE); factory.enable(JsonParser.Feature.ALLOW_COMMENTS); factory.enable(JsonParser.Feature.ALLOW_YAML_COMMENTS); factory.enable(JsonParser.Feature.ALLOW_BACKSLASH_ESCAPING_ANY_CHARACTER); factory.enable(JsonParser.Feature.ALLOW_UNQUOTED_FIELD_NAMES); factory.enable(JsonParser.Feature.ALLOW_SINGLE_QUOTES); factory.enable(JsonParser.Feature.ALLOW_NON_NUMERIC_NUMBERS); factory.enable(JsonParser.Feature.ALLOW_UNQUOTED_CONTROL_CHARS); }
protected Builder() { factory.disable(JsonParser.Feature.AUTO_CLOSE_SOURCE); factory.enable(JsonParser.Feature.ALLOW_COMMENTS); factory.enable(JsonParser.Feature.ALLOW_YAML_COMMENTS); factory.enable(JsonParser.Feature.ALLOW_BACKSLASH_ESCAPING_ANY_CHARACTER); factory.enable(JsonParser.Feature.ALLOW_UNQUOTED_FIELD_NAMES); factory.enable(JsonParser.Feature.ALLOW_SINGLE_QUOTES); factory.enable(JsonParser.Feature.ALLOW_NON_NUMERIC_NUMBERS); factory.enable(JsonParser.Feature.ALLOW_UNQUOTED_CONTROL_CHARS); }
public FileCatalogReader() throws IOException { byte[] encoded = Files.readAllBytes(Paths.get(DEFAULT_CATALOG_FILE)); catalog = new String(encoded, StandardCharsets.UTF_8); JsonFactory factory = new JsonFactory(); factory.enable(JsonParser.Feature.ALLOW_COMMENTS); ObjectMapper objectMapper = new ObjectMapper(factory); catalogData = objectMapper.readValue(catalog, CatalogData.class); }
/** * Method for enabling or disabling specified generator feature * (check {@link JsonGenerator.Feature} for list of features) */ public final JsonFactory configure(JsonGenerator.Feature f, boolean state) { return state ? enable(f) : disable(f); }
/** * Method for enabling or disabling specified generator feature * (check {@link JsonGenerator.Feature} for list of features) */ public final JsonFactory configure(JsonGenerator.Feature f, boolean state) { return state ? enable(f) : disable(f); }
final JsonFactory jsonFactory = new JsonFactory(); jsonFactory.enable(JsonParser.Feature.STRICT_DUPLICATE_DETECTION); try (JsonParser parser = jsonFactory.createParser(invalidJson)) { while (!parser.isClosed()) { parser.nextToken(); } }
/** * Method for enabling or disabling specified parser feature * (check {@link JsonParser.Feature} for list of features) */ public final JsonFactory configure(JsonFactory.Feature f, boolean state) { return state ? enable(f) : disable(f); }
/** * Method for enabling or disabling specified parser feature * (check {@link JsonParser.Feature} for list of features) */ public final JsonFactory configure(JsonParser.Feature f, boolean state) { return state ? enable(f) : disable(f); }
/** * Method for enabling or disabling specified parser feature * (check {@link JsonParser.Feature} for list of features) */ public final JsonFactory configure(JsonParser.Feature f, boolean state) { return state ? enable(f) : disable(f); }
/** * Method for enabling or disabling specified parser feature * (check {@link JsonParser.Feature} for list of features) */ public final JsonFactory configure(JsonFactory.Feature f, boolean state) { return state ? enable(f) : disable(f); }
/** * Method for enabling or disabling specified parser feature * (check {@link JsonParser.Feature} for list of features) */ public final JsonFactory configure(JsonFactory.Feature f, boolean state) { return state ? enable(f) : disable(f); }
/** * Method for enabling or disabling specified parser feature * (check {@link JsonParser.Feature} for list of features) */ public final JsonFactory configure(JsonFactory.Feature f, boolean state) { return state ? enable(f) : disable(f); }
/** * Method for enabling or disabling specified generator feature * (check {@link JsonGenerator.Feature} for list of features) */ public final JsonFactory configure(JsonGenerator.Feature f, boolean state) { return state ? enable(f) : disable(f); }
/** * Creates factory instances using given {@link IndexTypeMetadata} and specifying caching limit. * @param indexTypeMetadata metadata based on which factory create JSON documents * @param cachingLimit defines field value caching limit */ public SimpleDocumentFactory(IndexTypeMetadata indexTypeMetadata, int cachingLimit) { Validate.notNull(indexTypeMetadata); this.factory.enable(JsonParser.Feature.ALLOW_COMMENTS); builders.addAll(initBuilders(indexTypeMetadata.getFields(), cachingLimit)); }