@Override public Integer deserialize( final VPackSlice parent, final VPackSlice vpack, final VPackDeserializationContext context) throws VPackException { return vpack.getAsInt(); } };
@Override public int getIntValue() throws IOException { return currentValue.getAsInt(); }
@Override public LogLevel deserialize( final VPackSlice parent, final VPackSlice vpack, final VPackDeserializationContext context) throws VPackException { return LogLevel.fromLevel(vpack.getAsInt()); } };
@Override public CollectionType deserialize( final VPackSlice parent, final VPackSlice vpack, final VPackDeserializationContext context) throws VPackException { return CollectionType.fromType(vpack.getAsInt()); } };
@Override public CollectionStatus deserialize( final VPackSlice parent, final VPackSlice vpack, final VPackDeserializationContext context) throws VPackException { return CollectionStatus.fromStatus(vpack.getAsInt()); } };
/** * translates an integer key into a string, without checks */ protected VPackSlice translateUnchecked() { final VPackSlice result = attributeTranslator.translate(getAsInt()); return result != null ? result : new VPackSlice(); }
@Override public void seal() throws VPackException { if (builder == null) { return; } builder.close(); final VPackSlice slice = builder.slice(); for (int i = 0; i < slice.getLength(); i++) { final VPackSlice key = slice.keyAt(i); final VPackSlice value = slice.valueAt(i); attributeToKey.put(key.getAsString(), value); keyToAttribute.put(value.getAsInt(), key); } }
@Override public ReplicationFactor deserialize( final VPackSlice parent, final VPackSlice vpack, final VPackDeserializationContext context) throws VPackException { final ReplicationFactor replicationFactor = new ReplicationFactor(); if (vpack.isString() && vpack.getAsString().equals("satellite")) { replicationFactor.setSatellite(true); } else { replicationFactor.setReplicationFactor(vpack.getAsInt()); } return replicationFactor; } };
@SuppressWarnings({ "unchecked", "rawtypes" }) @Override public Response deserialize( final VPackSlice parent, final VPackSlice vpack, final VPackDeserializationContext context) throws VPackException { final Response response = new Response(); response.setVersion(vpack.get(0).getAsInt()); response.setType(vpack.get(1).getAsInt()); response.setResponseCode(vpack.get(2).getAsInt()); if (vpack.size() > 3) { response.setMeta((Map) context.deserialize(vpack.get(3), Map.class)); } return response; } };
@Override public Integer deserialize(final Response response) throws VPackException { // compatibility with ArangoDB < 3.4 // https://docs.arangodb.com/devel/Manual/ReleaseNotes/UpgradingChanges34.html Integer count = null; final VPackSlice body = response.getBody(); if (body.isObject()) { final VPackSlice deletedCount = body.get("deletedCount"); if (deletedCount.isInteger()) { count = deletedCount.getAsInt(); } } return count; }; };
return source.getAsInt();
return source.getAsInt();