本文整理汇总了Java中org.json.JSONStringer.value方法的典型用法代码示例。如果您正苦于以下问题:Java JSONStringer.value方法的具体用法?Java JSONStringer.value怎么用?Java JSONStringer.value使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.json.JSONStringer
的用法示例。
在下文中一共展示了JSONStringer.value方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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();
}
}
示例3: 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());
}
示例4: 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();
}
示例5: 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();
}
示例6: 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();
}
示例7: 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();
}
}
示例8: writeJsonAttributes
import org.json.JSONStringer; //导入方法依赖的package包/类
protected void writeJsonAttributes(JSONStringer out) throws JSONException {
out.key("element");
out.value(mElementChanged);
if (mFieldName != null) {
out.key("name");
out.value(mFieldName);
}
out.key("newValue");
out.value(mNewValue);
}
示例9: 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();
}
示例10: 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();
}
示例11: toJSONString
import org.json.JSONStringer; //导入方法依赖的package包/类
@Override
public void toJSONString(JSONStringer stringer) throws JSONException {
super.toJSONString(stringer);
stringer.key(Members.VALUE.name());
if (m_isNull)
{
stringer.value("NULL");
}
else
{
switch (m_valueType)
{
case INVALID:
throw new JSONException("ConstantValueExpression.toJSONString(): value_type should never be VoltType.INVALID");
case NULL:
throw new JSONException("ConstantValueExpression.toJSONString(): And they should be never be this either! VoltType.NULL");
case TINYINT:
stringer.value(Long.valueOf(m_value));
break;
case SMALLINT:
stringer.value(Long.valueOf(m_value));
break;
case INTEGER:
stringer.value(Long.valueOf(m_value));
break;
case BIGINT:
stringer.value(Long.valueOf(m_value));
break;
case FLOAT:
stringer.value(Double.valueOf(m_value));
break;
case STRING:
stringer.value(m_value);
break;
case TIMESTAMP:
stringer.value(Long.valueOf(m_value));
break;
case DECIMAL:
stringer.value(m_value);
break;
default:
throw new JSONException("ConstantValueExpression.toJSONString(): Unrecognized value_type " + m_valueType);
}
}
}