List of usage examples for android.util JsonToken NULL
JsonToken NULL
To view the source code for android.util JsonToken NULL.
Click Source Link
From source file:com.example.propertylist.handler.JsonPropertyHandler.java
/** * Populates property data with the JSON data. * * @param reader/* w w w . j a v a 2 s . c o m*/ * the {@link android.util.JsonReader} used to read in the data * @return * the propertyResults * @throws org.json.JSONException * @throws java.io.IOException */ public List<Property> populatePropertySales(JsonReader reader) throws JSONException, IOException { // Property property = new Property(); List<Property> propertyResults = new ArrayList<Property>(); reader.beginObject(); while (reader.hasNext()) { final String name = reader.nextName(); final boolean isNull = reader.peek() == JsonToken.NULL; if (name.equals("result") && !isNull) { propertyResults = populateResultsSales(reader); } else { reader.skipValue(); } } reader.endObject(); return propertyResults; }
From source file:com.example.propertylist.handler.JsonPropertyHandler.java
/** * Populates property data with the JSON data. * * @param reader/*from w ww. j av a 2s . co m*/ * the {@link android.util.JsonReader} used to read in the data * @return * the propertyResults * @throws org.json.JSONException * @throws java.io.IOException */ public List<Property> populateResultsSales(JsonReader reader) throws JSONException, IOException { List<Property> propertyResults = new ArrayList<Property>(); reader.beginObject(); while (reader.hasNext()) { final String name = reader.nextName(); final boolean isNull = reader.peek() == JsonToken.NULL; if (name.equals("results") && !isNull) { propertyResults = populateAdsSales(reader); } else { reader.skipValue(); } } reader.endObject(); return propertyResults; }
From source file:com.example.propertylist.handler.JsonPropertyHandler.java
/** * Populates properties data with the JSON data. * * @param reader/* ww w . j a v a 2s . c o m*/ * the {@link android.util.JsonReader} used to read in the data * @return * the propertyAds * @throws org.json.JSONException * @throws java.io.IOException */ public List<Property> populateAdsSales(JsonReader reader) throws JSONException, IOException { List<Property> propertyAds = new ArrayList<Property>(); reader.beginObject(); while (reader.hasNext()) { final String name = reader.nextName(); final boolean isNull = reader.peek() == JsonToken.NULL; if (name.equals("ads") && !isNull) { propertyAds = parseDataArray(reader); } else { reader.skipValue(); } } reader.endObject(); return propertyAds; }
From source file:com.example.propertylist.handler.JsonPropertyHandler.java
/** * Loads the next observation into the property class. * * @param reader/* ww w .jav a 2 s .c o m*/ * the {@link android.util.JsonReader} containing the observation * @throws java.io.IOException */ private Property parseSalesData(JsonReader reader) throws IOException { Property property = new Property(); reader.beginObject(); while (reader.hasNext()) { String name = reader.nextName(); if (name.equals("full_address") && reader.peek() != JsonToken.NULL) { property.setFullAddress(reader.nextString()); } else if (name.equals("daft_url") && reader.peek() != JsonToken.NULL) { property.setDaftPropertyUrl(reader.nextString()); } else if (name.equals("description") && reader.peek() != JsonToken.NULL) { property.setDescription(reader.nextString()); } else if (name.equals("small_thumbnail_url") && reader.peek() != JsonToken.NULL) { property.setThumbnailUrl(reader.nextString()); } else if (name.equals("medium_thumbnail_url") && reader.peek() != JsonToken.NULL) { property.setMediumThumbnailUrl(reader.nextString()); } else if (name.equals("large_thumbnail_url") && reader.peek() != JsonToken.NULL) { property.setLargeThumbnailUrl(reader.nextString()); } else { reader.skipValue(); } // end if hasnext } // end while reader.endObject(); return property; }
From source file:pedromendes.tempodeespera.HospitalDetailActivity.java
private void readEmergency(JsonReader reader, Emergency hospitalEmergencyDetail) throws IOException { while (reader.hasNext()) { String fieldDame = reader.nextName(); if (fieldDame.equals("Emergency")) { reader.beginObject();/*w ww. ja v a 2 s. c o m*/ reader.nextName(); reader.nextString(); reader.nextName(); hospitalEmergencyDetail.setDescription(reader.nextString()); reader.endObject(); } else if (fieldDame.equals("Queue") && reader.peek() != JsonToken.NULL) { reader.beginObject(); reader.nextName(); reader.nextString(); reader.nextName(); hospitalEmergencyDetail.setName(reader.nextString()); reader.endObject(); } else if (fieldDame.equals("Red")) { reader.beginObject(); fillQueue(reader, hospitalEmergencyDetail.getRedQueue()); reader.endObject(); } else if (fieldDame.equals("Orange")) { reader.beginObject(); fillQueue(reader, hospitalEmergencyDetail.getOrangeQueue()); reader.endObject(); } else if (fieldDame.equals("Yellow")) { reader.beginObject(); fillQueue(reader, hospitalEmergencyDetail.getYellowQueue()); reader.endObject(); } else if (fieldDame.equals("Green")) { reader.beginObject(); fillQueue(reader, hospitalEmergencyDetail.getGreenQueue()); reader.endObject(); } else if (fieldDame.equals("Blue")) { reader.beginObject(); fillQueue(reader, hospitalEmergencyDetail.getBlueQueue()); reader.endObject(); } else if (fieldDame.equals("LastUpdate")) { hospitalEmergencyDetail.setLastUpdate(reader.nextString()); } else { reader.skipValue(); } } }
From source file:com.workday.autoparse.json.parser.JsonParserUtils.java
/** * If the next value is {@link JsonToken#NULL}, consume it and return {@code true}. Otherwise * return {@code false}.//w ww. ja v a2 s . co m */ public static boolean handleNull(JsonReader reader) throws IOException { if (reader.peek() == JsonToken.NULL) { reader.nextNull(); return true; } return false; }