本文整理匯總了Java中com.alibaba.fastjson.JSONArray.getInteger方法的典型用法代碼示例。如果您正苦於以下問題:Java JSONArray.getInteger方法的具體用法?Java JSONArray.getInteger怎麽用?Java JSONArray.getInteger使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.alibaba.fastjson.JSONArray
的用法示例。
在下文中一共展示了JSONArray.getInteger方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: read
import com.alibaba.fastjson.JSONArray; //導入方法依賴的package包/類
public static NatureAttribute read(DataInput in) {
try {
NatureAttribute attribute = new NatureAttribute();
attribute.totalFrequency = in.readInt();
String json = in.readUTF();
JSONArray array = JSON.parseArray(json);
ImmutableMap.Builder<Nature, Integer> builder = ImmutableMap.builder();
for (int i = 0; i < array.size(); i += 2) {
int ord = array.getIntValue(i);
Integer freq = array.getInteger(i + 1);
builder.put(Nature.valueOf(ord), freq);
}
attribute.map = builder.build();
return attribute;
} catch (IOException e) {
throw new RuntimeException(e);
}
}
示例2: get
import com.alibaba.fastjson.JSONArray; //導入方法依賴的package包/類
public static Action get(String actionName,JSONArray args){
switch (actionName) {
case CREATE_BODY:
if (args == null) {
return null;
}
return new CreateBodyAction(args.getJSONObject(0));
case UPDATE_ATTRS:
if (args == null) {
return null;
}
return new UpdateAttributeAction(args.getString(0),args.getJSONObject(1));
case UPDATE_STYLE:
if (args == null) {
return null;
}
return new UpdateStyleAction(args.getString(0),args.getJSONObject(1));
case REMOVE_ELEMENT:
if (args == null) {
return null;
}
return new RemoveElementAction(args.getString(0));
case ADD_ELEMENT:
if (args == null) {
return null;
}
return new AddElementAction(args.getJSONObject(1),args.getString(0),args.getInteger(2));
case MOVE_ELEMENT:
if (args == null) {
return null;
}
return new MoveElementAction(args.getString(0),args.getString(1),args.getInteger(2));
case ADD_EVENT:
if (args == null) {
return null;
}
return new AddEventAction(args.getString(0),args.getString(1));
case REMOVE_EVENT:
if (args == null) {
return null;
}
return new RemoveEventAction(args.getString(0),args.getString(1));
case CREATE_FINISH:
return new CreateFinishAction();
case REFRESH_FINISH:
return new RefreshFinishAction();
case UPDATE_FINISH:
return new UpdateFinishAction();
case SCROLL_TO_ELEMENT:
if (args == null) {
return null;
}
String ref = args.size() >= 1 ? args.getString(0) : null;
JSONObject options = args.size() >= 2 ? args.getJSONObject(1) : null;
return new ScrollToElementAction(ref, options);
case ADD_RULE:
if (args == null) {
return null;
}
return new AddRuleAction(args.getString(0),args.getJSONObject(1));
case GET_COMPONENT_RECT:
if(args == null){
return null;
}
return new GetComponentRectAction(args.getString(0),args.getString(1));
case INVOKE_METHOD:
if(args == null){
return null;
}
return new InvokeMethodAction(args.getString(0),args.getString(1),args.getJSONArray(2));
}
return null;
}