本文整理了Java中com.fasterxml.jackson.dataformat.yaml.YAMLMapper.setSerializationInclusion()
方法的一些代码示例,展示了YAMLMapper.setSerializationInclusion()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。YAMLMapper.setSerializationInclusion()
方法的具体详情如下:
包路径:com.fasterxml.jackson.dataformat.yaml.YAMLMapper
类名称:YAMLMapper
方法名:setSerializationInclusion
暂无
代码示例来源: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: strimzi/strimzi-kafka-operator
public static <T> 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: com.github.duanxinyuan/library-json-jackson
private static void configPropertyInclusion() {
mapper.setSerializationInclusion(DEFAULT_PROPERTY_INCLUSION);
yamlMapper.setSerializationInclusion(DEFAULT_PROPERTY_INCLUSION);
propsMapper.setSerializationInclusion(DEFAULT_PROPERTY_INCLUSION);
csvMapper.setSerializationInclusion(DEFAULT_PROPERTY_INCLUSION);
xmlMapper.setSerializationInclusion(DEFAULT_PROPERTY_INCLUSION);
}
代码示例来源:origin: org.jooby/jooby-apitool
/**
* 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);
}
内容来源于网络,如有侵权,请联系作者删除!