Codota Logo
YAMLKeyValue.getKey
Code IndexAdd Codota to your IDE (free)

How to use
getKey
method
in
org.jetbrains.yaml.psi.YAMLKeyValue

Best Java code snippets using org.jetbrains.yaml.psi.YAMLKeyValue.getKey (Showing top 8 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
Charset c =
  • Codota IconString charsetName;Charset.forName(charsetName)
  • Codota IconCharset.defaultCharset()
  • Codota IconContentType contentType;contentType.getCharset()
  • Smart code suggestions by Codota
}
origin: zalando/intellij-swagger

private Optional<YAMLKeyValue> getAsYamlKeyValue(final PsiElement psiElement) {
 return Optional.ofNullable(psiElement)
   .map(PsiElement::getParent)
   .filter(el -> el instanceof YAMLKeyValue)
   .map(YAMLKeyValue.class::cast)
   .filter(value -> value.getKey() == psiElement);
}
origin: Haehnchen/idea-php-symfony2-plugin

private void registerYmlRoutePatternProblem(@NotNull ProblemsHolder holder, @NotNull YAMLKeyValue element) {
  String s = PsiElementUtils.trimQuote(element.getKeyText());
  if(("factory_class".equals(s) || "factory_method".equals(s) || "factory_service".equals(s)) && YamlElementPatternHelper.getInsideServiceKeyPattern().accepts(element)) {
    // services:
    //   foo:
    //      factory_*:
    registerProblem(holder, element.getKey());
  }
}
origin: Haehnchen/idea-php-symfony2-plugin

private void registerYmlRoutePatternProblem(@NotNull ProblemsHolder holder, @NotNull YAMLKeyValue element) {
  String s = PsiElementUtils.trimQuote(element.getKeyText());
  if("pattern".equals(s) && YamlHelper.isRoutingFile(element.getContainingFile())) {
    // pattern: foo
    holder.registerProblem(element.getKey(), "Pattern is deprecated; use path instead", ProblemHighlightType.LIKE_DEPRECATED);
  } else if(("_method".equals(s) || "_scheme".equals(s)) && YamlHelper.isRoutingFile(element.getContainingFile())) {
    // requirements: { _method: 'foo', '_scheme': 'foo' }
    YAMLKeyValue parentOfType = PsiTreeUtil.getParentOfType(element, YAMLKeyValue.class);
    if(parentOfType != null && "requirements".equals(parentOfType.getKeyText())) {
      holder.registerProblem(element.getKey(), String.format("The '%s' requirement is deprecated", s), ProblemHighlightType.LIKE_DEPRECATED);
    }
  }
}
origin: Haehnchen/idea-php-symfony2-plugin

@Nullable
public static String getYamlKeyName(@NotNull YAMLKeyValue yamlKeyValue) {
  PsiElement modelName = yamlKeyValue.getKey();
  if(modelName == null) {
    return null;
  }
  String keyName = StringUtils.trim(modelName.getText());
  if(keyName.endsWith(":")) {
    keyName = StringUtils.trim((keyName.substring(0, keyName.length() - 1)));
  }
  return keyName;
}
origin: Haehnchen/idea-php-symfony2-plugin

/**
 * Migrate to processKeysAfterRoot @TODO
 *
 * @param keyContext Should be Document or YAMLCompoundValueImpl which holds the key value children
 */
public static void attachDuplicateKeyInspection(PsiElement keyContext, @NotNull ProblemsHolder holder) {
  Map<String, PsiElement> psiElementMap = new HashMap<>();
  Set<PsiElement> yamlKeyValues = new HashSet<>();
  Collection<YAMLKeyValue> collection = PsiTreeUtil.getChildrenOfTypeAsList(keyContext, YAMLKeyValue.class);
  for(YAMLKeyValue yamlKeyValue: collection) {
    String keyText = PsiElementUtils.trimQuote(yamlKeyValue.getKeyText());
    if(StringUtils.isNotBlank(keyText)) {
      if(psiElementMap.containsKey(keyText)) {
        yamlKeyValues.add(psiElementMap.get(keyText));
        yamlKeyValues.add(yamlKeyValue);
      } else {
        psiElementMap.put(keyText, yamlKeyValue);
      }
    }
  }
  if(yamlKeyValues.size() > 0) {
    for(PsiElement psiElement: yamlKeyValues) {
      if(psiElement instanceof YAMLKeyValue) {
        final PsiElement keyElement = ((YAMLKeyValue) psiElement).getKey();
        assert keyElement != null;
        holder.registerProblem(keyElement, "Duplicate key", ProblemHighlightType.GENERIC_ERROR_OR_WARNING);
      }
    }
  }
}
origin: zalando/intellij-swagger

@Override
public PsiElement extractObjectForValidation(final PsiElement psiElement) {
 final Optional<PsiElement> thirdParent =
   Optional.ofNullable(psiElement.getParent())
     .map(PsiElement::getParent)
     .map(PsiElement::getParent);
 if (thirdParent.isPresent() && thirdParent.get() instanceof YAMLSequenceItem) {
  return ((YAMLSequenceItem) thirdParent.get()).getValue();
 } else if (thirdParent.isPresent() && thirdParent.get() instanceof YAMLKeyValue) {
  return ((YAMLKeyValue) thirdParent.get()).getKey();
 } else {
  return psiElement.getParent();
 }
}
origin: Haehnchen/idea-php-symfony2-plugin

PsiElement key = ((YAMLKeyValue) element).getKey();
if(key != null) {
  PsiElement nextSiblingOfType = PsiElementUtils.getNextSiblingOfType(key, PlatformPatterns.psiElement(YAMLTokenTypes.TAG));
origin: Haehnchen/idea-php-symfony2-plugin

  setTooltipText("Navigate to file");
PsiElement key = ((YAMLKeyValue) yamlKeyValueTarget).getKey();
if(key != null) {
  lineMarkerInfos.add(builder.createLineMarkerInfo(key));
org.jetbrains.yaml.psiYAMLKeyValuegetKey

Popular methods of YAMLKeyValue

  • getKeyText
  • getName
  • getValue
  • getValueText
  • getContainingFile
  • getFirstChild
  • getLastChild
  • getParent
  • getParentMapping
  • getProject
  • getText
  • getTextRange
  • getText,
  • getTextRange,
  • getYAMLElements

Popular in Java

  • Running tasks concurrently on multiple threads
  • getApplicationContext (Context)
  • getContentResolver (Context)
  • addToBackStack (FragmentTransaction)
  • FileWriter (java.io)
    Convenience class for writing character files. The constructors of this class assume that the defaul
  • Runnable (java.lang)
    Represents a command that can be executed. Often used to run code in a different Thread.
  • Connection (java.sql)
    A connection represents a link from a Java application to a database. All SQL statements and results
  • DateFormat (java.text)
    Formats or parses dates and times.This class provides factories for obtaining instances configured f
  • Dictionary (java.util)
    The Dictionary class is the abstract parent of any class, such as Hashtable, which maps keys to valu
  • ServletException (javax.servlet)
    Defines a general exception a servlet can throw when it encounters difficulty.
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now