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


Java JSONWriter.startObject方法代码示例

本文整理汇总了Java中org.noggit.JSONWriter.startObject方法的典型用法代码示例。如果您正苦于以下问题:Java JSONWriter.startObject方法的具体用法?Java JSONWriter.startObject怎么用?Java JSONWriter.startObject使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.noggit.JSONWriter的用法示例。


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

示例1: writeError

import org.noggit.JSONWriter; //导入方法依赖的package包/类
void writeError(int code, String msg) throws IOException {
  response.setStatus(code);

  CharArr chars = new CharArr();
  JSONWriter w = new JSONWriter(chars, 2);
  w.startObject();
  w.indent();
  w.writeString("status");
  w.writeNameSeparator();
  w.write(code);
  w.writeValueSeparator();
  w.indent();
  w.writeString("error");
  w.writeNameSeparator();
  w.writeString(msg);
  w.endObject();

  out.write(chars.toString());
}
 
开发者ID:europeana,项目名称:search,代码行数:20,代码来源:ZookeeperInfoServlet.java

示例2: streamToJson

import org.noggit.JSONWriter; //导入方法依赖的package包/类
@Override
public void streamToJson(JSONWriter jsonWriter) {
    jsonWriter.write(this.name);
    jsonWriter.writeNameSeparator();

    jsonWriter.startObject();
    jsonWriter.indent();
    this.writeStringField(jsonWriter, FIELD_TYPE, this.type);
    this.writeValueSeparator(jsonWriter);
    this.writeFacetConfiguration(jsonWriter);
    this.writeSubFacets(jsonWriter);
    jsonWriter.indent();

    jsonWriter.endObject();
}
 
开发者ID:Indoqa,项目名称:solr-facet-api,代码行数:16,代码来源:AbstractFacet.java

示例3: toJsonString

import org.noggit.JSONWriter; //导入方法依赖的package包/类
@Override
public String toJsonString() {
    CharArr charArr = new CharArr();
    JSONWriter jsonWriter = new JSONWriter(charArr, 2);

    jsonWriter.startObject();
    jsonWriter.indent();

    this.streamToJson(jsonWriter);

    jsonWriter.indent();
    jsonWriter.endObject();

    return charArr.toString();
}
 
开发者ID:Indoqa,项目名称:solr-facet-api,代码行数:16,代码来源:AbstractFacet.java

示例4: writeSubFacets

import org.noggit.JSONWriter; //导入方法依赖的package包/类
protected void writeSubFacets(JSONWriter jsonWriter) {
    if (this.subFacets.isEmpty()) {
        return;
    }

    this.writeValueSeparator(jsonWriter);
    jsonWriter.write(FIELD_FACET);
    jsonWriter.writeNameSeparator();

    jsonWriter.startObject();
    jsonWriter.indent();
    this.writeFacets(jsonWriter, this.subFacets);
    jsonWriter.indent();
    jsonWriter.endObject();
}
 
开发者ID:Indoqa,项目名称:solr-facet-api,代码行数:16,代码来源:AbstractFacet.java

示例5: log

import org.noggit.JSONWriter; //导入方法依赖的package包/类
public void log(
  String userName,
  String impersonator,
  String ipAddress,
  String operation,
  String operationParams,
  long eventTime,
  int allowed,
  String collectionName) {

  if (!isLogEnabled()) {
    return;
  }
  CharArr chars = new CharArr(512);
  JSONWriter writer = new JSONWriter(chars, -1);
  writer.startObject();
  writeField("solrVersion", SOLR_VERSION, writer);
  writer.writeValueSeparator();
  writeField("eventTime", eventTime, writer);
  writer.writeValueSeparator();
  writeField("allowed", allowed, writer);
  writer.writeValueSeparator();
  writeField("collectionName", collectionName, writer);
  writer.writeValueSeparator();
  writeField("operation", operation, writer);
  writer.writeValueSeparator();
  writeField("operationParams", operationParams, writer);
  writer.writeValueSeparator();
  writeField("ipAddress", ipAddress, writer);
  writer.writeValueSeparator();
  writeField("username", userName, writer);
  writer.writeValueSeparator();
  writeField("impersonator", impersonator, writer);
  writer.endObject();
  logger.info("{}", chars);
}
 
开发者ID:apache,项目名称:incubator-sentry,代码行数:37,代码来源:AuditLogger.java

示例6: print

import org.noggit.JSONWriter; //导入方法依赖的package包/类
void print(String path) throws IOException {
  if (zkClient == null) {
    return;
  }

  // normalize path
  if (path == null) {
    path = "/";
  } else {
    path = path.trim();
    if (path.length() == 0) {
      path = "/";
    }
  }

  if (path.endsWith("/") && path.length() > 1) {
    path = path.substring(0, path.length() - 1);
  }

  int idx = path.lastIndexOf('/');
  String parent = idx >= 0 ? path.substring(0, idx) : path;
  if (parent.length() == 0) {
    parent = "/";
  }

  CharArr chars = new CharArr();
  JSONWriter json = new JSONWriter(chars, 2);
  json.startObject();

  if (detail) {
    if (!printZnode(json, path)) {
      return;
    }
    json.writeValueSeparator();
  }

  json.writeString("tree");
  json.writeNameSeparator();
  json.startArray();
  if (!printTree(json, path)) {
    return; // there was an error
  }
  json.endArray();
  json.endObject();
  out.write(chars.toString());
}
 
开发者ID:europeana,项目名称:search,代码行数:47,代码来源:ZookeeperInfoServlet.java


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