gpt4 book ai didi

org.jetbrains.yaml.psi.YAMLKeyValue.getName()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-16 01:47:31 27 4
gpt4 key购买 nike

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

YAMLKeyValue.getName介绍

暂无

代码示例

代码示例来源:origin: zalando/intellij-swagger

private boolean hasRootKey(final String keyName, final PsiFile psiFile) {
 return getRootChildrenOfType(psiFile, YAMLKeyValue.class)
   .stream()
   .anyMatch(yamlKeyValue -> keyName.equals(yamlKeyValue.getName()));
}

代码示例来源:origin: zalando/intellij-swagger

public Optional<? extends PsiElement> getRootChildByName(
  final String keyName, final PsiFile psiFile) {
 return getRootChildrenOfType(psiFile, YAMLKeyValue.class)
   .stream()
   .filter(yamlKeyValue -> keyName.equals(yamlKeyValue.getName()))
   .findFirst();
}

代码示例来源:origin: zalando/intellij-swagger

@Override
public List<PsiElement> getTags(final PsiFile psiFile) {
 return getRootChildrenOfType(psiFile, YAMLKeyValue.class)
   .stream()
   .filter(yamlKeyValue -> "tags".equals(yamlKeyValue.getName()))
   .map(YAMLKeyValue::getValue)
   .map(YAMLPsiElement::getYAMLElements)
   .flatMap(Collection::stream)
   .filter(el -> el instanceof YAMLSequenceItem)
   .map(YAMLSequenceItem.class::cast)
   .map(YAMLSequenceItem::getYAMLElements)
   .flatMap(Collection::stream)
   .filter(el -> el instanceof YAMLMapping)
   .map(YAMLMapping.class::cast)
   .map(yamlMapping -> yamlMapping.getKeyValueByKey("name"))
   .map(YAMLKeyValue::getValue)
   .filter(Objects::nonNull)
   .collect(Collectors.toList());
}

代码示例来源:origin: zalando/intellij-swagger

@Override
public List<String> getSecurityScopesIfOAuth2(final PsiElement securityDefinitionItem) {
 final List<YAMLKeyValue> properties = getChildProperties(securityDefinitionItem);
 final boolean isOAuth2 =
   properties
     .stream()
     .anyMatch(
       prop -> {
        final Optional<String> value =
          Optional.ofNullable(prop.getValue())
            .map(YAMLValue::getText)
            .map(StringUtils::removeAllQuotes);
        return "type".equals(prop.getName()) && Optional.of("oauth2").equals(value);
       });
 if (isOAuth2) {
  return properties
    .stream()
    .filter(prop -> "scopes".equals(prop.getName()))
    .map(this::getChildProperties)
    .flatMap(Collection::stream)
    .map(YAMLKeyValue::getName)
    .collect(Collectors.toList());
 }
 return ImmutableList.of();
}

代码示例来源:origin: Haehnchen/idea-php-symfony2-plugin

/**
 * acme_demo.form.type.gender:
 *  class: espend\Form\TypeBundle\Form\FooType
 *  tags:
 *   - { name: form.type, alias: foo_type_alias  }
 *   - { name: foo  }
 */
@NotNull
public static Map<String, Set<String>> getTags(@NotNull YAMLFile yamlFile) {
  Map<String, Set<String>> map = new HashMap<>();
  for(YAMLKeyValue yamlServiceKeyValue : YamlHelper.getQualifiedKeyValuesInFile(yamlFile, "services")) {
    String serviceName = yamlServiceKeyValue.getName();
    Set<String> serviceTagMap = YamlHelper.collectServiceTags(yamlServiceKeyValue);
    if(serviceTagMap != null && serviceTagMap.size() > 0) {
      map.put(serviceName, serviceTagMap);
    }
  }
  return map;
}

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