本文整理汇总了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;
}