for (Iterator<Entry<String, VPackSlice>> iterator = document.objectIterator(); iterator.hasNext();) { Entry<String, VPackSlice> next = iterator.next(); VPackSlice value = next.getValue();
private VPackSlice getFromCompactObject(final String attribute) throws VPackKeyTypeException, VPackNeedAttributeTranslatorException { for (final Iterator<Entry<String, VPackSlice>> iterator = objectIterator(); iterator.hasNext();) { final Entry<String, VPackSlice> next = iterator.next(); if (next.getKey().equals(attribute)) { return next.getValue(); } } // not found return new VPackSlice(); }
@Override public Collection<String> deserialize(final Response response) throws VPackException { final VPackSlice result = response.getBody().get(ArangoResponseField.RESULT); final Collection<String> dbs = new ArrayList<String>(); for (final Iterator<Entry<String, VPackSlice>> iterator = result.objectIterator(); iterator .hasNext();) { dbs.add(iterator.next().getKey()); } return dbs; } };
private void parseObject(final VPackSlice value, final StringBuilder json, final boolean includeNullValues) throws VPackException { json.append(OBJECT_OPEN); int added = 0; for (final Iterator<Entry<String, VPackSlice>> iterator = value.objectIterator(); iterator.hasNext();) { final Entry<String, VPackSlice> next = iterator.next(); final VPackSlice nextValue = next.getValue(); if (!nextValue.isNull() || includeNullValues) { if (added++ > 0) { json.append(SEPARATOR); } parse(value, next.getKey(), nextValue, json, includeNullValues); } } json.append(OBJECT_CLOSE); }
private void deserializeFields(final Object entity, final VPackSlice vpack) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException, InstantiationException, VPackException { final Map<String, FieldInfo> fields = cache.getFields(entity.getClass()); for (final Iterator<Entry<String, VPackSlice>> iterator = vpack.objectIterator(); iterator.hasNext();) { final Entry<String, VPackSlice> next = iterator.next(); final FieldInfo fieldInfo = fields.get(next.getKey()); if (fieldInfo != null && fieldInfo.isDeserialize()) { deserializeField(vpack, next.getValue(), entity, fieldInfo); } } }
objectIterators.add(currentValue.objectIterator()); currentCompoundValue.add(JsonToken.START_OBJECT); } else if (_currToken == JsonToken.START_ARRAY) {
private Object readMap(final TypeInformation<?> type, final VPackSlice source) { if (!source.isObject()) { throw new MappingException( String.format("Can't read map type %s from VPack type %s!", type, source.getType())); } final Class<?> keyType = getNonNullComponentType(type).getType(); final TypeInformation<?> valueType = getNonNullMapValueType(type); final Map<Object, Object> map = CollectionFactory.createMap(type.getType(), keyType, source.size()); final Iterator<Entry<String, VPackSlice>> iterator = source.objectIterator(); while (iterator.hasNext()) { final Entry<String, VPackSlice> entry = iterator.next(); if (typeMapper.isTypeKey(entry.getKey())) { continue; } final Object key = convertIfNecessary(entry.getKey(), keyType); final VPackSlice value = entry.getValue(); map.put(key, readInternal(valueType, value)); } return map; }
private Object readMap(final TypeInformation<?> type, final VPackSlice source) { if (!source.isObject()) { throw new MappingException( String.format("Can't read map type %s from VPack type %s!", type, source.getType())); } final Class<?> keyType = getNonNullComponentType(type).getType(); final TypeInformation<?> valueType = getNonNullMapValueType(type); final Map<Object, Object> map = CollectionFactory.createMap(type.getType(), keyType, source.size()); final Iterator<Entry<String, VPackSlice>> iterator = source.objectIterator(); while (iterator.hasNext()) { final Entry<String, VPackSlice> entry = iterator.next(); if (typeMapper.isTypeKey(entry.getKey())) { continue; } final Object key = convertIfNecessary(entry.getKey(), keyType); final VPackSlice value = entry.getValue(); map.put(key, readInternal(valueType, value)); } return map; }
private <T, K, C> Object deserializeMap( final VPackSlice parent, final VPackSlice vpack, final Type type, final Type keyType, final Type valueType) throws InstantiationException, IllegalAccessException, NoSuchMethodException, InvocationTargetException, VPackException { final int length = (int) vpack.getLength(); final Map value = (Map) createInstance(type); if (length > 0) { final VPackKeyMapAdapter<Object> keyMapAdapter = getKeyMapAdapter(keyType); if (keyMapAdapter != null) { for (final Iterator<Entry<String, VPackSlice>> iterator = vpack.objectIterator(); iterator.hasNext();) { final Entry<String, VPackSlice> next = iterator.next(); final Object name = keyMapAdapter.deserialize(next.getKey()); value.put(name, getValue(vpack, next.getValue(), valueType, name.toString())); } } else { for (int i = 0; i < vpack.getLength(); i++) { final VPackSlice entry = vpack.get(i); final Object mapKey = getValue(parent, entry.get(ATTR_KEY), keyType, null); final Object mapValue = getValue(parent, entry.get(ATTR_VALUE), valueType, null); value.put(mapKey, mapValue); } } } return value; }
final Iterator<Entry<String, VPackSlice>> fieldsIterator = fields.objectIterator(); for (; fieldsIterator.hasNext();) { link.fields(deserializeField(fieldsIterator.next()));
final Iterator<Entry<String, VPackSlice>> collectionIterator = links.objectIterator(); for (; collectionIterator.hasNext();) { final Entry<String, VPackSlice> entry = collectionIterator.next(); final Iterator<Entry<String, VPackSlice>> fieldsIterator = fields.objectIterator(); for (; fieldsIterator.hasNext();) { link.fields(deserializeField(fieldsIterator.next()));