@Override public TimeSeries<Location> read(JsonReader in) throws IOException { if (gson == null) { gson = Vinli.curApp().gson(); } final TimeSeries.Builder<Location> b = new AutoParcel_TimeSeries.Builder<Location>().type(TIME_SERIES_TYPE); in.beginObject(); while (in.hasNext()) { final String name = in.nextName(); switch (name) { case "meta": b.meta(gson.<TimeSeries.Meta>fromJson(in, TimeSeries.Meta.class)); break; case "locations": in.beginObject(); while (in.hasNext()) { final String locName = in.nextName(); switch (locName) { case "type": in.skipValue(); break; case "features": final List<Location> locations = new ArrayList<>(); in.beginArray(); while (in.hasNext()) { locations.add(gson.<Location>fromJson(in, Location.class)); } in.endArray(); b.items(locations); break; default: throw new JsonParseException( "unrecognized key '" + locName + "' while parsing locations"); } } in.endObject(); break; default: throw new JsonParseException("unrecognized key '" + name + "' while parsing locations"); } } in.endObject(); return b.build(); }
public Map<K, V> a(JsonReader paramJsonReader) throws IOException { Object localObject = paramJsonReader.peek(); if (localObject == JsonToken.NULL) { paramJsonReader.nextNull(); return null; } Map localMap = (Map) d.a(); if (localObject == JsonToken.BEGIN_ARRAY) { paramJsonReader.beginArray(); while (paramJsonReader.hasNext()) { paramJsonReader.beginArray(); localObject = b.b(paramJsonReader); if (localMap.put(localObject, c.b(paramJsonReader)) != null) { throw new JsonSyntaxException("duplicate key: " + localObject); } paramJsonReader.endArray(); } paramJsonReader.endArray(); return localMap; } paramJsonReader.beginObject(); while (paramJsonReader.hasNext()) { d.INSTANCE.promoteNameToValue(paramJsonReader); localObject = b.b(paramJsonReader); if (localMap.put(localObject, c.b(paramJsonReader)) != null) { throw new JsonSyntaxException("duplicate key: " + localObject); } } paramJsonReader.endObject(); return localMap; }
@Override public T read(JsonReader in) throws IOException { if (in.peek() == JsonToken.NULL) { in.nextNull(); return null; } T instance = constructor.construct(); try { in.beginObject(); while (in.hasNext()) { String name = in.nextName(); BoundField field = boundFields.get(name); if (field == null || !field.deserialized) { in.skipValue(); } else { field.read(in, instance); } } } catch (IllegalStateException e) { throw new JsonSyntaxException(e); } catch (IllegalAccessException e) { throw new AssertionError(e); } in.endObject(); return instance; }
@Override public Date read(JsonReader jsonReader) throws IOException { if (jsonReader.peek() == JsonToken.NULL) { jsonReader.nextNull(); return null; } Date date = null; // while(jsonReader.hasNext()) { if (jsonReader.peek().equals(JsonToken.BEGIN_OBJECT)) { jsonReader.beginObject(); while (!jsonReader.peek().equals(JsonToken.END_OBJECT)) { JsonToken token = jsonReader.peek(); switch (token) { case NAME: if (jsonReader.nextName().equals("$date")) { date = getDateFromString(jsonReader.nextString()); } break; default: jsonReader.skipValue(); } } jsonReader.endObject(); } // } return date; }
private Dependency readDependency(JsonReader in) throws IOException { DefaultDependency dep = new DefaultDependency(); in.beginObject(); while (in.hasNext()) { String name = in.nextName(); switch (name) { case PACKAGE_PROPERTY: dep.setPackage(in.nextString()); break; case VERSION_PROPERTY: dep.setVersion(in.nextString()); break; case DEPENDNCY_OP_PROPERTY: dep.setDependencyOperator(RelationOperator.valueOf(in.nextString())); break; case ALTERNATIVES_PROPERTY: in.beginArray(); while (in.hasNext()) { dep.getAlternatives().add(readDependency(in)); } in.endArray(); break; default: in.skipValue(); break; } } in.endObject(); return dep; }
@Override public StringFilter read(JsonReader reader) throws IOException { StringFilter result = null; // reset instance state this.type = null; this.delegate = null; reader.beginObject(); while (reader.peek() != JsonToken.END_OBJECT) { String name = reader.nextName(); try { if (this.delegate != null) { this.delegate.parseValue(reader, name); } else { parseValue(reader, name); } } catch (Exception ex) { LOG.error(ex.getMessage(), ex); throw new IOException(ex); } } reader.endObject(); if (this.type != null) { try { if (this.delegate != null) { result = this.delegate.createInstance(this.type); } else { result = createInstance(this.type); } } catch (Exception ex) { LOG.error(ex.getMessage(), ex); throw new IOException(ex.toString()); } } return result; }
@Override public Calendar read(JsonReader in) throws IOException { if (in.peek() == JsonToken.NULL) { in.nextNull(); return null; } in.beginObject(); int year = 0; int month = 0; int dayOfMonth = 0; int hourOfDay = 0; int minute = 0; int second = 0; while (in.peek() != JsonToken.END_OBJECT) { String name = in.nextName(); int value = in.nextInt(); if (YEAR.equals(name)) { year = value; } else if (MONTH.equals(name)) { month = value; } else if (DAY_OF_MONTH.equals(name)) { dayOfMonth = value; } else if (HOUR_OF_DAY.equals(name)) { hourOfDay = value; } else if (MINUTE.equals(name)) { minute = value; } else if (SECOND.equals(name)) { second = value; } } in.endObject(); return new GregorianCalendar(year, month, dayOfMonth, hourOfDay, minute, second); }
@Override public QuestTaskLocation.Location read(JsonReader in) throws IOException { in.beginObject(); QuestTaskLocation.Location result = ((QuestTaskLocation) TASK).new Location(); while (in.hasNext()) { String name = in.nextName(); if (name.equalsIgnoreCase(NAME)) { ReflectionHelper.setPrivateValue( QuestTaskLocation.Location.class, result, in.nextString(), NAME); } else if (name.equalsIgnoreCase(X)) { result.setX(in.nextInt()); } else if (name.equalsIgnoreCase(Y)) { result.setY(in.nextInt()); } else if (name.equalsIgnoreCase(Z)) { result.setZ(in.nextInt()); } else if (name.equalsIgnoreCase(DIM)) { result.setDimension(in.nextInt()); } else if (name.equalsIgnoreCase(RADIUS)) { result.setRadius(in.nextInt()); } else if (name.equalsIgnoreCase(ICON)) { ReflectionHelper.setPrivateValue( QuestTaskLocation.Location.class, result, MinecraftAdapter.ITEM_STACK.read(in), ICON); } else if (name.equalsIgnoreCase(VISIBLE)) { result.setVisible(QuestTaskLocation.Visibility.valueOf(in.nextString())); } } in.endObject(); return result; }
public static Set<String> fromString(String str) { TreeSet<String> result = new TreeSet<String>(); if (str == null || str.isEmpty()) { return result; } try { JsonReader reader = new JsonReader(new StringReader(str)); reader.beginObject(); while (reader.hasNext()) { String key = reader.nextName(); if (JSON_STARRED_SESSIONS_KEY.equals(key)) { reader.beginArray(); while (reader.hasNext()) { result.add(reader.nextString()); } reader.endArray(); } else { reader.skipValue(); } } reader.endObject(); reader.close(); } catch (Exception ex) { Log.w(TAG, "Ignoring invalid remote content.", ex); return null; } return result; }
@Override public QuestTaskReputation.ReputationSetting read(JsonReader in) throws IOException { in.beginObject(); Reputation reputation = null; int low = Integer.MIN_VALUE, high = Integer.MIN_VALUE; boolean inverted = false; while (in.hasNext()) { String name = in.nextName(); if (name.equalsIgnoreCase(REPUTATION)) { reputation = Reputation.getReputation(in.nextInt()); } else if (name.equalsIgnoreCase(UPPER)) { high = in.nextInt(); } else if (name.equalsIgnoreCase(LOWER)) { low = in.nextInt(); } else if (name.equalsIgnoreCase(INVERTED)) { inverted = in.nextBoolean(); } } if (reputation == null) { return null; } ReputationMarker lower = null, upper = null; if (low != Integer.MIN_VALUE) lower = reputation.getMarker(low); if (high != Integer.MIN_VALUE) upper = reputation.getMarker(high); in.endObject(); return new QuestTaskReputation.ReputationSetting(reputation, lower, upper, inverted); }
@Override public QuestTaskItems.ItemRequirement read(JsonReader in) throws IOException { in.beginObject(); ItemStack item = null; Fluid fluid = null; int required = 1; ItemPrecision precision = ItemPrecision.PRECISE; while (in.hasNext()) { String next = in.nextName(); if (next.equalsIgnoreCase(ITEM)) { item = MinecraftAdapter.ITEM_STACK.read(in); } else if (next.equalsIgnoreCase(FLUID)) { fluid = MinecraftAdapter.FLUID.read(in); } else if (next.equalsIgnoreCase(REQUIRED)) { required = in.nextInt(); } else if (next.equalsIgnoreCase(PRECISION)) { ItemPrecision itemPrecision = ItemPrecision.valueOf(in.nextString()); if (itemPrecision != null) { precision = itemPrecision; } } } in.endObject(); QuestTaskItems.ItemRequirement result = null; if (item != null) { result = new QuestTaskItems.ItemRequirement(item, required); } else if (fluid != null) { result = new QuestTaskItems.ItemRequirement(fluid, required); } else { return null; } result.precision = precision; return result; }
@Override public Student read(JsonReader reader) throws IOException { Student student = new Student(); reader.beginObject(); String fieldname = null; while (reader.hasNext()) { JsonToken token = reader.peek(); if (token.equals(JsonToken.NAME)) { // get the current token fieldname = reader.nextName(); } if ("name".equals(fieldname)) { // move to next token token = reader.peek(); student.setName(reader.nextString()); } if ("rollNo".equals(fieldname)) { // move to next token token = reader.peek(); student.setRollNo(reader.nextInt()); } } reader.endObject(); return student; }
@Override public ConnectionCollection read(JsonReader in) throws IOException { ConnectionCollection connectionDetails = new ConnectionCollection(); in.beginObject(); while (in.hasNext() && in.peek() != JsonToken.END_OBJECT) { addDetails(in, connectionDetails); } in.endObject(); return connectionDetails; }
private void jsonReadCont(JsonReader jReader) throws IOException { jReader.beginObject(); assertNotNull("cont1 is missing.", jReader.hasNext()); // Cont dataFromJson = new Cont(jReader.nextName()); jReader.nextName(); jsonReadContElements(jReader); assertFalse("cont shouldn't have other element.", jReader.hasNext()); jReader.endObject(); // return dataFromJson; }
private static Calendar read(JsonReader jsonreader) throws IOException { if (jsonreader.peek() == JsonToken.NULL) { jsonreader.nextNull(); return null; } jsonreader.beginObject(); int k1 = 0; int j1 = 0; int i1 = 0; int l = 0; int k = 0; int j = 0; do { if (jsonreader.peek() == JsonToken.END_OBJECT) { break; } String s = jsonreader.nextName(); int i = jsonreader.nextInt(); if ("year".equals(s)) { k1 = i; } else if ("month".equals(s)) { j1 = i; } else if ("dayOfMonth".equals(s)) { i1 = i; } else if ("hourOfDay".equals(s)) { l = i; } else if ("minute".equals(s)) { k = i; } else if ("second".equals(s)) { j = i; } } while (true); jsonreader.endObject(); return new GregorianCalendar(k1, j1, i1, l, k, j); }
public List<Map<String, Object>> parsePublicTimeline(InputStream inputStream) { List<Map<String, Object>> result = new ArrayList<Map<String, Object>>(); try { JsonReader reader = new JsonReader(new InputStreamReader(inputStream, "UTF-8")); reader.beginArray(); while (reader.hasNext()) { Map<String, Object> map = new HashMap<String, Object>(); reader.beginObject(); while (reader.hasNext()) { String name = reader.nextName(); if ("user".equals(name)) { reader.beginObject(); while (reader.hasNext()) { String name2 = reader.nextName(); map.put("user." + name2, getValue(reader)); } reader.endObject(); } else { map.put(name, getValue(reader)); } } reader.endObject(); result.add(map); } reader.endArray(); } catch (Exception e) { e.printStackTrace(); } return result; }
@Override public JsonSchemaObject read(JsonReader in) throws IOException { in.beginObject(); final JsonSchemaObject object = new JsonSchemaObject(); while (in.peek() == JsonToken.NAME) { final String name = in.nextName(); readSomeProperty(in, name, object); } in.endObject(); myAllObjects.add(object); if (object.getId() != null) { myIds.put(object.getId(), object); } return object; }
public Map<K, V> read(JsonReader in) throws IOException { Map<K, V> result = Maps.newHashMap(); in.beginObject(); while (in.hasNext()) { JsonReaderInternalAccess.INSTANCE.promoteNameToValue(in); K name = keyAdapter.read(in); V value = valueAdapter.read(in); if (value != null) { // If there are repeated keys, overwrite them to only keep the last one result.put(name, value); } } in.endObject(); return ImmutableMap.copyOf(result); }
@Override public QuestSet read(JsonReader in) throws IOException { String name = null, description = null; requirementMapping.clear(); optionMapping.clear(); List<Quest> quests = new ArrayList<Quest>(); in.beginObject(); while (in.hasNext()) { String next = in.nextName(); if (next.equalsIgnoreCase(NAME)) { name = in.nextString(); } else if (next.equalsIgnoreCase(DESCRIPTION)) { description = in.nextString(); } else if (next.equalsIgnoreCase(QUESTS)) { in.beginArray(); QUEST_ID = Quest.size(); while (in.hasNext()) { Quest quest = QUEST_ADAPTER.read(in); if (quest != null) { quests.add(quest); } } in.endArray(); } } in.endObject(); for (QuestSet set : Quest.getQuestSets()) { if (set.getName().equals(name)) { return removeQuests(quests); } } if (name != null && description != null) { QuestSet set = new QuestSet(name, description); Quest.getQuestSets().add(set); SaveHelper.add(SaveHelper.EditType.SET_CREATE); for (Quest quest : quests) { quest.setQuestSet(set); } for (Map.Entry<Quest, List<Integer>> entry : requirementMapping.entrySet()) { for (int i : entry.getValue()) entry.getKey().addRequirement(i); } for (Map.Entry<Quest, List<Integer>> entry : optionMapping.entrySet()) { for (int i : entry.getValue()) entry.getKey().addOptionLink(i); } return set; } return removeQuests(quests); }
@Override public QblECPublicKey read(JsonReader in) throws IOException { QblECPublicKey ecPublicKey = null; if (in.peek() == JsonToken.NULL) { in.nextNull(); return null; } in.beginObject(); if (in.hasNext() && in.nextName().equals("public_key")) { ecPublicKey = new QblECPublicKey(Hex.decode(in.nextString())); } in.endObject(); return ecPublicKey; }
@Override public Quest.ReputationReward read(JsonReader in) throws IOException { in.beginObject(); int rep = 0, val = 0; while (in.hasNext()) { switch (in.nextName()) { case REPUTATION: rep = in.nextInt(); break; case VALUE: val = in.nextInt(); break; } } in.endObject(); Reputation reputation = Reputation.getReputation(rep); return reputation != null ? new Quest.ReputationReward(reputation, val) : null; }
@Override public RepeatInfo read(JsonReader in) throws IOException { RepeatType type = RepeatType.NONE; int days = 0, hours = 0; in.beginObject(); while (in.hasNext()) { switch (in.nextName()) { case TYPE: type = RepeatType.valueOf(in.nextString()); break; case HOURS: hours = in.nextInt(); break; case DAYS: days = in.nextInt(); } } in.endObject(); return new RepeatInfo(type, days, hours); }
@Override public QuestTaskMob.Mob read(JsonReader in) throws IOException { in.beginObject(); QuestTaskMob.Mob result = ((QuestTaskMob) TASK).new Mob(); while (in.hasNext()) { String name = in.nextName(); if (name.equalsIgnoreCase(NAME)) { result.setName(in.nextString()); } else if (name.equalsIgnoreCase(ICON)) { result.setIcon(MinecraftAdapter.ITEM_STACK.read(in)); } else if (name.equalsIgnoreCase(MOB)) { result.setMob(in.nextString()); } else if (name.equalsIgnoreCase(EXACT)) { result.setExact(in.nextBoolean()); } else if (name.equalsIgnoreCase(KILLS)) { result.setCount(in.nextInt()); } } in.endObject(); return result; }
public void addDetails(JsonReader in, ConnectionCollection collection) throws IOException { String detailsName = in.nextName(); in.beginObject(); JsonObject object = new JsonObject(); while (in.hasNext() && in.peek() != JsonToken.END_OBJECT) { String name = in.nextName(); object.addProperty(name, in.nextString()); } String connectionType = object.get("connectionType").getAsString(); ConnectionDefinition details = create( registeredExtensions.getConnectionNames(), detailsName, connectionType, registeredExtensions.getConnectionTypeForName(connectionType), object); details.setConnectionType(connectionType); details.setName(detailsName); in.endObject(); collection.put(detailsName, details); }
/** * {@inheritDoc} * * @see com.google.gson.TypeAdapter#read(com.google.gson.stream.JsonReader) */ @Override public RestQueryRow read(final JsonReader in) throws IOException { final RestQueryRow queryRow = new RestQueryRow(); in.beginObject(); while (in.hasNext()) { final String name = in.nextName(); switch (name) { case RestQueryRow.ROW_LABEL: String[] values = BUILDER.fromJson(in, String[].class); queryRow.setValues(values); break; default: throw new IOException(Messages.getString(UNEXPECTED_JSON_TOKEN, name)); } } in.endObject(); return queryRow; }
@Override public JsonElement read(JsonReader in) throws IOException { switch (in.peek()) { case STRING: return new JsonPrimitive(in.nextString()); case NUMBER: String number = in.nextString(); return new JsonPrimitive(new LazilyParsedNumber(number)); case BOOLEAN: return new JsonPrimitive(in.nextBoolean()); case NULL: in.nextNull(); return JsonNull.INSTANCE; case BEGIN_ARRAY: JsonArray array = new JsonArray(); in.beginArray(); while (in.hasNext()) { array.add(read(in)); } in.endArray(); return array; case BEGIN_OBJECT: JsonObject object = new JsonObject(); in.beginObject(); while (in.hasNext()) { object.add(in.nextName(), read(in)); } in.endObject(); return object; case END_DOCUMENT: case NAME: case END_OBJECT: case END_ARRAY: default: throw new IllegalArgumentException(); } }
@RequestMapping(method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE) public String importData(Reader in, Model m) throws IOException { JsonReader reader = new JsonReader(in); reader.beginObject(); while (reader.hasNext()) { JsonToken tok = reader.peek(); switch (tok) { case NAME: String name = reader.nextName(); if (name.equals(MITREidDataService.MITREID_CONNECT_1_0)) { dataService_1_0.importData(reader); } else if (name.equals(MITREidDataService.MITREID_CONNECT_1_1)) { dataService_1_1.importData(reader); } else if (name.equals(MITREidDataService.MITREID_CONNECT_1_2)) { dataService_1_2.importData(reader); } else if (name.equals(MITREidDataService.MITREID_CONNECT_1_3)) { dataService_1_3.importData(reader); } else { // consume the next bit silently for now logger.debug("Skipping value for " + name); // TODO: write these out? reader.skipValue(); } break; case END_OBJECT: reader.endObject(); break; case END_DOCUMENT: break; } } return "httpCodeView"; }
@Override public Binding read(JsonReader reader) throws IOException { Integer index = null; Object value = null; SqlDataType type = null; while (true) { JsonToken token = reader.peek(); switch (token) { case BEGIN_ARRAY: case END_ARRAY: throw new IllegalArgumentException("arrays are not supported as a binding"); case BEGIN_OBJECT: reader.beginObject(); break; case BOOLEAN: value = reader.nextBoolean(); return new Binding(null, value, null); case END_DOCUMENT: break; case END_OBJECT: reader.endObject(); return new Binding(index, value, type); case NAME: String name = reader.nextName(); if (name.equalsIgnoreCase("index")) { index = reader.nextInt(); } else if (name.equalsIgnoreCase("value")) { switch (reader.peek()) { case BEGIN_ARRAY: case END_ARRAY: throw new IllegalArgumentException("arrays are not supported as a value"); case BEGIN_OBJECT: break; case BOOLEAN: value = reader.nextBoolean(); break; case END_DOCUMENT: break; case END_OBJECT: break; case NAME: break; case NULL: break; case NUMBER: value = readNumber(reader); break; case STRING: value = reader.nextString(); break; default: break; } } else if (name.equalsIgnoreCase("type")) { type = SqlDataType.lookup(reader.nextString()); } break; case NULL: reader.nextNull(); return null; case NUMBER: value = readNumber(reader); return new Binding(null, value, null); case STRING: value = reader.nextString(); return new Binding(null, value, null); default: break; } } }
private void jsonReadContElements(JsonReader jReader) throws IOException { jReader.beginObject(); List<String> loadedLfs = new ArrayList<>(); boolean exceptForDecimal5Raised = false; boolean enumChecked = false; boolean bitsChecked = false; boolean lfdecimal6Checked = false; boolean lfdecimal4Checked = false; boolean lfdecimal3Checked = false; boolean lfdecimal2Checked = false; boolean lfdecimal1Checked = false; boolean lfbool1Checked = false; boolean lfbool2Checked = false; boolean lfstrChecked = false; boolean lfbinaryChecked = false; // boolean lfref1Checked = false; boolean lfemptyChecked = false; boolean lfstr1Checked = false; while (jReader.hasNext()) { String keyName = jReader.nextName(); JsonToken peek = null; try { peek = jReader.peek(); } catch (IOException e) { if (keyName.equals("lfdecimal5")) { exceptForDecimal5Raised = true; } else { assertTrue("Key " + keyName + " has incorrect value for specifed type", false); } } if (keyName.startsWith("lfnint") || keyName.startsWith("lfnuint")) { assertEquals("Key " + keyName + " has incorrect type", JsonToken.NUMBER, peek); try { jReader.nextLong(); } catch (NumberFormatException e) { assertTrue("Key " + keyName + " has incorrect value - " + e.getMessage(), false); } loadedLfs.add(keyName.substring(3)); } else if (keyName.equals("lfstr")) { assertEquals("Key " + keyName + " has incorrect type", JsonToken.STRING, peek); assertEquals("lfstr", jReader.nextString()); lfstrChecked = true; } else if (keyName.equals("lfstr1")) { assertEquals("Key " + keyName + " has incorrect type", JsonToken.STRING, peek); assertEquals("", jReader.nextString()); lfstr1Checked = true; } else if (keyName.equals("lfbool1")) { assertEquals("Key " + keyName + " has incorrect type", JsonToken.BOOLEAN, peek); assertEquals(true, jReader.nextBoolean()); lfbool1Checked = true; } else if (keyName.equals("lfbool2")) { assertEquals("Key " + keyName + " has incorrect type", JsonToken.BOOLEAN, peek); assertEquals(false, jReader.nextBoolean()); lfbool2Checked = true; } else if (keyName.equals("lfbool3")) { assertEquals("Key " + keyName + " has incorrect type", JsonToken.BOOLEAN, peek); assertEquals(false, jReader.nextBoolean()); } else if (keyName.equals("lfdecimal1")) { assertEquals("Key " + keyName + " has incorrect type", JsonToken.NUMBER, peek); assertEquals(new Double(43.32), (Double) jReader.nextDouble()); lfdecimal1Checked = true; } else if (keyName.equals("lfdecimal2")) { assertEquals("Key " + keyName + " has incorrect type", JsonToken.NUMBER, peek); assertEquals(new Double(-0.43), (Double) jReader.nextDouble()); lfdecimal2Checked = true; } else if (keyName.equals("lfdecimal3")) { assertEquals("Key " + keyName + " has incorrect type", JsonToken.NUMBER, peek); assertEquals(new Double(43), (Double) jReader.nextDouble()); lfdecimal3Checked = true; } else if (keyName.equals("lfdecimal4")) { assertEquals("Key " + keyName + " has incorrect type", JsonToken.NUMBER, peek); assertEquals(new Double(43E3), (Double) jReader.nextDouble()); lfdecimal4Checked = true; } else if (keyName.equals("lfdecimal6")) { assertEquals("Key " + keyName + " has incorrect type", JsonToken.NUMBER, peek); assertEquals(new Double(33.12345), (Double) jReader.nextDouble()); lfdecimal6Checked = true; } else if (keyName.equals("lfenum")) { assertEquals("enum3", jReader.nextString()); enumChecked = true; } else if (keyName.equals("lfbits")) { assertEquals("bit3", jReader.nextString()); bitsChecked = true; } else if (keyName.equals("lfbinary")) { assertEquals( "AAaacdabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ%%-#^", jReader.nextString()); lfbinaryChecked = true; } else if (keyName.equals("lfempty")) { jReader.beginArray(); jReader.nextNull(); jReader.endArray(); lfemptyChecked = true; } else if (keyName.startsWith("lfunion")) { checkLfUnion(jReader, keyName, peek); } else { assertTrue("Key " + keyName + " doesn't exists in yang file.", false); } } Collections.sort(loadedLfs); String expectedLfsStr = "[int16Max, int16Min, int32Max, int32Min, int64Max, int64Min, int8Max, int8Min, uint16Max, uint32Max, uint8Max]"; String actualLfsStr = loadedLfs.toString(); assertEquals("Some leaves are missing", expectedLfsStr, actualLfsStr); // assertTrue("For lfdecimal5 wasn't catch error",exceptForDecimal5Raised); assertTrue("Enum wasn't checked", enumChecked); assertTrue("Bits wasn't checked", bitsChecked); assertTrue("Decimal1 wasn't checked", lfdecimal1Checked); assertTrue("Decimal2 wasn't checked", lfdecimal2Checked); assertTrue("Decimal3 wasn't checked", lfdecimal3Checked); assertTrue("Decimal4 wasn't checked", lfdecimal4Checked); assertTrue("Decimal5 wasn't checked", lfdecimal6Checked); assertTrue("lfbool1 wasn't checked", lfbool1Checked); assertTrue("lfbool2 wasn't checked", lfbool2Checked); assertTrue("lfstr wasn't checked", lfstrChecked); assertTrue("lfstr1 wasn't checked", lfstr1Checked); assertTrue("lfbinary wasn't checked", lfbinaryChecked); assertTrue("lfempty wasn't checked", lfemptyChecked); // assertTrue("lfref1 wasn't checked", lfref1Checked); jReader.endObject(); }
private void endObject() throws IOException { jsonReader.endObject(); }