gpt4 book ai didi

com.fasterxml.jackson.dataformat.yaml.YAMLMapper.configure()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-17 09:24:40 25 4
gpt4 key购买 nike

本文整理了Java中com.fasterxml.jackson.dataformat.yaml.YAMLMapper.configure()方法的一些代码示例,展示了YAMLMapper.configure()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。YAMLMapper.configure()方法的具体详情如下:
包路径:com.fasterxml.jackson.dataformat.yaml.YAMLMapper
类名称:YAMLMapper
方法名:configure

YAMLMapper.configure介绍

暂无

代码示例

代码示例来源: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> T fromYamlString(String yamlContent, Class<T> 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 <T> T fromYaml(String resource, Class<T> c, boolean ignoreUnknownProperties) {
  URL url = c.getResource(resource);
  if (url == null) {
    return null;
  }
  ObjectMapper mapper = new YAMLMapper().configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, !ignoreUnknownProperties);
  try {
    return mapper.readValue(url, c);
  } catch (InvalidFormatException e) {
    throw new IllegalArgumentException(e);
  } catch (IOException e) {
    throw new RuntimeException(e);
  }
}

代码示例来源: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);
}

代码示例来源:origin: com.github.duanxinyuan/library-json-jackson

private static void configIndentOutput() {
  mapper.configure(SerializationFeature.INDENT_OUTPUT, IS_ENABLE_INDENT_OUTPUT);
  yamlMapper.configure(SerializationFeature.INDENT_OUTPUT, IS_ENABLE_INDENT_OUTPUT);
  propsMapper.configure(SerializationFeature.INDENT_OUTPUT, IS_ENABLE_INDENT_OUTPUT);
  csvMapper.configure(SerializationFeature.INDENT_OUTPUT, IS_ENABLE_INDENT_OUTPUT);
  xmlMapper.configure(SerializationFeature.INDENT_OUTPUT, IS_ENABLE_INDENT_OUTPUT);
}

代码示例来源:origin: strimzi/strimzi-kafka-operator

new YAMLMapper().configure(YAMLGenerator.Feature.MINIMIZE_QUOTES, true).configure(YAMLGenerator.Feature.WRITE_DOC_START_MARKER, false) :
    new ObjectMapper(), labels);
for (Map.Entry<String, Class<? extends CustomResource>> entry : classes.entrySet()) {

代码示例来源:origin: org.springframework.cloud/spring-cloud-skipper-server-core

protected List<PackageMetadata> deserializeFromIndexFiles(List<File> indexFiles) {
  List<PackageMetadata> packageMetadataList = new ArrayList<>();
  YAMLMapper yamlMapper = new YAMLMapper();
  yamlMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
  for (File indexFile : indexFiles) {
    try {
      MappingIterator<PackageMetadata> it = yamlMapper.readerFor(PackageMetadata.class).readValues(indexFile);
      while (it.hasNextValue()) {
        PackageMetadata packageMetadata = it.next();
        packageMetadataList.add(packageMetadata);
      }
    }
    catch (IOException e) {
      throw new IllegalArgumentException("Can't parse Release manifest YAML", e);
    }
  }
  return packageMetadataList;
}

代码示例来源:origin: spring-cloud/spring-cloud-skipper

protected List<PackageMetadata> deserializeFromIndexFiles(List<File> indexFiles) {
  List<PackageMetadata> packageMetadataList = new ArrayList<>();
  YAMLMapper yamlMapper = new YAMLMapper();
  yamlMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
  for (File indexFile : indexFiles) {
    try {
      MappingIterator<PackageMetadata> it = yamlMapper.readerFor(PackageMetadata.class).readValues(indexFile);
      while (it.hasNextValue()) {
        PackageMetadata packageMetadata = it.next();
        packageMetadataList.add(packageMetadata);
      }
    }
    catch (IOException e) {
      throw new IllegalArgumentException("Can't parse Release manifest YAML", e);
    }
  }
  return packageMetadataList;
}

代码示例来源:origin: spring-cloud/spring-cloud-skipper

@Override
public List<CloudFoundryApplicationSkipperManifest> read(String manifest) {
  if (canSupport(manifest)) {
    List<CloudFoundryApplicationSkipperManifest> applicationSpecs = new ArrayList<>();
    YAMLMapper mapper = new YAMLMapper();
    mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
    mapper.configure(MapperFeature.ACCEPT_CASE_INSENSITIVE_PROPERTIES, true);
    mapper.setPropertyNamingStrategy(PropertyNamingStrategy.KEBAB_CASE);
    try {
      MappingIterator<CloudFoundryApplicationSkipperManifest> it = mapper
                                .readerFor(CloudFoundryApplicationSkipperManifest.class)
                                .readValues(manifest);
      while (it.hasNextValue()) {
        CloudFoundryApplicationSkipperManifest appKind = it.next();
        applicationSpecs.add(appKind);
      }
    }
    catch (JsonMappingException e) {
      logger.error("Can't parse Package's manifest YAML = " + manifest);
      throw new SkipperException("JsonMappingException - Can't parse Package's manifest YAML = " + manifest,
          e);
    }
    catch (IOException e) {
      logger.error("Can't parse Package's manifest YAML = " + manifest);
      throw new SkipperException("IOException - Can't parse Package's manifest YAML = " + manifest, e);
    }
    return applicationSpecs;
  }
  return Collections.emptyList();
}

代码示例来源:origin: org.springframework.cloud/spring-cloud-skipper

@Override
public List<CloudFoundryApplicationSkipperManifest> read(String manifest) {
  if (canSupport(manifest)) {
    List<CloudFoundryApplicationSkipperManifest> applicationSpecs = new ArrayList<>();
    YAMLMapper mapper = new YAMLMapper();
    mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
    mapper.configure(MapperFeature.ACCEPT_CASE_INSENSITIVE_PROPERTIES, true);
    mapper.setPropertyNamingStrategy(PropertyNamingStrategy.KEBAB_CASE);
    try {
      MappingIterator<CloudFoundryApplicationSkipperManifest> it = mapper
                                .readerFor(CloudFoundryApplicationSkipperManifest.class)
                                .readValues(manifest);
      while (it.hasNextValue()) {
        CloudFoundryApplicationSkipperManifest appKind = it.next();
        applicationSpecs.add(appKind);
      }
    }
    catch (JsonMappingException e) {
      logger.error("Can't parse Package's manifest YAML = " + manifest);
      throw new SkipperException("JsonMappingException - Can't parse Package's manifest YAML = " + manifest,
          e);
    }
    catch (IOException e) {
      logger.error("Can't parse Package's manifest YAML = " + manifest);
      throw new SkipperException("IOException - Can't parse Package's manifest YAML = " + manifest, e);
    }
    return applicationSpecs;
  }
  return Collections.emptyList();
}

代码示例来源:origin: org.springframework.cloud/spring-cloud-skipper

List<SpringCloudDeployerApplicationManifest> applicationSpecs = new ArrayList<>();
YAMLMapper mapper = new YAMLMapper();
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
try {
  MappingIterator<SpringCloudDeployerApplicationManifest> it = mapper.readerFor(

代码示例来源:origin: spring-cloud/spring-cloud-skipper

List<SpringCloudDeployerApplicationManifest> applicationSpecs = new ArrayList<>();
YAMLMapper mapper = new YAMLMapper();
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
try {
  MappingIterator<SpringCloudDeployerApplicationManifest> it = mapper.readerFor(

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com