Java Code Examples for com.fasterxml.jackson.core.JsonToken#END_ARRAY

The following examples show how to use com.fasterxml.jackson.core.JsonToken#END_ARRAY . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DirectionDeserializer.java    From swagger-inflector with Apache License 2.0 6 votes vote down vote up
@Override
public Set<Configuration.Direction> deserialize(JsonParser jp,
        DeserializationContext ctxt) throws IOException {
    final JsonToken token = jp.getCurrentToken();
    if (token == JsonToken.VALUE_FALSE) {
        return EnumSet.noneOf(Configuration.Direction.class);
    } else if (token == JsonToken.VALUE_TRUE) {
        return EnumSet.allOf(Configuration.Direction.class);
    } else if (token == JsonToken.START_ARRAY) {
        final Set<Configuration.Direction> items = EnumSet.noneOf(Configuration.Direction.class);
        while (true) {
            final JsonToken next = jp.nextToken();
            if (next == JsonToken.VALUE_STRING) {
                final String name = jp.getText();
                items.add(Configuration.Direction.valueOf(name));
            } else if (next == JsonToken.END_ARRAY) {
                return items;
            } else {
                break;
            }
        }
    }
    throw ctxt.mappingException(Configuration.Direction.class);
}
 
Example 2
Source File: BuildFilePythonResultDeserializer.java    From buck with Apache License 2.0 6 votes vote down vote up
private static List<Object> deserializeList(JsonParser jp) throws IOException {
  ImmutableList.Builder<Object> builder = ImmutableList.builder();
  JsonToken token;
  while ((token = jp.nextToken()) != JsonToken.END_ARRAY) {
    Object obj = deserializeRecursive(jp, token);
    if (obj != null) {
      builder.add(obj);
    }
    else {
      // null elements can't be added to ImmutableList, an NPE will be thrown.
      // Throw a meaningful exception here instead.
      StringBuilder message = new StringBuilder();
      message.append("null value can't be added to [");
      for (Object element: builder.build()) {
        message.append("'").append(element).append("'").append(", ");
      }
      message.append("]");
      throw new IllegalArgumentException(message.toString());
    }
  }
  if (token != JsonToken.END_ARRAY) {
    throw new JsonParseException(jp, "Missing expected END_ARRAY");
  }
  return builder.build();
}
 
Example 3
Source File: GuavaMultisetDeserializer.java    From jackson-datatypes-collections with Apache License 2.0 6 votes vote down vote up
@Override
protected T _deserializeContents(JsonParser p, DeserializationContext ctxt) throws IOException,
        JsonProcessingException {
    JsonDeserializer<?> valueDes = _valueDeserializer;
    JsonToken t;
    final TypeDeserializer typeDeser = _valueTypeDeserializer;
    T set = createMultiset();

    while ((t = p.nextToken()) != JsonToken.END_ARRAY) {
        Object value;

        if (t == JsonToken.VALUE_NULL) {
            if (_skipNullValues) {
                continue;
            }
            value = _nullProvider.getNullValue(ctxt);
        } else if (typeDeser == null) {
            value = valueDes.deserialize(p, ctxt);
        } else {
            value = valueDes.deserializeWithType(p, ctxt, typeDeser);
        }
        set.add(value);
    }
    return set;
}
 
Example 4
Source File: DataBinderDeserializer.java    From gvnix with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Deserializes JSON array into Map<String, String> format to use it in a
 * Spring {@link DataBinder}.
 * <p/>
 * Iterate over every array's item to generate a prefix for property names
 * on DataBinder style (
 * <em>{prefix}[{index}].<em>) and delegates on {@link #readField(JsonParser, DeserializationContext, JsonToken, String)}
 * 
 * @param parser JSON parser
 * @param ctxt context
 * @param prefix array dataBinder path
 * @return
 * @throws IOException
 * @throws JsonProcessingException
 */
protected Map<String, String> readArray(JsonParser parser,
        DeserializationContext ctxt, String prefix) throws IOException,
        JsonProcessingException {
    JsonToken t = parser.getCurrentToken();

    if (t == JsonToken.START_ARRAY) {
        t = parser.nextToken();
        // Skip it to locate on first array data token
    }

    // Deserialize array properties
    int i = 0;
    Map<String, String> deserObj = new HashMap<String, String>();
    for (; t != JsonToken.END_ARRAY; t = parser.nextToken()) {
        // Property name must include prefix this way:
        // degrees[0].description
        Map<String, String> field = readField(parser, ctxt, t, prefix
                .concat("[").concat(Integer.toString(i++)).concat("]."));
        deserObj.putAll(field);
    }
    return deserObj;
}
 
Example 5
Source File: SnapshotParser.java    From synapse with Apache License 2.0 5 votes vote down vote up
private ChannelPosition processSequenceNumbers(final JsonParser parser) throws IOException {
    final ImmutableMap.Builder<String, ShardPosition> shardPositions = builder();

    String shardName = null;
    String sequenceNumber = null;
    while (parser.nextToken() != JsonToken.END_ARRAY) {
        JsonToken currentToken = parser.currentToken();
        switch (currentToken) {
            case FIELD_NAME:
                switch (parser.getValueAsString()) {
                    case "shard":
                        parser.nextToken();
                        shardName = parser.getValueAsString();
                        break;
                    case "sequenceNumber":
                        parser.nextToken();
                        sequenceNumber = parser.getValueAsString();
                        break;
                    default:
                        break;
                }
                break;
            case END_OBJECT:
                if (shardName != null) {
                    // TODO: "0" kann entfernt werden, wenn keine Snapshots mit "0" für HORIZON mehr exisiteren.
                    final ShardPosition shardPosition = sequenceNumber != null && !sequenceNumber.equals("0") && !sequenceNumber.equals("")
                            ? fromPosition(shardName, sequenceNumber)
                            : fromHorizon(shardName);
                    shardPositions.put(shardName, shardPosition);
                }
                shardName = null;
                sequenceNumber = null;
                break;
            default:
                break;
        }
    }
    return channelPosition(shardPositions.build().values());
}
 
Example 6
Source File: HollowJsonAdapter.java    From hollow with Apache License 2.0 5 votes vote down vote up
private int addStructuredMap(JsonParser parser, FlatRecordWriter flatRecordWriter, String mapTypeName, HollowMapWriteRecord mapRec) throws IOException {
    JsonToken token = parser.nextToken();
    mapRec.reset();

    HollowMapSchema schema = (HollowMapSchema) hollowSchemas.get(mapTypeName);

    while(token != JsonToken.END_ARRAY) {
        if(token == JsonToken.START_OBJECT) {
            int keyOrdinal = -1, valueOrdinal = -1;
            while(token != JsonToken.END_OBJECT) {

                if(token == JsonToken.START_OBJECT || token == JsonToken.START_ARRAY) {
                    if("key".equals(parser.getCurrentName()))
                        keyOrdinal = parseSubType(parser, flatRecordWriter, token, schema.getKeyType());
                    else if("value".equals(parser.getCurrentName()))
                        valueOrdinal = parseSubType(parser, flatRecordWriter, token, schema.getValueType());
                }

                token = parser.nextToken();
            }

            mapRec.addEntry(keyOrdinal, valueOrdinal);
        }

        token = parser.nextToken();
    }

    return addRecord(schema.getName(), mapRec, flatRecordWriter);
}
 
Example 7
Source File: JsonImportReader.java    From apiman with Apache License 2.0 5 votes vote down vote up
public void readPlanVersions() throws Exception {
    current = nextToken();
    if (current == JsonToken.END_ARRAY) {
        return;
    }
    while (nextToken() != JsonToken.END_ARRAY) {
        // Traverse each plan definition
        while(nextToken() != JsonToken.END_OBJECT) {
            if (jp.getCurrentName().equals(PlanVersionBean.class.getSimpleName())) {
                current = nextToken();
                PlanVersionBean planBean = jp.readValueAs(PlanVersionBean.class);
                dispatcher.planVersion(planBean);
            } else {
                OrgElementsEnum fieldName = OrgElementsEnum.valueOf(jp.getCurrentName());
                current = nextToken();
                switch (fieldName) {
                case Policies:
                    processEntities(PolicyBean.class, new EntityHandler<PolicyBean>() {
                        @Override
                        public void handleEntity(PolicyBean policy) throws Exception {
                            dispatcher.planPolicy(policy);
                        }
                    });
                    break;
                default:
                    throw new RuntimeException("Unhandled entity " + fieldName + " with token " + current);
                }
            }
        }
    }
}
 
Example 8
Source File: BindBean2SharedPreferences.java    From kripton with Apache License 2.0 5 votes vote down vote up
/**
 * for attribute valueCharTypeArray parsing
 */
protected char[] parseValueCharTypeArray(String input) {
  if (input==null) {
    return null;
  }
  KriptonJsonContext context=KriptonBinder.jsonBind();
  try (JacksonWrapperParser wrapper=context.createParser(input)) {
    JsonParser jacksonParser=wrapper.jacksonParser;
    // START_OBJECT
    jacksonParser.nextToken();
    // value of "element"
    jacksonParser.nextValue();
    char[] result=null;
    if (jacksonParser.currentToken()==JsonToken.START_ARRAY) {
      ArrayList<Character> collection=new ArrayList<>();
      Character item=null;
      while (jacksonParser.nextToken() != JsonToken.END_ARRAY) {
        if (jacksonParser.currentToken()==JsonToken.VALUE_NULL) {
          item=null;
        } else {
          item=Character.valueOf((char)jacksonParser.getIntValue());
        }
        collection.add(item);
      }
      result=CollectionUtils.asCharacterTypeArray(collection);
    }
    return result;
  } catch(Exception e) {
    e.printStackTrace();
    throw(new KriptonRuntimeException(e.getMessage()));
  }
}
 
Example 9
Source File: BindBean63SharedPreferences.java    From kripton with Apache License 2.0 5 votes vote down vote up
/**
 * for attribute valueMapEnumByte parsing
 */
protected HashMap<EnumType, Byte> parseValueMapEnumByte(String input) {
  if (input==null) {
    return null;
  }
  KriptonJsonContext context=KriptonBinder.jsonBind();
  try (JacksonWrapperParser wrapper=context.createParser(input)) {
    JsonParser jacksonParser=wrapper.jacksonParser;
    // START_OBJECT
    jacksonParser.nextToken();
    // value of "element"
    jacksonParser.nextValue();
    HashMap<EnumType, Byte> result=null;
    if (jacksonParser.currentToken()==JsonToken.START_ARRAY) {
      HashMap<EnumType, Byte> collection=new HashMap<>();
      EnumType key=null;
      Byte value=null;
      while (jacksonParser.nextToken() != JsonToken.END_ARRAY) {
        jacksonParser.nextValue();
         {
          String tempEnum=jacksonParser.getText();
          key=StringUtils.hasText(tempEnum)?EnumType.valueOf(tempEnum):null;
        }
        jacksonParser.nextValue();
        if (jacksonParser.currentToken()!=JsonToken.VALUE_NULL) {
          value=jacksonParser.getByteValue();
        }
        collection.put(key, value);
        key=null;
        value=null;
        jacksonParser.nextToken();
      }
      result=collection;
    }
    return result;
  } catch(Exception e) {
    throw(new KriptonRuntimeException(e.getMessage()));
  }
}
 
Example 10
Source File: Bean2Table.java    From kripton with Apache License 2.0 5 votes vote down vote up
/**
 * for attribute valueCharacterSet parsing
 */
public static Set<Character> parseValueCharacterSet(byte[] input) {
  if (input==null) {
    return null;
  }
  KriptonJsonContext context=KriptonBinder.jsonBind();
  try (JacksonWrapperParser wrapper=context.createParser(input)) {
    JsonParser jacksonParser=wrapper.jacksonParser;
    // START_OBJECT
    jacksonParser.nextToken();
    // value of "element"
    jacksonParser.nextValue();
    Set<Character> result=null;
    if (jacksonParser.currentToken()==JsonToken.START_ARRAY) {
      HashSet<Character> collection=new HashSet<>();
      Character item=null;
      while (jacksonParser.nextToken() != JsonToken.END_ARRAY) {
        if (jacksonParser.currentToken()==JsonToken.VALUE_NULL) {
          item=null;
        } else {
          item=Character.valueOf((char)jacksonParser.getIntValue());
        }
        collection.add(item);
      }
      result=collection;
    }
    return result;
  } catch(Exception e) {
    e.printStackTrace();
    throw(new KriptonRuntimeException(e.getMessage()));
  }
}
 
Example 11
Source File: CountryTable.java    From kripton with Apache License 2.0 5 votes vote down vote up
/**
 * for attribute translatedName parsing
 */
public static Map<Translation, String> parseTranslatedName(byte[] input) {
  if (input==null) {
    return null;
  }
  KriptonJsonContext context=KriptonBinder.jsonBind();
  try (JacksonWrapperParser wrapper=context.createParser(input)) {
    JsonParser jacksonParser=wrapper.jacksonParser;
    // START_OBJECT
    jacksonParser.nextToken();
    // value of "element"
    jacksonParser.nextValue();
    Map<Translation, String> result=null;
    if (jacksonParser.currentToken()==JsonToken.START_ARRAY) {
      HashMap<Translation, String> collection=new HashMap<>();
      Translation key=null;
      String value=null;
      while (jacksonParser.nextToken() != JsonToken.END_ARRAY) {
        jacksonParser.nextValue();
         {
          String tempEnum=jacksonParser.getText();
          key=StringUtils.hasText(tempEnum)?Translation.valueOf(tempEnum):null;
        }
        jacksonParser.nextValue();
        if (jacksonParser.currentToken()!=JsonToken.VALUE_NULL) {
          value=jacksonParser.getText();
        }
        collection.put(key, value);
        key=null;
        value=null;
        jacksonParser.nextToken();
      }
      result=collection;
    }
    return result;
  } catch(Exception e) {
    e.printStackTrace();
    throw(new KriptonRuntimeException(e.getMessage()));
  }
}
 
Example 12
Source File: ShortBeanTable.java    From kripton with Apache License 2.0 5 votes vote down vote up
/**
 * for attribute value2 parsing
 */
public static Short[] parseValue2(byte[] input) {
  if (input==null) {
    return null;
  }
  KriptonJsonContext context=KriptonBinder.jsonBind();
  try (JacksonWrapperParser wrapper=context.createParser(input)) {
    JsonParser jacksonParser=wrapper.jacksonParser;
    // START_OBJECT
    jacksonParser.nextToken();
    // value of "element"
    jacksonParser.nextValue();
    Short[] result=null;
    if (jacksonParser.currentToken()==JsonToken.START_ARRAY) {
      ArrayList<Short> collection=new ArrayList<>();
      Short item=null;
      while (jacksonParser.nextToken() != JsonToken.END_ARRAY) {
        if (jacksonParser.currentToken()==JsonToken.VALUE_NULL) {
          item=null;
        } else {
          item=jacksonParser.getShortValue();
        }
        collection.add(item);
      }
      result=CollectionUtils.asShortArray(collection);
    }
    return result;
  } catch(Exception e) {
    e.printStackTrace();
    throw(new KriptonRuntimeException(e.getMessage()));
  }
}
 
Example 13
Source File: StringBeanTable.java    From kripton with Apache License 2.0 5 votes vote down vote up
/**
 * for attribute value2 parsing
 */
public static String[] parseValue2(byte[] input) {
  if (input==null) {
    return null;
  }
  KriptonJsonContext context=KriptonBinder.jsonBind();
  try (JacksonWrapperParser wrapper=context.createParser(input)) {
    JsonParser jacksonParser=wrapper.jacksonParser;
    // START_OBJECT
    jacksonParser.nextToken();
    // value of "element"
    jacksonParser.nextValue();
    String[] result=null;
    if (jacksonParser.currentToken()==JsonToken.START_ARRAY) {
      ArrayList<String> collection=new ArrayList<>();
      String item=null;
      while (jacksonParser.nextToken() != JsonToken.END_ARRAY) {
        if (jacksonParser.currentToken()==JsonToken.VALUE_NULL) {
          item=null;
        } else {
          item=jacksonParser.getText();
        }
        collection.add(item);
      }
      result=CollectionUtils.asArray(collection, new String[collection.size()]);
    }
    return result;
  } catch(Exception e) {
    e.printStackTrace();
    throw(new KriptonRuntimeException(e.getMessage()));
  }
}
 
Example 14
Source File: Bean64BTable.java    From kripton with Apache License 2.0 5 votes vote down vote up
/**
 * for attribute valueMapStringBean parsing
 */
public static Map<String, Bean64B> parseValueMapStringBean(byte[] input) {
  if (input==null) {
    return null;
  }
  KriptonJsonContext context=KriptonBinder.jsonBind();
  try (JacksonWrapperParser wrapper=context.createParser(input)) {
    JsonParser jacksonParser=wrapper.jacksonParser;
    // START_OBJECT
    jacksonParser.nextToken();
    // value of "element"
    jacksonParser.nextValue();
    Map<String, Bean64B> result=null;
    if (jacksonParser.currentToken()==JsonToken.START_ARRAY) {
      HashMap<String, Bean64B> collection=new HashMap<>();
      String key=null;
      Bean64B value=null;
      while (jacksonParser.nextToken() != JsonToken.END_ARRAY) {
        jacksonParser.nextValue();
        key=jacksonParser.getText();
        jacksonParser.nextValue();
        if (jacksonParser.currentToken()==JsonToken.START_OBJECT) {
          value=bean64BBindMap.parseOnJackson(jacksonParser);
        }
        collection.put(key, value);
        key=null;
        value=null;
        jacksonParser.nextToken();
      }
      result=collection;
    }
    return result;
  } catch(Exception e) {
    e.printStackTrace();
    throw(new KriptonRuntimeException(e.getMessage()));
  }
}
 
Example 15
Source File: WikiMetadata.java    From wikireverse with MIT License 4 votes vote down vote up
private void loadWikiMetadata() throws IOException, JsonParseException {
	InputStream in = MetadataParser.class
			.getResourceAsStream(WIKI_METADATA_JSON);
	JsonFactory factory = new JsonFactory();
	JsonParser parser = factory.createParser(in);

	String fieldName = "", subdomain = "";

	while (parser.nextToken() != JsonToken.END_OBJECT) {
		fieldName = parser.getCurrentName();

		if (WIKIPEDIAS.equals(fieldName)) {
			while (parser.nextToken() != JsonToken.END_ARRAY) {
				while (parser.nextToken() != JsonToken.END_OBJECT) {
					fieldName = parser.getCurrentName();

					if (SUBDOMAIN.equals(fieldName)) {
						subdomain = parser.nextTextValue();
						wikiSubdomains.add(subdomain);
					}

					if (MAIN_PAGE.equals(fieldName)) {
						wikiMainPages.put(subdomain, parser.nextTextValue());
					}

					if (NAMESPACES.equals(fieldName)) {
						HashSet<String> namespaces = new HashSet<String>();
						parser.nextToken();

						while (parser.nextToken() != JsonToken.END_OBJECT) {
							namespaces.add(parser.getCurrentName());
							parser.nextToken();
						}

						wikiNamespaces.put(subdomain, namespaces);
					}
				}
			}
		}
	}
}
 
Example 16
Source File: PersonBindMap.java    From kripton with Apache License 2.0 4 votes vote down vote up
/**
 * parse with jackson
 */
@Override
public Person parseOnJackson(JsonParser jacksonParser) throws Exception {
  Person instance = new Person();
  String fieldName;
  if (jacksonParser.currentToken() == null) {
    jacksonParser.nextToken();
  }
  if (jacksonParser.currentToken() != JsonToken.START_OBJECT) {
    jacksonParser.skipChildren();
    return instance;
  }
  while (jacksonParser.nextToken() != JsonToken.END_OBJECT) {
    fieldName = jacksonParser.getCurrentName();
    jacksonParser.nextToken();

    // Parse fields:
    switch (fieldName) {
        case "name":
          // field name (mapped with "name")
          if (jacksonParser.currentToken()!=JsonToken.VALUE_NULL) {
            instance.name=jacksonParser.getText();
          }
        break;
        case "birthday":
          // field birthday (mapped with "birthday")
          if (jacksonParser.currentToken()!=JsonToken.VALUE_NULL) {
            instance.birthday=DateUtils.read(jacksonParser.getText());
          }
        break;
        case "surname":
          // field surname (mapped with "surname")
          if (jacksonParser.currentToken()!=JsonToken.VALUE_NULL) {
            instance.surname=jacksonParser.getText();
          }
        break;
        case "tags":
          // field tags (mapped with "tags")
          if (jacksonParser.currentToken()==JsonToken.START_ARRAY) {
            ArrayList<String> collection=new ArrayList<>();
            String item=null;
            while (jacksonParser.nextToken() != JsonToken.END_ARRAY) {
              if (jacksonParser.currentToken()==JsonToken.VALUE_NULL) {
                item=null;
              } else {
                item=jacksonParser.getText();
              }
              collection.add(item);
            }
            instance.tags=collection;
          }
        break;
        default:
          jacksonParser.skipChildren();
        break;}
  }
  return instance;
}
 
Example 17
Source File: JsonTerminologyIO.java    From termsuite-core with Apache License 2.0 4 votes vote down vote up
private static void readCollection(JsonParser jp, Collection<Object> c) throws IOException {
	JsonToken token ;
	while((token = jp.nextToken()) != JsonToken.END_ARRAY) {
		c.add(readTokenObject(jp, token));
	}
}
 
Example 18
Source File: BaseCollectionDeserializer.java    From jackson-datatypes-collections with Apache License 2.0 4 votes vote down vote up
@Override
public T deserialize(JsonParser p, DeserializationContext ctxt)
        throws IOException {
    Intermediate intermediate = createIntermediate();

    if (p.isExpectedStartArrayToken()) {
        JsonToken t;
        while ((t = p.nextToken()) != JsonToken.END_ARRAY) {
            String str;
            if (t == JsonToken.VALUE_STRING) {
                str = p.getText();
            } else {
                CharSequence cs = (CharSequence) ctxt.handleUnexpectedToken(getValueType(ctxt), p);
                str = cs.toString();
            }
            if (str.length() != 1) {
                ctxt.reportInputMismatch(this,
                                         "Cannot convert a JSON String of length %d into a char element of " +
                                         "char array",
                                         str.length());
            }
            intermediate.add(str.charAt(0));
        }
        return finish(intermediate);
    }

    char[] chars = p.getTextCharacters();
    if (p.getTextOffset() == 0 && p.getTextLength() == chars.length) {
        intermediate.addAll(chars);
    } else {
        int i = 0;
        // first, copy in batches of BATCH_COPY_SIZE
        if ((p.getTextLength() - i) >= BATCH_COPY_SIZE) {
            char[] buf = new char[BATCH_COPY_SIZE];
            do {
                System.arraycopy(chars, p.getTextOffset() + i, buf, 0, BATCH_COPY_SIZE);
                intermediate.addAll(buf);
                i += BATCH_COPY_SIZE;
            } while ((p.getTextLength() - i) >= BATCH_COPY_SIZE);
        }
        // and finally, copy the remainder.
        if (p.getTextLength() > i) {
            char[] tail = Arrays.copyOfRange(
                    chars, p.getTextOffset() + i, p.getTextOffset() + p.getTextLength());
            intermediate.addAll(tail);
        }
    }
    return finish(intermediate);
}
 
Example 19
Source File: CustomSimpleDeserializers.java    From caravan with Apache License 2.0 4 votes vote down vote up
@SuppressWarnings("rawtypes")
@Override
public JsonDeserializer<?> findArrayDeserializer(ArrayType type, DeserializationConfig config, BeanDescription beanDesc,
    TypeDeserializer elementTypeDeserializer, JsonDeserializer<?> elementDeserializer) throws JsonMappingException {

  final Class<?> contentClass = type.getContentType().getRawClass();
  TypeCustomizationFactory factory = provider.factoryForArrayOf(contentClass);

  if (factory != null) {
    final JsonDeserializer des = factory.createDeserializer();
    return new JsonDeserializer() {

      @SuppressWarnings("unchecked")
      @Override
      public Object deserialize(JsonParser p, DeserializationContext ctxt) throws IOException {
        List result = new LinkedList();

        try {
          while (p.nextToken() != JsonToken.END_ARRAY) {
            Object value = des.deserialize(p, ctxt);
            result.add(value);
          }
        } catch (Exception e) {
          throw new RuntimeException("Unexpected deserialize protobuf error", e);
        }

        Object arrayResult = Array.newInstance(contentClass, result.size());

        int i = 0;
        for (Object o : result) {
          Array.set(arrayResult, i, o);
          i++;
        }

        return arrayResult;
      }
    };
  }

  return super.findArrayDeserializer(type, config, beanDesc, elementTypeDeserializer, elementDeserializer);
}
 
Example 20
Source File: AbstractJsonReader.java    From apiman with Apache License 2.0 4 votes vote down vote up
protected <T> void processEntities(Class<T> klazz, EntityHandler<T> handler) throws Exception {
    while (nextToken() != JsonToken.END_ARRAY) {
        processEntity(klazz, handler);
    }
}