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


Java JSONStringer.endObject方法代码示例

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


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

示例1: toJSONString

import org.json.JSONStringer; //导入方法依赖的package包/类
@Override
public void toJSONString(JSONStringer stringer) throws JSONException {
    super.toJSONString(stringer);

    stringer.key("AGGREGATE_COLUMNS");
    stringer.array();
    for (int ii = 0; ii < m_aggregateTypes.size(); ii++) {
        stringer.object();
        stringer.key(Members.AGGREGATE_TYPE.name()).value(m_aggregateTypes.get(ii).name());
        stringer.key(Members.AGGREGATE_NAME.name()).value(m_aggregateColumnNames.get(ii));
        stringer.key(Members.AGGREGATE_GUID.name()).value(m_aggregateColumnGuids.get(ii));
        stringer.key(Members.AGGREGATE_OUTPUT_COLUMN.name()).value(m_aggregateOutputColumns.get(ii));
        stringer.endObject();
    }
    stringer.endArray();

    if (!m_groupByColumnGuids.isEmpty())
    {   
        stringer.key(Members.GROUPBY_COLUMNS.name()).array();
        for (int i = 0; i < m_groupByColumnGuids.size(); i++) {
            PlanColumn column = m_context.get(m_groupByColumnGuids.get(i));
            column.toJSONString(stringer);
        }
        stringer.endArray();
    }
}
 
开发者ID:s-store,项目名称:s-store,代码行数:27,代码来源:AggregatePlanNode.java

示例2: toBundle

import org.json.JSONStringer; //导入方法依赖的package包/类
public void toBundle(Bundle bundle) {
    super.toBundle(bundle);
    JSONStringer jSONStringer = new JSONStringer();
    try {
        jSONStringer.object();
        jSONStringer.key("card_list");
        jSONStringer.array();
        for (WXCardItem wXCardItem : this.cardArrary) {
            jSONStringer.object();
            jSONStringer.key("card_id");
            jSONStringer.value(wXCardItem.cardId);
            jSONStringer.key("card_ext");
            jSONStringer.value(wXCardItem.cardExtMsg == null ? "" : wXCardItem.cardExtMsg);
            jSONStringer.key("is_succ");
            jSONStringer.value((long) wXCardItem.cardState);
            jSONStringer.endObject();
        }
        jSONStringer.endArray();
        jSONStringer.endObject();
    } catch (Exception e) {
        e.printStackTrace();
    }
    bundle.putString("_wxapi_add_card_to_wx_card_list", jSONStringer.toString());
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:25,代码来源:AddCardToWXCardPackage.java

示例3: toJSONStringImpl

import org.json.JSONStringer; //导入方法依赖的package包/类
/**
 * Implementation of the toJSONString method for an AbstractVertex
 */
public void toJSONStringImpl(JSONStringer stringer) throws JSONException {
    super.toJSONStringImpl(stringer);
 
    Set<Members> members_set = CollectionUtil.getAllExcluding(Members.values(), Members.PROBABILITIES);
    Members members[] = new Members[members_set.size()];
    members_set.toArray(members);
    super.fieldsToJSONString(stringer, MarkovVertex.class, members);
    
    // Probabilities Map
    stringer.key(Members.PROBABILITIES.name()).object();
    for (Probability type : Probability.values()) {
        stringer.key(type.name()).array();
        int i = type.ordinal();
        for (int j = 0, cnt = this.probabilities[i].length; j < cnt; j++) {
            stringer.value(this.probabilities[i][j]);
        } // FOR
        stringer.endArray();
    } // FOR
    stringer.endObject();
}
 
开发者ID:s-store,项目名称:s-store,代码行数:24,代码来源:MarkovVertex.java

示例4: toJSON

import org.json.JSONStringer; //导入方法依赖的package包/类
public String toJSON(List<User> users) throws JSONException {
    try{
        JSONStringer jsonStringer = new JSONStringer();
        jsonStringer.object().key("lista").array().object().key("user").array();
        for (User user:users){
            jsonStringer.object();
            jsonStringer.key("cpf").value(user.getCpf());
            jsonStringer.key("name").value(user.getName());
            jsonStringer.key("phone").value(user.getPhone());
            jsonStringer.key("email").value(user.getEmail());
            jsonStringer.key("company").value(user.getCompany());
            jsonStringer.key("birthdate").value(user.getBirthdate());
            jsonStringer.key("url").value(user.getUrl());
            jsonStringer.key("location").value(user.getLocation());
            jsonStringer.key("photo").value(user.getPhoto());
            jsonStringer.endObject();
        }
        jsonStringer.endArray().endObject().endArray().endObject();
        return jsonStringer.toString();
    } catch (JSONException e){
        return null;
    }
}
 
开发者ID:robsonribeiroft,项目名称:nucleus-test,代码行数:24,代码来源:UserConverte.java

示例5: toJSONString

import org.json.JSONStringer; //导入方法依赖的package包/类
@Override
public void toJSONString(JSONStringer stringer) throws JSONException {
    // Tuple Counts
    stringer.key(Members.TUPLE_COUNT_TOTAL.name()).value(this.tuple_count_total);

    // Tuple Sizes
    stringer.key(Members.TUPLE_SIZE_TOTAL.name()).value(this.tuple_size_total);
    stringer.key(Members.TUPLE_SIZE_MIN.name()).value(this.tuple_size_min);
    stringer.key(Members.TUPLE_SIZE_MAX.name()).value(this.tuple_size_max);
    stringer.key(Members.TUPLE_SIZE_AVG.name()).value(this.tuple_size_avg);

    // Read-only
    stringer.key(Members.READONLY.name()).value(this.readonly);

    // Query Type Counts
    this.writeMap(this.query_type_count, Members.QUERY_TYPE_COUNT.name(), stringer);

    // Column Stats
    stringer.key(Members.COLUMN_STATS.name()).object();
    for (String col_key : this.column_stats.keySet()) {
        stringer.key(col_key).object();
        this.column_stats.get(col_key).toJSONString(stringer);
        stringer.endObject();
    } // FOR
    stringer.endObject();
}
 
开发者ID:s-store,项目名称:s-store,代码行数:27,代码来源:TableStatistics.java

示例6: load

import org.json.JSONStringer; //导入方法依赖的package包/类
/**
 * Load with the ability to override values
 */
public void load(File input_path, Database catalog_db, Map<String, String> override) throws IOException {
    // First call the regular load() method to bring all of our options
    this.load(input_path, catalog_db);

    // Then construct a JSONObject from the map to override the parameters
    if (override.isEmpty() == false) {
        JSONStringer stringer = new JSONStringer();
        try {
            stringer.object();
            for (Entry<String, String> e : override.entrySet()) {
                stringer.key(e.getKey().toUpperCase()).value(e.getValue());
            } // FOR
            stringer.endObject();
            this.fromJSON(new JSONObject(stringer.toString()), catalog_db);
        } catch (JSONException ex) {
            throw new IOException("Failed to load override parameters: " + override, ex);
        }
    }
}
 
开发者ID:s-store,项目名称:s-store,代码行数:23,代码来源:DesignerHints.java

示例7: toJSONString

import org.json.JSONStringer; //导入方法依赖的package包/类
@Override
    public String toJSONString() {
        JSONStringer stringer = new JSONStringer();
        try {
            stringer.object();
            super.toJSONString(stringer);

            stringer.key(Members.EXECUTE_LIST.name()).array();
            for (AbstractPlanNode node : m_list) {
                stringer.value(node.getPlanNodeId().intValue());
            }
            stringer.endArray(); //end execution list

            stringer.endObject(); //end PlanNodeList
        } catch (JSONException e) {
            // HACK ugly ugly to make the JSON handling
            // in QueryPlanner generate a JSONException for a plan we know
            // here that we can't serialize.  Making this method throw
            // JSONException pushes that exception deep into the bowels of
            // Volt with no good place to catch it and handle the error.
            // Consider this the coward's way out.
            throw new RuntimeException("Failed to serialize PlanNodeList", e);
//            return "This JSON error message is a lie";
        }
        return stringer.toString();
    }
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:27,代码来源:PlanNodeList.java

示例8: toJSON

import org.json.JSONStringer; //导入方法依赖的package包/类
@Override
public void toJSON(JSONStringer stringer) throws JSONException {
    // CLASSNAME
    stringer.key(Members.CLASSNAME.name()).value(this.getClass().getCanonicalName());
    
    // MARKOV GRAPHS
    stringer.key(Members.MARKOVS.name()).object();
    for (Integer id : this.markovs.keySet()) {
        // Roll through each id and create a new JSONObject per id
        if (debug.val)
            LOG.debug("Serializing " + this.markovs.get(id).size() + " graphs for id " + id);
        stringer.key(id.toString()).object();
        for (Entry<Procedure, MarkovGraph> e : this.markovs.get(id).entrySet()) {
            // Optimization: Hex-encode all of the MarkovGraphs so that we don't get crushed
            // when trying to read them all back at once when we create the JSONObject
            try {
                FastSerializer fs = new FastSerializer(false, false); // C++ needs little-endian
                fs.write(e.getValue().toJSONString().getBytes());
                String hexString = fs.getHexEncodedBytes();
                stringer.key(CatalogKey.createKey(e.getKey())).value(hexString);
            } catch (Exception ex) {
                String msg = String.format("Failed to serialize %s MarkovGraph for Id %d", e.getKey(), id);
                LOG.fatal(msg);
                throw new JSONException(ex);
            }
        } // FOR
        stringer.endObject();
    } // FOR
    stringer.endObject();
}
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:31,代码来源:MarkovGraphsContainer.java

示例9: toJSONString

import org.json.JSONStringer; //导入方法依赖的package包/类
/**
 * 
 */
@Override
public String toJSONString() {
    JSONStringer stringer = new JSONStringer();
    try {
        stringer.object();
        this.toJSONString(stringer);
        stringer.endObject();
    } catch (JSONException e) {
        e.printStackTrace();
        System.exit(-1);
    }
    return stringer.toString();
}
 
开发者ID:s-store,项目名称:s-store,代码行数:17,代码来源:FragmentEntry.java

示例10: toJSONString

import org.json.JSONStringer; //导入方法依赖的package包/类
public void toJSONString(JSONStringer stringer) throws JSONException
{
    stringer.object();
    stringer.key(Members.GUID.name()).value(guid());
    stringer.key(Members.NAME.name()).value(getDisplayName());
    stringer.key(Members.TYPE.name()).value(type().name());
    stringer.key(Members.SIZE.name()).value(width());
    stringer.key(Members.SORT_ORDER.name()).value(m_sortOrder.name());
    stringer.key(Members.STORAGE.name()).value(m_storage.name());
    
    if (originTableName() != null) {
        stringer.key(Members.INPUT_TABLE_NAME.name()).value(originTableName());
    }
    else
    {
        stringer.key(Members.INPUT_TABLE_NAME.name()).value("");
    }
    if (originColumnName() != null) {
        stringer.key(Members.INPUT_COLUMN_NAME.name()).value(originColumnName());
    }
    else
    {
        stringer.key(Members.INPUT_COLUMN_NAME.name()).value("");
    }
    if (m_expression != null) {
        stringer.key(Members.EXPRESSION.name());
        stringer.object();
        m_expression.toJSONString(stringer);
        stringer.endObject();
    }
    else
    {
        stringer.key(Members.EXPRESSION.name()).value("");
    }

    stringer.endObject();
}
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:38,代码来源:PlanColumn.java

示例11: toJSONString

import org.json.JSONStringer; //导入方法依赖的package包/类
public void toJSONString(JSONStringer stringer) throws JSONException {
    stringer.key(Members.ID.name()).value(this.id);
    stringer.key(Members.HOST.name()).value(this.host_key);

    stringer.key(Members.FRAGMENTS.name()).array();
    for (FragmentEntry fragment : this.fragments) {
        stringer.object();
        fragment.toJSONString(stringer);
        stringer.endObject();
    }
    stringer.endArray();
}
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:13,代码来源:SiteEntry.java

示例12: toJSONString

import org.json.JSONStringer; //导入方法依赖的package包/类
@Override
public void toJSONString(JSONStringer stringer) throws JSONException {
    // Read-only
    stringer.key(Members.READONLY.name()).value(this.readonly);

    // Histogram
    stringer.key(Members.HISTOGRAM.name()).object();
    this.histogram.toJSON(stringer);
    stringer.endObject();
}
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:11,代码来源:ColumnStatistics.java

示例13: toJSONString

import org.json.JSONStringer; //导入方法依赖的package包/类
@Override
public String toJSONString() {
    JSONStringer stringer = new JSONStringer();
    try {
        stringer.object();
        this.toJSONString(stringer);
        stringer.endObject();
    } catch (JSONException e) {
        e.printStackTrace();
        System.exit(-1);
    }
    return stringer.toString();
}
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:14,代码来源:RandomGenerator.java

示例14: toJSONString

import org.json.JSONStringer; //导入方法依赖的package包/类
public void toJSONString(JSONStringer stringer) throws JSONException {
    for (String source_table : this.getTables()) {
        stringer.key(source_table).object();
        for (Pair<String, String> pair : this.getTables(source_table)) {
            stringer.key(pair.getSecond()).object();
            this.affinity_map.get(pair).toJSONString(stringer);
            stringer.endObject();
        } // FOR
        stringer.endObject();
    } // FOR
}
 
开发者ID:s-store,项目名称:s-store,代码行数:12,代码来源:RandomGenerator.java

示例15: toJSONString

import org.json.JSONStringer; //导入方法依赖的package包/类
@Override
public void toJSONString(JSONStringer stringer) throws JSONException {
    super.toJSONString(stringer);
    assert (m_sortColumnNames.size() == m_sortDirections.size());
    stringer.key(Members.SORT_COLUMNS.name()).array();
    for (int ii = 0; ii < m_sortColumnNames.size(); ii++) {
        stringer.object();
        stringer.key(Members.COLUMN_NAME.name()).value(m_sortColumnNames.get(ii));
        stringer.key(Members.COLUMN_GUID.name()).value(m_sortColumnGuids.get(ii));
        stringer.key(Members.SORT_DIRECTION.name()).value(m_sortDirections.get(ii).toString());
        stringer.endObject();
    }
    stringer.endArray();
}
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:15,代码来源:OrderByPlanNode.java


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