Refine search
public SchemaGenerator(JsonFactory jsonFactory) { this.objectMapper = new ObjectMapper(jsonFactory) .enable(JsonParser.Feature.ALLOW_COMMENTS) .enable(DeserializationFeature.USE_BIG_DECIMAL_FOR_FLOATS); }
ObjectMapper mapper = new ObjectMapper(); mapper.enable(SerializationFeature.INDENT_OUTPUT); mapper.enableDefaultTypingAsProperty(ObjectMapper.DefaultTyping.JAVA_LANG_OBJECT, "@class");
private ObjectMapper objectMapper() { return new ObjectMapper() .enable(JsonParser.Feature.ALLOW_COMMENTS) .enable(DeserializationFeature.USE_BIG_DECIMAL_FOR_FLOATS); }
ObjectMapper mapper = new ObjectMapper(); mapper.enable(SerializationFeature.INDENT_OUTPUT); mapper.enableDefaultTypingAsProperty(ObjectMapper.DefaultTyping.JAVA_LANG_OBJECT, "@class");
public ContentResolver(JsonFactory jsonFactory) { this.objectMapper = new ObjectMapper(jsonFactory) .enable(JsonParser.Feature.ALLOW_COMMENTS) .enable(DeserializationFeature.USE_BIG_DECIMAL_FOR_FLOATS); }
private static ObjectMapper createDefaultMapper() { final ObjectMapper result = new ObjectMapper(); result.enable(SerializationFeature.INDENT_OUTPUT); return result; }
public AutocompleteNodeHttpGet(String name, List<AutocompleteNode> children) { super(name, children); this.objectMapper = new ObjectMapper(); this.objectMapper.enable(WRITE_ENUMS_USING_TO_STRING); }
public static ObjectMapper createMapper(boolean pretty) { ObjectMapper mapper = new ObjectMapper(); if (pretty) { mapper.enable(SerializationFeature.INDENT_OUTPUT); } return mapper; } }
public BeakerXJsonConfig(Path path) { this.path = path; this.objectMapper = new ObjectMapper(); this.objectMapper.enable(SerializationFeature.INDENT_OUTPUT); }
ObjectMapper mapper = new ObjectMapper(); mapper.enable(SerializationFeature.INDENT_OUTPUT);
private static ObjectMapper initWithIndentation() { return new ObjectMapper() .setSerializationInclusion(JsonInclude.Include.NON_NULL) .enable(SerializationFeature.INDENT_OUTPUT); }
public JacksonProvider() { mapper = new ObjectMapper(); mapper.enable( SerializationFeature.INDENT_OUTPUT ); mapper.setSerializationInclusion( JsonInclude.Include.NON_NULL ); }
private static synchronized ObjectMapper getMapper(){ if(MAPPER == null){ ObjectMapper mapper = new ObjectMapper(); mapper.enable(SerializationFeature.INDENT_OUTPUT); mapper.configure(Feature.ALLOW_UNQUOTED_FIELD_NAMES, true); mapper.configure(Feature.ALLOW_COMMENTS, true); MAPPER = mapper; } return MAPPER; } }
@Inject public GelfCodec(@Assisted Configuration configuration, GelfChunkAggregator aggregator) { super(configuration); this.aggregator = aggregator; this.objectMapper = new ObjectMapper().enable(JsonParser.Feature.ALLOW_UNQUOTED_CONTROL_CHARS); this.decompressSizeLimit = configuration.getInt(CK_DECOMPRESS_SIZE_LIMIT, DEFAULT_DECOMPRESS_SIZE_LIMIT); }
public JacksonContext() { this.mapper = new ObjectMapper() .enable(SerializationFeature.INDENT_OUTPUT) .disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) .setSerializationInclusion(JsonInclude.Include.NON_NULL); }
public static GenesisJson loadGenesisJson(InputStream genesisJsonIS) throws RuntimeException { String json = null; try { json = new String(ByteStreams.toByteArray(genesisJsonIS)); ObjectMapper mapper = new ObjectMapper() .disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) .enable(MapperFeature.ACCEPT_CASE_INSENSITIVE_PROPERTIES); GenesisJson genesisJson = mapper.readValue(json, GenesisJson.class); return genesisJson; } catch (Exception e) { Utils.showErrorAndExit("Problem parsing genesis: "+ e.getMessage(), json); throw new RuntimeException(e.getMessage(), e); } }
private void engineOverwriteInternal(File f) throws IOException { try { ObjectMapper objectMapper = new ObjectMapper(); JsonNode rootNode = objectMapper.readTree(f); boolean replaced = false; if (engineType != null && rootNode.get("engine_type") != null) { ((ObjectNode) rootNode).put("engine_type", Integer.parseInt(engineType)); replaced = true; } if (storageType != null && rootNode.get("storage_type") != null) { ((ObjectNode) rootNode).put("storage_type", Integer.parseInt(storageType)); replaced = true; } if (replaced) { objectMapper.enable(SerializationFeature.INDENT_OUTPUT); objectMapper.writeValue(f, rootNode); } } catch (JsonProcessingException ex) { logger.warn("cannot parse file {}", f); } }
private static ObjectMapper newMapper() { ObjectMapper mapper = new ObjectMapper(); mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL); mapper.enable(SerializationFeature.INDENT_OUTPUT); mapper.configure(JsonGenerator.Feature.AUTO_CLOSE_TARGET, false); mapper.configure(JsonGenerator.Feature.AUTO_CLOSE_JSON_CONTENT, false); mapper.disable(SerializationFeature.FLUSH_AFTER_WRITE_VALUE); mapper.disable(SerializationFeature.CLOSE_CLOSEABLE); mapper.disable(SerializationFeature.FAIL_ON_EMPTY_BEANS); mapper.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES); Reflections reflections = new Reflections("com.twitter.ambrose"); Set<Class<? extends Job>> jobSubTypes = reflections.getSubTypesOf(Job.class); mapper.registerSubtypes(jobSubTypes.toArray(new Class<?>[jobSubTypes.size()])); return mapper; } }
public BaseBeakerXJsonSerializer() { this.objectMapper = new ObjectMapper(); this.objectMapper.enable(WRITE_ENUMS_USING_TO_STRING); this.objectMapper.registerModule(TableDisplayToJson.tableDisplayModule()); this.serializer = createSerializer(); }
public TimedJsonStreamParser(List<TblColRef> allColumns, Map<String, String> properties) { this.allColumns = allColumns; if (properties == null) { properties = StreamingParser.defaultProperties; } tsColName = properties.get(PROPERTY_TS_COLUMN_NAME); tsParser = properties.get(PROPERTY_TS_PARSER); separator = properties.get(PROPERTY_EMBEDDED_SEPARATOR); strictCheck = Boolean.parseBoolean(properties.get(PROPERTY_STRICT_CHECK)); if (!StringUtils.isEmpty(tsParser)) { try { Class clazz = Class.forName(tsParser); Constructor constructor = clazz.getConstructor(Map.class); streamTimeParser = (AbstractTimeParser) constructor.newInstance(properties); } catch (Exception e) { throw new IllegalStateException("Invalid StreamingConfig, tsParser " + tsParser + ", parserProperties " + properties + ".", e); } } else { throw new IllegalStateException("Invalid StreamingConfig, tsParser " + tsParser + ", parserProperties " + properties + "."); } mapper = new ObjectMapper(); mapper.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES); mapper.disable(DeserializationFeature.FAIL_ON_INVALID_SUBTYPE); mapper.enable(DeserializationFeature.USE_JAVA_ARRAY_FOR_JSON_ARRAY); }