gpt4 book ai didi

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

转载 作者:知者 更新时间:2024-03-18 04:18:40 27 4
gpt4 key购买 nike

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

YAMLFactory.configure介绍

[英]Method for enabling or disabling specified generator feature (check YAMLGenerator.Feature for list of features)
[中]启用或禁用指定生成器功能的方法(检查YAMLGenerator.feature以获取功能列表)

代码示例

代码示例来源:origin: io.fabric8.funktion/funktion-model

/**
 * Creates a configured Jackson object mapper for parsing YAML
 */
public static ObjectMapper createObjectMapper() {
  YAMLFactory yamlFactory = new YAMLFactory();
  yamlFactory.configure(YAMLGenerator.Feature.USE_NATIVE_TYPE_ID, false);
  return new ObjectMapper(yamlFactory);
}

代码示例来源:origin: fabric8io/fabric8-maven-plugin

@Override
  public ObjectMapper getObjectMapper() {
    return new ObjectMapper(new YAMLFactory()
                  .configure(YAMLGenerator.Feature.MINIMIZE_QUOTES, true)
                  .configure(YAMLGenerator.Feature.ALWAYS_QUOTE_NUMBERS_AS_STRINGS, true)
                );
  }
};

代码示例来源:origin: funktionio/funktion-connectors

/**
 * Creates a configured Jackson object mapper for parsing YAML
 */
public static ObjectMapper createObjectMapper() {
  YAMLFactory yamlFactory = new YAMLFactory();
  yamlFactory.configure(YAMLGenerator.Feature.USE_NATIVE_TYPE_ID, false);
  return new ObjectMapper(yamlFactory);
}

代码示例来源:origin: io.digdag/digdag-cli

@Inject
public YamlMapper(ObjectMapper mapper)
{
  this.yaml = new YAMLFactory()
    .configure(YAMLGenerator.Feature.WRITE_DOC_START_MARKER, false);
  this.mapper = mapper;
}

代码示例来源:origin: org.walkmod/walkmod-core

public YAMLConfigurationProvider(String fileName) {
  this.fileName = fileName;
  factory = new YAMLFactory();
  mapper = new ObjectMapper(factory);
  factory.configure(YAMLGenerator.Feature.WRITE_DOC_START_MARKER, false);
}

代码示例来源:origin: io.digdag/digdag-standards

@Inject
public EmbulkOperatorFactory(CommandExecutor exec, TemplateEngine templateEngine, CommandLogger clog, ObjectMapper mapper)
{
  this.exec = exec;
  this.clog = clog;
  this.templateEngine = templateEngine;
  this.mapper = mapper;
  this.yaml = new YAMLFactory()
    .configure(YAMLGenerator.Feature.WRITE_DOC_START_MARKER, false);
}

代码示例来源:origin: walkmod/walkmod-core

public YAMLConfigurationProvider(String fileName) {
  this.fileName = fileName;
  factory = new YAMLFactory();
  mapper = new ObjectMapper(factory);
  factory.configure(YAMLGenerator.Feature.WRITE_DOC_START_MARKER, false);
}

代码示例来源:origin: funktionio/funktion-connectors

public static ObjectMapper createYamlMapper() {
    ObjectMapper objectMapper = new ObjectMapper(new YAMLFactory()
        .configure(YAMLGenerator.Feature.MINIMIZE_QUOTES, true)
        .configure(YAMLGenerator.Feature.ALWAYS_QUOTE_NUMBERS_AS_STRINGS, true)
        .configure(YAMLGenerator.Feature.USE_NATIVE_OBJECT_ID, false)
        .configure(YAMLGenerator.Feature.USE_NATIVE_TYPE_ID, false)
    );
    objectMapper.setSerializationInclusion(JsonInclude.Include.NON_EMPTY).
        enable(SerializationFeature.INDENT_OUTPUT).
        disable(SerializationFeature.WRITE_EMPTY_JSON_ARRAYS).
        disable(SerializationFeature.WRITE_NULL_MAP_VALUES);
    return objectMapper;

  }
}

代码示例来源:origin: io.fabric8.funktion/funktion-model

public static ObjectMapper createYamlMapper() {
    ObjectMapper objectMapper = new ObjectMapper(new YAMLFactory()
        .configure(YAMLGenerator.Feature.MINIMIZE_QUOTES, true)
        .configure(YAMLGenerator.Feature.ALWAYS_QUOTE_NUMBERS_AS_STRINGS, true)
        .configure(YAMLGenerator.Feature.USE_NATIVE_OBJECT_ID, false)
        .configure(YAMLGenerator.Feature.USE_NATIVE_TYPE_ID, false)
    );
    objectMapper.setSerializationInclusion(JsonInclude.Include.NON_EMPTY).
        enable(SerializationFeature.INDENT_OUTPUT).
        disable(SerializationFeature.WRITE_EMPTY_JSON_ARRAYS).
        disable(SerializationFeature.WRITE_NULL_MAP_VALUES);
    return objectMapper;

  }
}

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

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

代码示例来源:origin: io.syndesis.integration-runtime/model

public static ObjectMapper createObjectMapper() {
  final YAMLFactory yamlFactory = new YAMLFactory()
    .configure(YAMLGenerator.Feature.USE_NATIVE_TYPE_ID, false)
    .configure(YAMLGenerator.Feature.MINIMIZE_QUOTES, true)
    .configure(YAMLGenerator.Feature.ALWAYS_QUOTE_NUMBERS_AS_STRINGS, true)
    .configure(YAMLGenerator.Feature.USE_NATIVE_TYPE_ID, false);
  ObjectMapper mapper = new ObjectMapper(yamlFactory)
    .registerModule(new Jdk8Module())
    .setSerializationInclusion(JsonInclude.Include.NON_EMPTY)
    .enable(SerializationFeature.INDENT_OUTPUT)
    .disable(SerializationFeature.WRITE_NULL_MAP_VALUES);
  for (Step step : ServiceLoader.load(Step.class, YamlHelpers.class.getClassLoader())) {
    mapper.registerSubtypes(new NamedType(step.getClass(), step.getKind()));
  }
  return mapper;
}

代码示例来源:origin: codehaus-cargo/cargo

/**
   * Creates YAML generator instance.
   * @return YAMLGenerator instance.
   */
  private YAMLGenerator createYamlGenerator()
  {
    final Writer writer = new StringWriter();

    YAMLFactory yamlFactory = new YAMLFactory();
    yamlFactory.configure(YAMLGenerator.Feature.MINIMIZE_QUOTES, true);
    yamlFactory.disable(YAMLGenerator.Feature.WRITE_DOC_START_MARKER);

    try
    {
      return yamlFactory.createGenerator(writer);
    }
    catch (IOException ex)
    {
      throw new RuntimeException("Cannot create YAML generator.", ex);
    }
  }
}

代码示例来源:origin: org.restlet.gae/org.restlet.ext.jackson

|| MediaType.TEXT_YAML.isCompatible(getMediaType())) {
  YAMLFactory yamlFactory = new YAMLFactory();
  yamlFactory.configure(Feature.AUTO_CLOSE_TARGET, false);
  result = new ObjectMapper(yamlFactory);
} else if (MediaType.TEXT_CSV.isCompatible(getMediaType())) {

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