当前位置: 首页>>代码示例>>Java>>正文


Java JsonArray类代码示例

本文整理汇总了Java中com.intellij.json.psi.JsonArray的典型用法代码示例。如果您正苦于以下问题:Java JsonArray类的具体用法?Java JsonArray怎么用?Java JsonArray使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


JsonArray类属于com.intellij.json.psi包,在下文中一共展示了JsonArray类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: compute

import com.intellij.json.psi.JsonArray; //导入依赖的package包/类
@Nullable
@Override
public Result<String[]> compute() {
  List<Object> dependencies = new LinkedList<Object>();
  for(JsonFile configFile : findConfigFiles()) {
    dependencies.add(configFile);
    JsonValue jsonValue = JsonPsiUtil.findPropertyValue(configFile.getTopLevelValue(), "componentsGlob");
    if(jsonValue == null)
      continue;
    List<String> paths = new LinkedList<String>();
    if(jsonValue instanceof JsonStringLiteral) {
      paths.add(((JsonStringLiteral)jsonValue).getValue());
    } else if(jsonValue instanceof JsonArray) {
      for(JsonStringLiteral item: PsiTreeUtil.findChildrenOfType(jsonValue, JsonStringLiteral.class))
        paths.add(item.getValue());
    }
    return Result.create(createValue(paths.toArray(new String[paths.size()])), jsonValue);
  }
  dependencies.add(tracker.getValue());
  return Result.create(createValue(), dependencies);
}
 
开发者ID:catberry,项目名称:catberry-idea-plugin,代码行数:22,代码来源:ComponentsDirectoriesProvider.java

示例2: getChildrenOfArrayObject

import com.intellij.json.psi.JsonArray; //导入依赖的package包/类
public List<PsiElement> getChildrenOfArrayObject(final PsiElement psiElement) {
    return Arrays.stream(psiElement.getChildren())
            .filter(child -> child instanceof JsonArray || child instanceof YAMLSequence)
            .map(el -> Arrays.asList(el.getChildren()))
            .flatMap(Collection::stream)
            .collect(Collectors.toList());
}
 
开发者ID:zalando,项目名称:intellij-swagger,代码行数:8,代码来源:Traversal.java

示例3: JsonBlock

import com.intellij.json.psi.JsonArray; //导入依赖的package包/类
public JsonBlock(@Nullable JsonBlock parent,
                 @NotNull ASTNode node,
                 @NotNull CodeStyleSettings settings,
                 @Nullable Alignment alignment,
                 @NotNull Indent indent,
                 @Nullable Wrap wrap) {
  myParent = parent;
  myNode = node;
  myPsiElement = node.getPsi();
  myAlignment = alignment;
  myIndent = indent;
  myWrap = wrap;
  mySettings = settings;

  mySpacingBuilder = JsonFormattingBuilderModel.createSpacingBuilder(settings);

  if (myPsiElement instanceof JsonObject) {
    myChildWrap = Wrap.createWrap(getCustomSettings().OBJECT_WRAPPING, true);
  }
  else if (myPsiElement instanceof JsonArray) {
    myChildWrap = Wrap.createWrap(getCustomSettings().ARRAY_WRAPPING, true);
  }
  else {
    myChildWrap = null;
  }

  myPropertyValueAlignment = myPsiElement instanceof JsonObject ? Alignment.createAlignment(true) : null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:29,代码来源:JsonBlock.java

示例4: apply

import com.intellij.json.psi.JsonArray; //导入依赖的package包/类
@Override
public void apply(@NotNull Editor editor, @NotNull JsonSmartEnterProcessor processor, @NotNull PsiElement element)
  throws IncorrectOperationException {
  if (element instanceof JsonValue && element.getParent() instanceof JsonArray) {
    final JsonValue arrayElement = (JsonValue)element;
    if (terminatedOnCurrentLine(editor, arrayElement) && !isFollowedByTerminal(element, COMMA)) {
      editor.getDocument().insertString(arrayElement.getTextRange().getEndOffset(), ",");
      processor.myShouldAddNewline = true;
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:JsonSmartEnterProcessor.java

示例5: JsonStructureViewModel

import com.intellij.json.psi.JsonArray; //导入依赖的package包/类
public JsonStructureViewModel(@NotNull PsiFile psiFile, @Nullable Editor editor) {
  super(psiFile, editor, new JsonStructureViewElement((JsonFile)psiFile));
  withSuitableClasses(JsonFile.class, JsonProperty.class, JsonObject.class, JsonArray.class);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:5,代码来源:JsonStructureViewModel.java


注:本文中的com.intellij.json.psi.JsonArray类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。