本文整理了Java中com.fasterxml.jackson.dataformat.yaml.YAMLMapper.()
方法的一些代码示例,展示了YAMLMapper.()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。YAMLMapper.()
方法的具体详情如下:
包路径:com.fasterxml.jackson.dataformat.yaml.YAMLMapper
类名称:YAMLMapper
方法名:
YAMLMapper.介绍
暂无
代码示例
代码示例来源:origin: redisson/redisson
/**
* @since 2.5
*/
@Override
public YAMLMapper copy()
{
_checkInvalidCopy(YAMLMapper.class);
return new YAMLMapper(this);
}
代码示例来源:origin: com.fasterxml.jackson.dataformat/jackson-dataformat-yaml
/**
* @since 2.5
*/
@Override
public YAMLMapper copy()
{
_checkInvalidCopy(YAMLMapper.class);
return new YAMLMapper(this);
}
代码示例来源:origin: spullara/mustache.java
private JsonNode getSpec(String spec) throws IOException {
return new YAMLFactory(new YAMLMapper()).createParser(new InputStreamReader(
SpecTest.class.getResourceAsStream(
"/spec/specs/" + spec))).readValueAsTree();
}
代码示例来源:origin: jooby-project/jooby
/**
* Convert this RAML object to Yaml.
*
* @return Yaml string.
* @throws IOException If something goes wrong.
*/
public String toYaml() throws IOException {
YAMLMapper mapper = new YAMLMapper();
mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
mapper.configure(YAMLGenerator.Feature.ALWAYS_QUOTE_NUMBERS_AS_STRINGS, false);
mapper.configure(YAMLGenerator.Feature.MINIMIZE_QUOTES, true);
return "#%RAML 1.0\n" + mapper.writer().withDefaultPrettyPrinter().writeValueAsString(this);
}
代码示例来源:origin: pippo-java/pippo
@Override
protected ObjectMapper getObjectMapper() {
return new YAMLMapper();
}
代码示例来源:origin: com.github.swissquote/carnotzet-orchestrator-docker-compose
public DockerComposeGenerator(DockerCompose model) {
this.model = model;
YAMLFactory factory = new YAMLFactory();
mapper = new YAMLMapper(factory);
mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
}
代码示例来源:origin: strimzi/strimzi-kafka-operator
@Override
public String toString() {
YAMLMapper mapper = new YAMLMapper();
try {
return mapper.writeValueAsString(this);
} catch (JsonProcessingException e) {
throw new RuntimeException(e);
}
}
代码示例来源:origin: strimzi/strimzi-kafka-operator
@Override
public String toString() {
YAMLMapper mapper = new YAMLMapper();
try {
return mapper.writeValueAsString(this);
} catch (JsonProcessingException e) {
throw new RuntimeException(e);
}
}
代码示例来源:origin: strimzi/strimzi-kafka-operator
@Override
public String toString() {
YAMLMapper mapper = new YAMLMapper();
try {
return mapper.writeValueAsString(this);
} catch (JsonProcessingException e) {
throw new RuntimeException(e);
}
}
代码示例来源:origin: strimzi/strimzi-kafka-operator
@Override
public String toString() {
YAMLMapper mapper = new YAMLMapper();
try {
return mapper.writeValueAsString(this);
} catch (JsonProcessingException e) {
throw new RuntimeException(e);
}
}
代码示例来源:origin: strimzi/strimzi-kafka-operator
public static T fromYamlString(String yamlContent, Class c, boolean ignoreUnknownProperties) {
ObjectMapper mapper = new YAMLMapper().configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, !ignoreUnknownProperties);
try {
return mapper.readValue(yamlContent, c);
} catch (InvalidFormatException e) {
throw new IllegalArgumentException(e);
} catch (IOException e) {
throw new RuntimeException(e);
}
}
代码示例来源:origin: strimzi/strimzi-kafka-operator
public static String getContent(File file, Function edit) {
YAMLMapper mapper = new YAMLMapper();
try {
JsonNode node = mapper.readTree(file);
return edit.apply(node);
} catch (IOException e) {
throw new RuntimeException(e);
}
}
代码示例来源:origin: codeabovelab/haven-platform
@Bean
public YAMLMapper yamlMapper() {
YAMLMapper mapper = new YAMLMapper();
JacksonUtils.registerModules(mapper);
return mapper;
}
}
代码示例来源:origin: com.fasterxml.jackson.jaxrs/jackson-jaxrs-yaml-provider
@Override
public synchronized YAMLMapper getDefaultMapper() {
if (_defaultMapper == null) {
_defaultMapper = new YAMLMapper(); //tarik: maybe there is better default config?
_setAnnotations(_defaultMapper, _defaultAnnotationsToUse);
}
return _defaultMapper;
}
代码示例来源:origin: strimzi/strimzi-kafka-operator
public static String toYamlString(T instance) {
ObjectMapper mapper = new YAMLMapper()
.disable(YAMLGenerator.Feature.USE_NATIVE_TYPE_ID)
.setSerializationInclusion(JsonInclude.Include.NON_EMPTY);
try {
return mapper.writeValueAsString(instance);
} catch (JsonProcessingException e) {
throw new RuntimeException(e);
}
}
代码示例来源:origin: hortonworks/streamline
private Map readConfigFromYamlType(InputStream configFileStream) throws IOException {
ObjectReader reader = new YAMLMapper().reader();
Map cOnfMap= reader.forType(new TypeReference
代码示例来源:origin: strimzi/strimzi-kafka-operator
@Override
public String toString() {
YAMLMapper mapper = new YAMLMapper().disable(YAMLGenerator.Feature.USE_NATIVE_TYPE_ID);
try {
return mapper.writeValueAsString(this);
} catch (JsonProcessingException e) {
throw new RuntimeException(e);
}
}
代码示例来源:origin: strimzi/strimzi-kafka-operator
@Override
public String toString() {
YAMLMapper mapper = new YAMLMapper().disable(YAMLGenerator.Feature.USE_NATIVE_TYPE_ID);
try {
return mapper.writeValueAsString(this);
} catch (JsonProcessingException e) {
throw new RuntimeException(e);
}
}
代码示例来源:origin: strimzi/strimzi-kafka-operator
@Override
public String toString() {
YAMLMapper mapper = new YAMLMapper().disable(YAMLGenerator.Feature.USE_NATIVE_TYPE_ID);
try {
return mapper.writeValueAsString(this);
} catch (JsonProcessingException e) {
throw new RuntimeException(e);
}
}
代码示例来源:origin: com.neotys.neoload/neoload-project
private static ObjectMapper newYamlMapper() {
// Configures Yaml Factory
final YAMLFactory yamlFactory = new YAMLFactory();
yamlFactory.configure(WRITE_DOC_START_MARKER, false);
yamlFactory.configure(USE_NATIVE_TYPE_ID, false);
yamlFactory.configure(MINIMIZE_QUOTES, true);
// Constructs Yaml Mapper
final ObjectMapper yamlMapper = new YAMLMapper(yamlFactory);
// Register modules
registerModules(yamlMapper);
return yamlMapper;
}