@SuppressWarnings({ "hiding", "unchecked" }) protected <E> Collection<E> deserializeEdges(final Class<E> edgeClass, final VPackSlice next) throws VPackException { final Collection<E> edges = new ArrayList<E>(); for (final Iterator<VPackSlice> iteratorEdge = next.get("edges").arrayIterator(); iteratorEdge.hasNext();) { edges.add((E) util(Serializer.CUSTOM).deserialize(iteratorEdge.next(), edgeClass)); } return edges; }
@SuppressWarnings("unchecked") protected <V> Collection<V> deserializeVertices(final Class<V> vertexClass, final VPackSlice vpack) throws VPackException { final Collection<V> vertices = new ArrayList<V>(); for (final Iterator<VPackSlice> iterator = vpack.get("vertices").arrayIterator(); iterator.hasNext();) { vertices.add((V) util(Serializer.CUSTOM).deserialize(iterator.next(), vertexClass)); } return vertices; }
currentCompoundValue.add(JsonToken.START_OBJECT); } else if (_currToken == JsonToken.START_ARRAY) { arrayIterators.add(currentValue.arrayIterator()); currentCompoundValue.add(JsonToken.START_ARRAY);
private Object readCollection(final TypeInformation<?> type, final VPackSlice source) { if (!source.isArray()) { throw new MappingException( String.format("Can't read collection type %s from VPack type %s!", type, source.getType())); } final TypeInformation<?> componentType = getNonNullComponentType(type); final Class<?> collectionType = Iterable.class.equals(type.getType()) ? Collection.class : type.getType(); final Collection<Object> collection = CollectionFactory.createCollection(collectionType, componentType.getType(), source.getLength()); final Iterator<VPackSlice> iterator = source.arrayIterator(); while (iterator.hasNext()) { final VPackSlice elem = iterator.next(); collection.add(readInternal(componentType, elem)); } return collection; }
@SuppressWarnings("unchecked") @Override public MultiDocumentEntity<T> deserialize(final Response response) throws VPackException { final MultiDocumentEntity<T> multiDocument = new MultiDocumentEntity<T>(); final Collection<T> docs = new ArrayList<T>(); final Collection<ErrorEntity> errors = new ArrayList<ErrorEntity>(); final Collection<Object> documentsAndErrors = new ArrayList<Object>(); final VPackSlice body = response.getBody(); for (final Iterator<VPackSlice> iterator = body.arrayIterator(); iterator.hasNext();) { final VPackSlice next = iterator.next(); if (next.get(ArangoResponseField.ERROR).isTrue()) { final ErrorEntity error = (ErrorEntity) util().deserialize(next, ErrorEntity.class); errors.add(error); documentsAndErrors.add(error); } else { final T doc = (T) util(Serializer.CUSTOM).deserialize(next, type); docs.add(doc); documentsAndErrors.add(doc); } } multiDocument.setDocuments(docs); multiDocument.setErrors(errors); multiDocument.setDocumentsAndErrors(documentsAndErrors); return multiDocument; } };
private Object readCollection(final TypeInformation<?> type, final VPackSlice source) { if (!source.isArray()) { throw new MappingException( String.format("Can't read collection type %s from VPack type %s!", type, source.getType())); } final TypeInformation<?> componentType = getNonNullComponentType(type); final Class<?> collectionType = Iterable.class.equals(type.getType()) ? Collection.class : type.getType(); final Collection<Object> collection = CollectionFactory.createCollection(collectionType, componentType.getType(), source.getLength()); final Iterator<VPackSlice> iterator = source.arrayIterator(); while (iterator.hasNext()) { final VPackSlice elem = iterator.next(); collection.add(readInternal(componentType, elem)); } return collection; }
@Override public TraversalEntity<V, E> deserialize(final Response response) throws VPackException { final TraversalEntity<V, E> result = new TraversalEntity<V, E>(); final VPackSlice visited = response.getBody().get(ArangoResponseField.RESULT).get("visited"); result.setVertices(deserializeVertices(vertexClass, visited)); final Collection<PathEntity<V, E>> paths = new ArrayList<PathEntity<V, E>>(); for (final Iterator<VPackSlice> iterator = visited.get("paths").arrayIterator(); iterator.hasNext();) { final PathEntity<V, E> path = new PathEntity<V, E>(); final VPackSlice next = iterator.next(); path.setEdges(deserializeEdges(edgeClass, next)); path.setVertices(deserializeVertices(vertexClass, next)); paths.add(path); } result.setPaths(paths); return result; } };
final VPackSlice body = response.getBody(); if (body.isArray()) { for (final Iterator<VPackSlice> iterator = body.arrayIterator(); iterator.hasNext();) { final VPackSlice next = iterator.next(); if (next.get(ArangoResponseField.ERROR).isTrue()) {
final VPackSlice body = response.getBody(); if (body.isArray()) { for (final Iterator<VPackSlice> iterator = body.arrayIterator(); iterator.hasNext();) { final VPackSlice next = iterator.next(); if (next.get(ArangoResponseField.ERROR).isTrue()) {
final VPackSlice body = response.getBody(); if (body.isArray()) { for (final Iterator<VPackSlice> iterator = body.arrayIterator(); iterator.hasNext();) { final VPackSlice next = iterator.next(); if (next.get(ArangoResponseField.ERROR).isTrue()) {
final VPackSlice body = response.getBody(); if (body.isArray()) { for (final Iterator<VPackSlice> iterator = body.arrayIterator(); iterator.hasNext();) { final VPackSlice next = iterator.next(); if (next.get(ArangoResponseField.ERROR).isTrue()) {
final VPackSlice analyzers = value.get("analyzers"); if (analyzers.isArray()) { final Iterator<VPackSlice> analyzerIterator = analyzers.arrayIterator(); for (; analyzerIterator.hasNext();) { link.analyzers(analyzerIterator.next().getAsString());
final VPackSlice analyzers = value.get("analyzers"); if (analyzers.isArray()) { final Iterator<VPackSlice> analyzerIterator = analyzers.arrayIterator(); for (; analyzerIterator.hasNext();) { link.analyzers(analyzerIterator.next().getAsString());