Package com.google.gson.stream

Examples of com.google.gson.stream.JsonToken


  protected void readData(JsonReaderExt jsonParser) throws IOException {
   
    jsonParser.consumeExpected(JsonToken.BEGIN_OBJECT);
   
    while(jsonParser.hasNext()) {
      JsonToken tokenType = jsonParser.peek();
     
      if(tokenType == JsonToken.NAME) {
        String propertyName = jsonParser.nextName();
       
        if(propertyName.equals("mainPackage")) {
View Full Code Here


    jsonParser.consumeExpected(JsonToken.BEGIN_ARRAY);
   
    ArrayList<DubBundle> bundles = new ArrayList<>();
   
    while(jsonParser.hasNext()) {
      JsonToken tokenType = jsonParser.peek();
     
      if(tokenType == JsonToken.BEGIN_OBJECT) {
        DubBundle bundle = new DubManifestParser().readBundle(jsonParser).createBundle(null, false);
        bundles.add(bundle);
      } else {
View Full Code Here

 
  protected DubManifestParser readBundle(JsonReaderExt jsonReader) throws IOException {
    jsonReader.consumeExpected(JsonToken.BEGIN_OBJECT);
   
    while(jsonReader.hasNext()) {
      JsonToken tokenType = jsonReader.peek();
     
      if(tokenType == JsonToken.NAME) {
        String propertyName = jsonReader.nextName();
       
        if(propertyName.equals("name")) {
View Full Code Here

                jsonReader.beginArray();
                // The Gson parser is a little unintuitive here. Nested objects,
                // have their own relative notion of hasNext; when hasNext()
                // is done, it is only for this array.
                while (jsonReader.hasNext()) {
                    JsonToken jsonToken2 = jsonReader.peek();
                    if (jsonToken2 == JsonToken.STRING) {
                        values.add(jsonReader.nextString());
                    }
                }
                jsonReader.endArray();
View Full Code Here

    NavigationPropertyInfo navigationPropertyInfo = eia.getNavigationPropertyInfo(navigationPropertyName);
    if (navigationPropertyInfo == null) {
      throw new EntityProviderException(EntityProviderException.ILLEGAL_ARGUMENT.addContent(navigationPropertyName));
    }

    JsonToken peek = reader.peek();
    if (peek == JsonToken.BEGIN_OBJECT) {
      reader.beginObject();
      String name = reader.nextName();
      if (FormatJson.DEFERRED.equals(name)) {
        reader.beginObject();
View Full Code Here

    reader.endObject();
    return errorContext;
  }

  private void parseInnerError(final JsonReader reader, final ODataErrorContext errorContext) throws IOException {
    JsonToken token = reader.peek();
    if (token == JsonToken.STRING) {
      // implementation for parse content as provided by JsonErrorDocumentProducer
      String innerError = reader.nextString();
      errorContext.setInnerError(innerError);
    } else if (token == JsonToken.BEGIN_OBJECT) {
View Full Code Here

  private String readJson(final JsonReader reader) throws IOException {
    StringBuilder sb = new StringBuilder();

    while (reader.hasNext()) {
      JsonToken token = reader.peek();
      if (token == JsonToken.NAME) {
        if (sb.length() > 0) {
          sb.append(",");
        }
        String name = reader.nextName();
View Full Code Here

   * @param reader to read from
   * @return the string value or 'null'
   * @throws IOException if an exception occurs
   */
  private String getValue(final JsonReader reader) throws IOException {
    JsonToken token = reader.peek();
    if (JsonToken.NULL == token) {
      reader.skipValue();
      return null;
    }
    return reader.nextString();
View Full Code Here

  private Object readSimpleProperty(final JsonReader reader, final EntityPropertyInfo entityPropertyInfo,
      final Object typeMapping, final EntityProviderReadProperties readProperties)
      throws EdmException, EntityProviderException, IOException {
    final EdmSimpleType type = (EdmSimpleType) entityPropertyInfo.getType();
    Object value = null;
    final JsonToken tokenType = reader.peek();
    if (tokenType == JsonToken.NULL) {
      reader.nextNull();
    } else {
      switch (EdmSimpleTypeKind.valueOf(type.getName())) {
      case Boolean:
View Full Code Here

    }
    return new ODataDeltaFeedImpl(entries, feedMetadata, deletedEntries);
  }

  private void readFeed() throws IOException, EdmException, EntityProviderException {
    JsonToken peek = reader.peek();
    if (peek == JsonToken.BEGIN_ARRAY) {
      readArrayContent();
    } else {
      reader.beginObject();
      final String nextName = reader.nextName();
View Full Code Here

TOP

Related Classes of com.google.gson.stream.JsonToken

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.