/** * Method that we need to override to actually make restoration go * through constructors etc. * Also: must be overridden by sub-classes as well. */ @Override protected Object readResolve() { return new YAMLFactory(this, _objectCodec); }
public YAMLMapper() { this(new YAMLFactory()); }
/** * Method that we need to override to actually make restoration go * through constructors etc. * Also: must be overridden by sub-classes as well. */ @Override protected Object readResolve() { return new YAMLFactory(this, _objectCodec); }
public JsonNodeYamlParser(ObjectMapper mapper) { this.mapper = mapper; this.yamlFactory = new YAMLFactory(); }
private NetFlowV9FieldTypeRegistry(InputStream definitions) throws IOException { this(definitions, new ObjectMapper(new YAMLFactory())); }
/** * Creates a new configuration factory for the given class. * * @param klass the configuration class * @param validator the validator to use * @param objectMapper the Jackson {@link ObjectMapper} to use * @param propertyPrefix the system property name prefix used by overrides */ public YamlConfigurationFactory(Class<T> klass, @Nullable Validator validator, ObjectMapper objectMapper, String propertyPrefix) { super(new YAMLFactory(), YAMLFactory.FORMAT_NAME_YAML, klass, validator, objectMapper, propertyPrefix); } }
public static ObjectMapper createYaml() { ObjectMapper mapper = new ObjectMapper(new YAMLFactory()); // forward compatibility for the properties may go away in the future mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); mapper.configure(DeserializationFeature.READ_UNKNOWN_ENUM_VALUES_AS_NULL, true); mapper.setSerializationInclusion(Include.NON_NULL); return mapper; }
@VisibleForTesting void parseRetryLibrary(InputStream in) { if (in != null) { ObjectMapper mapper = new ObjectMapper(new YAMLFactory()); try { settings.put("retryLibrary", mapper.readValue(in, RetryStrategyLibrary.class)); } catch (IOException e) { throw new RuntimeException("Could not parse extension settings", e); } } }
@Override public YAMLFactory copy() { _checkInvalidCopy(YAMLFactory.class); return new YAMLFactory(this, null); }
@VisibleForTesting void parseSimple(InputStream in) { if (in == null) { settings = new HashMap<>(); } else { ObjectMapper mapper = new ObjectMapper(new YAMLFactory()); try { settings = mapper.readValue(in, Map.class); } catch (IOException e) { throw new RuntimeException("Could not parse extension settings", e); } } }
public MyYamlFile readYaml(final File file) { final ObjectMapper mapper = new ObjectMapper(new YAMLFactory()); // jackson databind return mapper.readValue(file, MyYamlFile.class); }
public <T> T fromYAML(File file, Class<T> configType, ClassLoader classLoader) throws IOException { yamlMapper = createMapper(new YAMLFactory(), classLoader); String content = resolveEnvParams(new FileReader(file)); return yamlMapper.readValue(content, configType); }
public <T> T fromYAML(File file, Class<T> configType, ClassLoader classLoader) throws IOException { yamlMapper = createMapper(new YAMLFactory(), classLoader); String content = resolveEnvParams(new FileReader(file)); return yamlMapper.readValue(content, configType); }
private static ObjectMapper mapper() { ObjectMapper mapper = new ObjectMapper(new YAMLFactory()); mapper.setBase64Variant(Base64Variants.MODIFIED_FOR_URL); mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); mapper.registerModule(new AfterburnerModule()); return mapper; }
@Override public YAMLFactory copy() { _checkInvalidCopy(YAMLFactory.class); return new YAMLFactory(this, null); }
private static ContentResolver createContentResolver(GenerationConfig config) { if (config.getSourceType() == SourceType.YAMLSCHEMA || config.getSourceType() == SourceType.YAML) { return new ContentResolver(new YAMLFactory()); } else { return new ContentResolver(); } }
private static SchemaGenerator createSchemaGenerator(GenerationConfig config) { if (config.getSourceType() == SourceType.YAMLSCHEMA || config.getSourceType() == SourceType.YAML) { return new SchemaGenerator(new YAMLFactory()); } else { return new SchemaGenerator(); } }
@Nonnull public static Injector createInjector(@Nonnull JmxTransConfiguration configuration) { return Guice.createInjector( new JmxTransModule(configuration), new ObjectMapperModule(JsonFormat.class) .registerModule(new GuavaModule()), new ObjectMapperModule(YamlFormat.class) .withObjectMapper(new ObjectMapper(new YAMLFactory())) .registerModule(new GuavaModule()) ); }
protected static ObjectMapper createYaml() { YAMLFactory factory = new YAMLFactory(); factory.disable(YAMLGenerator.Feature.WRITE_DOC_START_MARKER); factory.enable(YAMLGenerator.Feature.MINIMIZE_QUOTES); factory.enable(YAMLGenerator.Feature.SPLIT_LINES); factory.enable(YAMLGenerator.Feature.ALWAYS_QUOTE_NUMBERS_AS_STRINGS); return create(factory); }
private JsonNode getSpec(String spec) throws IOException { return new YAMLFactory(new YAMLMapper()).createParser(new InputStreamReader( SpecTest.class.getResourceAsStream( "/spec/specs/" + spec))).readValueAsTree(); }