本文整理汇总了Java中org.json.JSONStringer.endArray方法的典型用法代码示例。如果您正苦于以下问题:Java JSONStringer.endArray方法的具体用法?Java JSONStringer.endArray怎么用?Java JSONStringer.endArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.json.JSONStringer
的用法示例。
在下文中一共展示了JSONStringer.endArray方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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();
}
示例2: toJSONString
import org.json.JSONStringer; //导入方法依赖的package包/类
@Override
public void toJSONString(JSONStringer stringer) throws JSONException {
super.toJSONString(stringer);
stringer.key(Members.KEY_ITERATE.name()).value(m_keyIterate);
stringer.key(Members.LOOKUP_TYPE.name()).value(m_lookupType.toString());
stringer.key(Members.SORT_DIRECTION.name()).value(m_sortDirection.toString());
stringer.key(Members.TARGET_INDEX_NAME.name()).value(m_targetIndexName);
stringer.key(Members.END_EXPRESSION.name());
stringer.value(m_endExpression);
stringer.key(Members.SEARCHKEY_EXPRESSIONS.name()).array();
for (AbstractExpression ae : m_searchkeyExpressions) {
assert (ae instanceof JSONString);
stringer.value(ae);
}
stringer.endArray();
}
示例3: toJSON
import org.json.JSONStringer; //导入方法依赖的package包/类
@Override
public void toJSON(JSONStringer stringer) throws JSONException {
// Go through once and find the greatest position where
// there are no more non-null values
int maxSize = 0;
for (int i = 0; i < this.histogram.length; i++) {
if (this.histogram[i] != NULL_COUNT) {
maxSize = i;
}
} // FOR
stringer.key(Members.HISTOGRAM.name()).array();
for (int i = 0; i <= maxSize; i++) {
stringer.value(this.histogram[i]);
} // FOR
stringer.endArray();
if (this.debug_names != null && this.debug_names.isEmpty() == false) {
stringer.key(Members.DEBUG.name()).object();
for (Entry<Object, String> e : this.debug_names.entrySet()) {
stringer.key(e.getKey().toString())
.value(e.getValue().toString());
} // FOR
stringer.endObject();
}
}
示例4: 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();
}
示例5: 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();
}
}
示例6: 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.endObject();
}
jSONStringer.endArray();
jSONStringer.endObject();
} catch (Exception e) {
e.printStackTrace();
}
bundle.putString("_wxapi_add_card_to_wx_card_list", jSONStringer.toString());
}
示例7: toJSON
import org.json.JSONStringer; //导入方法依赖的package包/类
@Override
public void toJSON(JSONStringer stringer) throws JSONException {
stringer.key("P").array();
for (Integer partition : this) {
stringer.value(partition);
} // FOR
stringer.endArray();
}
示例8: toJSON
import org.json.JSONStringer; //导入方法依赖的package包/类
public void toJSON(JSONStringer stringer) throws JSONException {
stringer.key("MAPPINGS").array();
for (ParameterMapping c : this) {
assert(c != null);
stringer.value(c);
} // FOR
stringer.endArray();
}
示例9: toJSONString
import org.json.JSONStringer; //导入方法依赖的package包/类
public void toJSONString(JSONStringer stringer, Database catalog_db) throws JSONException {
super.toJSONString(stringer, catalog_db);
stringer.key(Members.TXN_ID.name()).value(this.txn_id);
stringer.key(Members.QUERIES.name()).array();
for (QueryTrace query : this.queries) {
stringer.object();
query.toJSONString(stringer, catalog_db);
stringer.endObject();
} // FOR
stringer.endArray();
}
示例10: 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();
}
示例11: 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();
}
示例12: toJSONString
import org.json.JSONStringer; //导入方法依赖的package包/类
public void toJSONString(JSONStringer stringer) throws JSONException {
stringer.key(Members.PLAN_NODES.name()).array();
for (AbstractPlanNode node : m_planNodes) {
assert (node instanceof JSONString);
stringer.value(node);
}
stringer.endArray(); // end entries
stringer.key(Members.PARAMETERS.name()).array();
for (Pair<Integer, VoltType> parameter : m_parameters) {
stringer.array().value(parameter.getFirst()).value(parameter.getSecond().name()).endArray();
}
stringer.endArray();
}
示例13: toJSON
import org.json.JSONStringer; //导入方法依赖的package包/类
@Override
public void toJSON(JSONStringer stringer) throws JSONException {
stringer.key("NAME").value(this.name);
stringer.key("TIME").value(this.total_time);
stringer.key("INVOCATIONS").value(this.invocations);
if (this.history != null) {
stringer.key("HISTORY").array();
for (long val : this.history) {
stringer.value(val);
} // FOR
stringer.endArray();
}
}
示例14: toJSONString
import org.json.JSONStringer; //导入方法依赖的package包/类
@Override
public void toJSONString(JSONStringer stringer) throws JSONException {
super.toJSONString(stringer);
stringer.key(Members.VALUES.name()).array();
for (AbstractExpression expr : m_values) {
assert (expr instanceof JSONString);
stringer.value(expr);
}
stringer.endArray();
}