gpt4 book ai didi

com.opentext.ia.yaml.core.YamlMap类的使用及代码示例

转载 作者:知者 更新时间:2024-03-18 02:41:31 28 4
gpt4 key购买 nike

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

YamlMap介绍

[英]Type-safe access to a YAML map.
[中]键入对YAML映射的安全访问。

代码示例

代码示例来源:origin: com.opentext.ia/infoarchive-yaml

public Stream<Value> values() {
 return entries().map(Entry::getValue);
}

代码示例来源:origin: com.opentext.ia/infoarchive-sdk-core

private void putTemplatedFrom(YamlMap map, String name, String... destinationAndSourceNames) {
 int i = 0;
 while (i < destinationAndSourceNames.length) {
  String destination = destinationAndSourceNames[i++];
  String source = destinationAndSourceNames[i++];
  putTemplated(map.get(source), destination, name);
 }
}

代码示例来源:origin: com.opentext.ia/infoarchive-yaml

private YamlMap convertIndex(YamlMap index) {
 String type = index.get(TYPE).toString();
 index.remove(TYPE);
 return new YamlMap().put(type, index);
}

代码示例来源:origin: com.opentext.ia/infoarchive-yaml

private void ensureMember(YamlMap yaml, String member) {
 if (!yaml.containsKey(member)) {
  yaml.put(member, new YamlMap());
 }
}

代码示例来源:origin: com.opentext.ia/infoarchive-yaml

private YamlMap expand(YamlMap root, String prefix) {
 return new YamlMap()
   .put("prefix", prefix)
   .put("uri", NamespaceUri.byPrefix(root, prefix));
}

代码示例来源:origin: com.opentext.ia/infoarchive-yaml

private void replaceNamespacePrefixInPath(YamlMap root, YamlMap index) {
 index.put(PATH, replacePrefixes(root, index.get(PATH)));
}

代码示例来源:origin: com.opentext.ia/infoarchive-yaml

private void includeEntry(String key, String type, String collection, Value value, YamlMap target) {
 Value targetValue = target.containsKey(type) ? target.get(type) : target.get(collection);
 if (targetValue.isEmpty()) {
  target.put(key, value);
  return;
 }
 if (!canConfigure(value)) {
  return;
 }
 if (!canConfigure(targetValue)) {
  target.remove(type)
    .remove(collection)
    .put(key, value);
  return;
 }
 if (target.containsKey(type)) {
  target.replace(type, collection, Collections.singletonList(targetValue));
 }
 YamlSequence values = target.get(collection).toList();
 if (value.isList()) {
  values.addAll(value.toList());
 } else {
  values.add(value);
 }
}

代码示例来源:origin: com.opentext.ia/infoarchive-yaml

@Override
public void accept(Visit visit) {
 YamlMap yaml = visit.getMap();
 yaml.replace(QUERY, yaml.get(QUERY, TEXT));
}

代码示例来源:origin: com.opentext.ia/infoarchive-yaml

private void appendText(YamlIndent indent, int currentLineLength, String text, StringBuilder builder) {
 if (needsToBeSingleQuoted(text)) {
  appendSingleQuoted(text, builder);
 } else if (needsToBeDoubleQuoted(text)) {
  appendDoubleQuoted(text, builder);
 } else if (MAX_LINE_LENGTH < currentLineLength + text.length()) {
  appendWrappedText(indent.inText(), currentLineLength, text, builder);
 } else {
  builder.append(text);
 }
}

代码示例来源:origin: com.opentext.ia/infoarchive-yaml

public static YamlMap from(InputStream yaml, boolean canReset) {
 assertNotNull(yaml);
 InputStream input = canReset ? yaml : inMemoryCopyOf(yaml);
 YamlMap result = new YamlMap();
 try {
  for (Object data : newLoader().loadAll(input)) {
   result.putAll(new YamlMap(data));
  }
 } catch (MarkedYAMLException e) {
  try {
   input.reset();
   throw yamlSyntaxErrorPrettifier.apply(e, IOUtils.toString(input, StandardCharsets.UTF_8));
  } catch (IOException ignored) {
   // NOTREACHED
  }
 }
 return result;
}

代码示例来源:origin: com.opentext.ia/infoarchive-yaml

@Override
protected void visitContent(Visit visit, YamlMap content) {
 getIndexParents(content)
   .filter(Value::isMap)
   .map(Value::toMap)
   .filter(map -> map.containsKey(INDEXES))
   .flatMap(map -> map.get(INDEXES).toList().stream())
   .map(Value::toMap)
   .filter(map -> map.entries().count() == 1)
   .flatMap(YamlMap::entries)
   .map(Entry::getValue)
   .map(Value::toMap)
   .filter(map -> map.containsKey(PATH))
   .forEach(map -> replaceNamespacePrefixInPath(visit.getRootMap(), map));
}

代码示例来源:origin: com.opentext.ia/infoarchive-yaml

private void addExternalResourceFiles(File base, YamlMap yaml) {
 yaml.visit(visit -> {
  YamlMap map = visit.getMap();
  if (map.containsKey(RESOURCE)) {
   Value resource = map.get(RESOURCE);
   if (resource.isList()) {
    ListIterator<Value> iterator = resource.toList().listIterator();
    while (iterator.hasNext()) {
     addExternalResourceFile(base, iterator.next(), path -> iterator.set(new Value(path)));
    }
   } else {
    addExternalResourceFile(base, map.get(RESOURCE), path -> map.put(RESOURCE, path));
   }
  }
 });
}

代码示例来源:origin: com.opentext.ia/infoarchive-yaml

@Override
public void accept(Visit visit) {
 YamlMap yaml = visit.getMap();
 if (yaml.containsKey(RESOURCE)) {
  yaml.replace(RESOURCE, prefix + yaml.get(RESOURCE));
 }
}

代码示例来源:origin: com.opentext.ia/infoarchive-sdk-core

private void putValueList(YamlMap map, String valueListProperty, String valueListName, String format,
  String name) {
 map.get(valueListProperty).toMap().entries().forEach(e -> {
  append(valueListName, e.getKey());
  putTemplated(e.getValue(), format, name, e.getKey());
 });
}

代码示例来源:origin: com.opentext.ia/infoarchive-yaml

private Stream<YamlMap> streamOfType(String type) {
 String collection = English.plural(type);
 if (yaml.containsKey(collection)) {
  return yaml.get(collection).toList().stream().map(Value::toMap);
 }
 if (yaml.containsKey(type)) {
  return Stream.of(yaml.get(type).toMap());
 }
 return Stream.empty();
}

代码示例来源:origin: com.opentext.ia/infoarchive-yaml

private Stream<YamlMap> toTextMaps(YamlMap source) {
 return source.get(TEXT).toList().stream()
   .map(text -> YamlMap.from(source).put(TEXT, text));
}

代码示例来源:origin: com.opentext.ia/infoarchive-yaml

@Override
void visitContent(Visit visit, YamlMap content) {
 String xml = translateToXml(visit.getRootMap(), content.get(itemProperties).toList(),
   content.get(NAMESPACES).toList());
 content
   .put("format", "xml")
   .remove(NAMESPACES)
   .put(TEXT, xml);
}

代码示例来源:origin: com.opentext.ia/infoarchive-yaml

private void appendEntry(YamlIndent indent, Map.Entry<String, Object> entry, StringBuilder builder,
  AtomicBoolean differenceFound) {
 int len = builder.length();
 builder.append(indent);
 appendText(indent, builder.length() - len, entry.getKey(), builder);
 builder.append(':');
 Object value = entry.getValue();
 if (value instanceof Map) {
  builder.append(LINE_SEPARATOR);
  appendMap(indent.inMap(), false, (Map<String, Object>)value, builder, differenceFound);
 } else if (value instanceof Collection) {
  appendCollection(indent, builder.length() - len, (Collection<?>)value, builder, differenceFound);
 } else {
  builder.append(' ');
  appendValue(indent, builder.length() - len, value, builder);
 }
}

代码示例来源:origin: com.opentext.ia/infoarchive-yaml

private void include(String resource, YamlMap target) {
 URI base = URI.create(resource);
 ConfigurationProperties properties = propertiesIn(base);
 YamlMap include = YamlMap.from(resourceResolver.apply(resource));
 include.visit(includeNestedYaml(base, properties));
 include.visit(new ResolveResources(resource));
 include.visit(new StringSubstitutor(properties));
 include.entries().forEach(entry -> includeEntry(entry.getKey(), entry.getValue(), target));
}

代码示例来源:origin: com.opentext.ia/infoarchive-yaml

private void addNamespaceDeclarations(YamlMap root, Entry entry) {
 String namespaceDeclarations = entry.getValue().toMap()
   .get(NAMESPACES).toList().stream()
   .map(prefix -> namespaceDeclarationFor(root, prefix))
   .collect(Collectors.joining(NL)) + NL;
 entry.getParent()
   .replace(entry.getKey(), namespaceDeclarations + entry.getValue().toMap().get("text"))
   .remove(NAMESPACES);
}

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