本文整理汇总了Java中com.eclipsesource.json.JsonObject.getInt方法的典型用法代码示例。如果您正苦于以下问题:Java JsonObject.getInt方法的具体用法?Java JsonObject.getInt怎么用?Java JsonObject.getInt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.eclipsesource.json.JsonObject
的用法示例。
在下文中一共展示了JsonObject.getInt方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: Route
import com.eclipsesource.json.JsonObject; //导入方法依赖的package包/类
public Route(JPTI jpti,JsonObject json){
this(jpti);
try{
agencyID=json.getInt(AGENCY_ID,-1);
number=json.getInt(NO,-1);
name=json.getString(NAME,"");
nickName=json.getString(NICKNAME,"");
description=json.getString(DESCRIPTION,"");
type=json.getInt(TYPE,2);
url=json.getString(URL,"");
color=new Color(json.getString(COLOR,"#000000"));
textColor=new Color(json.getString(TEXT_COLOR,""));
JsonArray stationArray=json.get(STATION).asArray();
for(int i=0;i<stationArray.size();i++){
stationList.add(newRouteStation(stationArray.get(i).asObject()));
}
}catch (Exception e){
}
}
示例2: Operation
import com.eclipsesource.json.JsonObject; //导入方法依赖的package包/类
public Operation(JPTI jpti, JsonObject json) {
this.jpti = jpti;
operationName = json.getString(OPERATION_NAME, "");
operationNumber = json.getInt(OPERATION_NO, -1);
calenderID = json.getInt(CALENDER_ID, -1);
JsonArray array = json.get(TRIP_LIST).asArray();
for (int i = 0; i < array.size(); i++) {
JsonObject obj = array.get(i).asObject();
try {
trip.add(jpti.getTrip(obj.getInt(TRIP_ID, -1)));
}catch (Exception e){
SdLog.log(e);
}
}
}
示例3: Station
import com.eclipsesource.json.JsonObject; //导入方法依赖的package包/类
public Station(JPTI jpti, JsonObject json){
this(jpti);
try{
name =json.getString(NAME,"駅名不明");
subName=json.getString(SUBNAME,"");
type=json.getInt(TYPE,0);
description = json.getString(DESCRIPTION, "");
lat=json.getString(LAT,"");
lon=json.getString(LON,"");
url=json.getString(URL,"");
wheelcharBoarding=json.getString(WHEELCHAIR,"");
JsonArray stopArray=json.get(STOP).asArray();
for(int i=0;i<stopArray.size();i++){
stops.add(jpti.getStop(stopArray.get(i).asInt()));
jpti.getStop(stopArray.get(i).asInt()).setStation(this);
}
}catch (Exception e){
e.printStackTrace();
}
}
示例4: Trip
import com.eclipsesource.json.JsonObject; //导入方法依赖的package包/类
public Trip(JPTI jpti, JsonObject json){
this.jpti=jpti;
try{
route=jpti.getRoute(json.getInt(ROUTE,0));
this.traihType=jpti.getTrainType(json.getInt(CLASS,0));
blockID=json.getInt(BLOCK,0);
calender=jpti.calendarList.get(json.getInt(CALENDER,0));
number=json.getString(NUMBER,"");
name=json.getString(NAME,"");
direction=json.getInt(DIRECTION,0);
extraCalendarID=json.getInt(EXTRA_CALENDER,-1);
JsonArray timeArray=json.get(TIME).asArray();
for(int i=0;i<timeArray.size();i++){
Time time=newTime(timeArray.get(i).asObject());
timeList.put(time.getStation(),time);
}
}catch(Exception e){
e.printStackTrace();
}
}
示例5: RouteStation
import com.eclipsesource.json.JsonObject; //导入方法依赖的package包/类
public RouteStation(JPTI jpti, Route route, JsonObject json){
this(jpti,route);
try {
station = jpti.getStation(json.getInt(STATION_ID,0));
km=json.getDouble(KM,-1);
numbering=json.getInt(NUMBERING,-1);
bigStation=json.getInt(TYPE,0)==1;
viewStyle= Integer.parseInt(json.getString(VIEWSTYLE,"0"));
showStopNum= Integer.parseInt(json.getString(SHOW_STOPNUM,"0"));
border=json.getInt(BORDER,0)==1;
}catch(Exception e){
e.printStackTrace();
}
}
示例6: from
import com.eclipsesource.json.JsonObject; //导入方法依赖的package包/类
public static ManifestJson from(JsonObject root) {
ManifestJson manifestJson = new ManifestJson();
MinecraftJson minecraftJson = manifestJson.new MinecraftJson();
JsonObject minecraft = root.get("minecraft").asObject();
minecraftJson.version = minecraft.getString("version", "N/A");
minecraftJson.modLoaders = new ArrayList<>();
JsonArray modLoaders = minecraft.get("modLoaders").asArray();
modLoaders.iterator().forEachRemaining(jsonValue -> {
JsonObject modloader = jsonValue.asObject();
MinecraftJson.ModloaderJson modloaderJson = minecraftJson.new ModloaderJson();
modloaderJson.id = modloader.getString("id", "N/A");
modloaderJson.primary = modloader.getBoolean("primary", false);
minecraftJson.modLoaders.add(modloaderJson);
});
manifestJson.minecraft = minecraftJson;
manifestJson.manifestType = root.getString("manifestType", "N/A");
manifestJson.manifestVersion = root.getInt("manifestVersion", 0);
manifestJson.name = root.getString("name", "N/A");
manifestJson.version = root.getString("version", "N/A");
manifestJson.author = root.getString("author", "N/A");
manifestJson.files = new ArrayList<>();
JsonArray files = root.get("files").asArray();
files.iterator().forEachRemaining(jsonValue -> {
JsonObject file = jsonValue.asObject();
FileJson fileJson = manifestJson.new FileJson();
fileJson.projectID = file.getInt("projectID", 0);
fileJson.fileID = file.getInt("fileID", 0);
fileJson.required = file.getBoolean("required", false);
manifestJson.files.add(fileJson);
});
return manifestJson;
}
示例7: Service
import com.eclipsesource.json.JsonObject; //导入方法依赖的package包/类
public Service(JPTI jpti, JsonObject json){
this(jpti);
try{
name=json.getString(NAME,"");
JsonArray routeArray=json.get(ROUTE).asArray();
for(int i=0;i<routeArray.size();i++){
route.put(jpti.routeList.get(routeArray.get(i).asObject().getInt(ROUTE_ID,0)),routeArray.get(i).asObject().getInt(DIRECTION,0));
}
stationWidth=json.getInt(STATION_WIDTH,7);
trainWidth=json.getInt(TRAIN_WIDTH,5);
startTime=json.getString(START_TIME,"300");
defaulyStationSpace=json.getInt(STATION_SPACING,60);
comment=json.getString(COMMENT,"");
diaTextColor=new Color(Long.decode(json.getString(DIA_TEXT_COLOR,"#000000")).intValue());
diaBackColor=new Color(Long.decode(json.getString(DIA_BACK_COLOR,"#ffffff")).intValue());
diaTrainColor=new Color(Long.decode(json.getString(DIA_TRAIN_COLOR,"#000000")).intValue());
diaAxisColor=new Color(Long.decode(json.getString(DIA_AXICS_COLOR,"#000000")).intValue());
JsonArray timeTableFontArray=json.get(TIMETABLE_FONT).asArray();
for(int i=0;i<timeTableFontArray.size();i++){
timeTableFont.add(new Font(timeTableFontArray.get(i).asObject()));
}
timeTableVFont=new Font(json.get(TIMETABLE_VFONT).asObject());
diaStationFont=new Font(json.get(DIA_STATION_FONT).asObject());
diaTimeFont=new Font(json.get(DIA_TIME_FONT).asObject());
diaTrainFont=new Font(json.get(DIA_TRAIN_FONT).asObject());
commentFont=new Font(json.get(COMMENT_FONT).asObject());
JsonArray trainArray=json.get(TRAIN).asArray();
for(int i=0;i<trainArray.size();i++){
trainList.add(new Train(jpti,this,trainArray.get(i).asObject()));
}
}catch(Exception e){
e.printStackTrace();
}
}
示例8: Time
import com.eclipsesource.json.JsonObject; //导入方法依赖的package包/类
public Time(JPTI jpti, Trip trip, JsonObject json){
this.trip=trip;
this.jpti=jpti;
try {
stop= jpti.stopList.get(json.getInt(STOP_ID,0));
pickupType = json.getInt(PICKUP,1);
dropoffType = json.getInt(DROPOFF,1);
arrivalTime = timeString2Int(json.getString(ARRIVAL_TIME,null));
departureTime = timeString2Int(json.getString(DEPARTURE_TIME,null));
}catch(Exception e){
e.printStackTrace();
}
}
示例9: Stop
import com.eclipsesource.json.JsonObject; //导入方法依赖的package包/类
public Stop(JPTI jpti, JsonObject json){
this.jpti=jpti;
try{
name=json.getString(NAME,"");
description=json.getString(DESCRIPTION,"");
lat=json.getString(LAT,"");
lon=json.getString(LON,"");
zoneID=json.getInt(ZONE_ID,-1);
number=json.getInt(NUMBER,-1);
}catch (Exception e){
e.printStackTrace();
}
}
示例10: Train
import com.eclipsesource.json.JsonObject; //导入方法依赖的package包/类
public Train(JPTI jpti, Service service, JsonObject json){
this.jpti=jpti;
this.service=service;
direct=json.getInt(DIRECT,0);
name=json.getString(NAME,"");
number=json.getString(NUMBER,"");
count=json.getString(COUNT,"");
text=json.getString(TEXT,"");
calendar=jpti.getCalendar(json.getInt(CALENDER,0));
JsonArray tripArray=json.get(TRIP).asArray();
for(int i=0;i<tripArray.size();i++){
tripList.add(jpti.getTrip(tripArray.get(i).asInt()));
}
}
示例11: Font
import com.eclipsesource.json.JsonObject; //导入方法依赖的package包/类
public Font(JsonObject json){
if(json==null){
return;
}
name=json.getString(NAME,null);
height=json.getInt(HEIGHT,9);
bold=json.getInt(BOLD,0)==1;
itaric=json.getInt(ITARIC,0)==1;
}
示例12: parseStack
import com.eclipsesource.json.JsonObject; //导入方法依赖的package包/类
public static ItemStack parseStack(JsonValue js) {
if (js.isString()) {
return new ItemStack(getItem(js.asString()));
} else if (js.isObject()) {
JsonObject obj = js.asObject();
JsonValue id = obj.get("id");
if (id == null)
throw new JsonException("No id");
return new ItemStack(getItem(id.asString()), obj.getInt("count", 1), obj.getInt("meta", 0));
} else if (js.isNull()) {
return null;
}
throw new JsonException("Invalid type " + js.toString());
}
示例13: addBlock
import com.eclipsesource.json.JsonObject; //导入方法依赖的package包/类
public static void addBlock(JsonObject jsB) {
String id = jsB.getString("id", null);
if (id == null)
throw new JsonException("No block id");
int meta = jsB.getInt("meta", 1);
JBlock block = new JBlock(id, meta);
block.textures = parseMetaElement(jsB, "texture", new String[meta][], textureParser);
block.lightLevel = parseMetaElement(jsB, "lightLevel", new Integer[meta], integerParser);
block.transparent = parseMetaElement(jsB, "transparent", new Boolean[meta], booleanParser);
block.drops = parseMetaElement(jsB, "drops", new ItemStackPlaceholder[meta][], itemStackArrayParser);
JsonValue prop;
prop = jsB.get("displayMeta");
addBlockDisplay(prop, block, meta);
prop = jsB.get("mining");
addBlockMining(prop, block);
for (JsonObject.Member member : jsB) {
addBlockSwitch(member);
}
block.jsonFinish();
IDManager.register(block);
}
示例14: copyFromJSONObject
import com.eclipsesource.json.JsonObject; //导入方法依赖的package包/类
public void copyFromJSONObject(JsonObject obj)
{
// Wire protocol fields
this.version = obj.getInt("ver", 1);
this.from = obj.getString("from", "");
this.message = obj.getString("message", "");
this.sign = obj.getString("sign", "");
this.threadID = obj.getString("threadid", "");
this.returnAddress = obj.getString("returnaddress", "");
// Additional fields - may be missing, get default values
this.transactionID = obj.getString("transactionID", "");
this.time = new Date(obj.getLong("time", 0));
this.direction = DIRECTION_TYPE.valueOf(
obj.getString("direction", DIRECTION_TYPE.RECEIVED.toString()));
this.verification = VERIFICATION_TYPE.valueOf(
obj.getString("verification", VERIFICATION_TYPE.UNVERIFIED.toString()));
if (obj.get("isanonymous") != null)
{
this.isAnonymous = obj.getBoolean("isanonymous", false);
} else
{
// Determine from content if it is anonymous
this.isAnonymous = obj.get("threadid") != null;
}
}
示例15: parseStack
import com.eclipsesource.json.JsonObject; //导入方法依赖的package包/类
public static ItemStack parseStack(JsonValue json) {
if (json.isString()) {
return new ItemStack(getItem(json.asString()));
} else if (json.isObject()) {
JsonObject obj = json.asObject();
JsonValue id = obj.get("id");
if (id == null) throw new JsonException("No id");
return new ItemStack(getItem(id.asString()), obj.getInt("count", 1), obj.getInt("meta", 0));
} else if (json.isNull()) {
return null;
}
throw new JsonException("Invalid type " + json.toString());
}