List of usage examples for com.google.gson.stream JsonToken END_OBJECT
JsonToken END_OBJECT
To view the source code for com.google.gson.stream JsonToken END_OBJECT.
Click Source Link
From source file:org.eclipse.thym.core.plugin.registry.CordovaPluginRegistryManager.java
License:Open Source License
private void parseDistDetails(JsonReader reader, RegistryPluginVersion plugin) throws IOException { reader.beginObject();/*from w w w .j a va 2 s.c o m*/ JsonToken token = reader.peek(); while (token != JsonToken.END_OBJECT) { switch (token) { case NAME: String name = reader.nextName(); if ("shasum".equals(name)) { plugin.setShasum(reader.nextString()); break; } if ("tarball".equals(name)) { plugin.setTarball(reader.nextString()); break; } break; default: reader.skipValue(); break; } token = reader.peek(); } reader.endObject(); }
From source file:org.eclipse.thym.core.plugin.registry.CordovaPluginRegistryManager.java
License:Open Source License
private void parseVersions(JsonReader reader, CordovaRegistryPlugin plugin) throws IOException { reader.beginObject();//versions JsonToken token = reader.peek();//from w ww . ja v a 2 s . c o m while (token != JsonToken.END_OBJECT) { switch (token) { case NAME: RegistryPluginVersion version = plugin.new RegistryPluginVersion(); version.setVersionNumber(reader.nextName()); readVersionInfo(reader, version); plugin.addVersion(version); break; default: reader.skipValue(); break; } token = reader.peek(); } reader.endObject(); }
From source file:org.eclipse.thym.core.plugin.registry.CordovaPluginRegistryManager.java
License:Open Source License
private void parseLatestVersion(JsonReader reader, CordovaRegistryPlugin plugin) throws IOException { reader.beginObject();//from ww w .j a va2s . c om JsonToken token = reader.peek(); while (token != JsonToken.END_OBJECT) { switch (token) { case NAME: String tag = reader.nextName(); if ("latest".equals(tag)) { plugin.setLatestVersion(reader.nextString()); } break; default: reader.skipValue(); break; } token = reader.peek(); } reader.endObject(); }
From source file:org.immutables.gson.stream.JsonParserReader.java
License:Apache License
private static JsonToken toGsonToken(com.fasterxml.jackson.core.JsonToken token) { switch (token) { case START_ARRAY: return JsonToken.BEGIN_ARRAY; case END_ARRAY: return JsonToken.END_ARRAY; case START_OBJECT: return JsonToken.BEGIN_OBJECT; case END_OBJECT: return JsonToken.END_OBJECT; case FIELD_NAME: return JsonToken.NAME; case VALUE_FALSE: return JsonToken.BOOLEAN; case VALUE_TRUE: return JsonToken.BOOLEAN; case VALUE_NULL: return JsonToken.NULL; case VALUE_NUMBER_INT: return JsonToken.NUMBER; case VALUE_NUMBER_FLOAT: return JsonToken.NUMBER; case VALUE_STRING: return JsonToken.STRING; default: // Not semantically equivalent return JsonToken.NULL; }/* ww w. ja v a 2s. c o m*/ }
From source file:org.immutables.mongo.bson4gson.BsonReader.java
License:Apache License
@Override public JsonToken peek() throws IOException { switch (state()) { case INITIAL: case SCOPE_DOCUMENT: case TYPE:/*from w w w . ja v a2s.c o m*/ advance(); return toGsonToken(delegate.getCurrentBsonType()); case NAME: return JsonToken.NAME; case END_OF_DOCUMENT: return JsonToken.END_OBJECT; case END_OF_ARRAY: return JsonToken.END_ARRAY; case DONE: return JsonToken.END_DOCUMENT; case VALUE: return toGsonToken(delegate.getCurrentBsonType()); default: throw new IllegalStateException( "Unexpected state: " + state() + " currentType:" + delegate.getCurrentBsonType()); } }
From source file:org.jboss.tools.aerogear.hybrid.core.plugin.registry.CordovaPluginRegistryManager.java
License:Open Source License
private void parseDistDetails(JsonReader reader, CordovaRegistryPluginVersion plugin) throws IOException { reader.beginObject();/* w w w .j a v a 2 s . co m*/ JsonToken token = reader.peek(); while (token != JsonToken.END_OBJECT) { switch (token) { case NAME: String name = reader.nextName(); if ("shasum".equals(name)) { plugin.setDistributionSHASum(reader.nextString()); break; } if ("tarball".equals(name)) { plugin.setDistributionTarball(reader.nextString()); break; } break; default: reader.skipValue(); break; } token = reader.peek(); } reader.endObject(); }
From source file:org.jboss.tools.aerogear.hybrid.core.plugin.registry.CordovaPluginRegistryManager.java
License:Open Source License
private void parseDetailedVersions(JsonReader reader, CordovaRegistryPlugin plugin) throws IOException { reader.beginObject();//versions JsonToken token = reader.peek();/*from w w w .j av a2 s .c o m*/ while (token != JsonToken.END_OBJECT) { switch (token) { case NAME: CordovaRegistryPluginVersion version = new CordovaRegistryPluginVersion(); version.setVersionNumber(reader.nextName()); readPluginInfo(reader, version); plugin.addVersion(version); break; default: reader.skipValue(); break; } token = reader.peek(); } reader.endObject(); }
From source file:org.jboss.tools.aerogear.hybrid.core.plugin.registry.CordovaPluginRegistryManager.java
License:Open Source License
private void parseLatestVersion(JsonReader reader, CordovaRegistryPluginInfo plugin) throws IOException { reader.beginObject();// w w w . j ava 2s.c om JsonToken token = reader.peek(); while (token != JsonToken.END_OBJECT) { switch (token) { case NAME: String tag = reader.nextName(); if ("latest".equals(tag)) { plugin.setLatestVersion(reader.nextString()); } break; default: reader.skipValue(); break; } token = reader.peek(); } reader.endObject(); }
From source file:org.jetbrains.io.JsonReaderEx.java
License:Apache License
/** * Returns the type of the next token without consuming it. *//*from w ww.ja v a 2 s.c om*/ public JsonToken peek() { int p = peeked; if (p == PEEKED_NONE) { p = doPeek(); } switch (p) { case PEEKED_BEGIN_OBJECT: return JsonToken.BEGIN_OBJECT; case PEEKED_END_OBJECT: return JsonToken.END_OBJECT; case PEEKED_BEGIN_ARRAY: return JsonToken.BEGIN_ARRAY; case PEEKED_END_ARRAY: return JsonToken.END_ARRAY; case PEEKED_SINGLE_QUOTED_NAME: case PEEKED_DOUBLE_QUOTED_NAME: case PEEKED_UNQUOTED_NAME: return JsonToken.NAME; case PEEKED_TRUE: case PEEKED_FALSE: return JsonToken.BOOLEAN; case PEEKED_NULL: return JsonToken.NULL; case PEEKED_SINGLE_QUOTED: case PEEKED_DOUBLE_QUOTED: case PEEKED_UNQUOTED: case PEEKED_BUFFERED: return JsonToken.STRING; case PEEKED_LONG: case PEEKED_NUMBER: return JsonToken.NUMBER; case PEEKED_EOF: return JsonToken.END_DOCUMENT; default: throw new AssertionError(); } }
From source file:org.opendaylight.restconf.jersey.providers.JsonToPATCHBodyReader.java
License:Open Source License
/** * Parse one value object of data and saves it to buffer * @param value Buffer to read value object * @param in JsonReader reader/*from w w w.j av a2 s . c o m*/ * @throws IOException */ private void readValueObject(@Nonnull final StringBuffer value, @Nonnull final JsonReader in) throws IOException { in.beginObject(); value.append("{"); while (in.hasNext()) { value.append("\"" + in.nextName() + "\""); value.append(":"); if (in.peek() == JsonToken.STRING) { value.append("\"" + in.nextString() + "\""); } else { if (in.peek() == JsonToken.BEGIN_ARRAY) { in.beginArray(); value.append("["); while (in.hasNext()) { readValueObject(value, in); if (in.peek() != JsonToken.END_ARRAY) { value.append(","); } } in.endArray(); value.append("]"); } else { readValueObject(value, in); } } if (in.peek() != JsonToken.END_OBJECT) { value.append(","); } } in.endObject(); value.append("}"); }