@Override public Double deserialize( final VPackSlice parent, final VPackSlice vpack, final VPackDeserializationContext context) throws VPackException { return vpack.getAsDouble(); } };
@Override public double getDoubleValue() throws IOException { return currentValue.getAsDouble(); }
public BigDecimal getAsBigDecimal() { if (isString()) { return new BigDecimal(getAsString()); } else if (isDouble()) { return BigDecimal.valueOf(getAsDouble()); } else { throw new VPackValueTypeException(ValueType.STRING, ValueType.DOUBLE); } }
/** * Construct a GeoResult from the given object * * @param object * object representing one document in the result * @return GeoResult object */ private GeoResult<?> buildGeoResult(final Object object) { if (object == null || !(object instanceof VPackSlice)) { return null; } final VPackSlice slice = (VPackSlice) object; final VPackSlice distSlice = slice.get("_distance"); final Double distanceInMeters = distSlice.isDouble() ? distSlice.getAsDouble() : null; if (distanceInMeters == null) { return null; } final Object entity = operations.getConverter().read(domainClass, slice); final Distance distance = new Distance(distanceInMeters / 1000, Metrics.KILOMETERS); return new GeoResult<>(entity, distance); }
return source.getAsDouble();
return source.getAsDouble();
/** * Construct a GeoResult from the given object * * @param object * object representing one document in the result * @return GeoResult object */ private GeoResult<?> buildGeoResult(final Object object) { if (object == null || !(object instanceof VPackSlice)) { return null; } final VPackSlice slice = (VPackSlice) object; final VPackSlice distSlice = slice.get("_distance"); final Double distanceInMeters = distSlice.isDouble() ? distSlice.getAsDouble() : null; if (distanceInMeters == null) { return null; } final Object entity = operations.getConverter().read(domainClass, slice); final Distance distance = new Distance(distanceInMeters / 1000, Metrics.KILOMETERS); return new GeoResult<>(entity, distance); }
json.append(toJSONString(value.getAsString())); } else if (value.isDouble()) { json.append(value.getAsDouble()); } else if (value.isInt()) { json.append(value.getAsLong());
@Override public ConsolidationPolicy deserialize( final VPackSlice parent, final VPackSlice vpack, final VPackDeserializationContext context) throws VPackException { final VPackSlice type = vpack.get("type"); if (type.isString()) { final ConsolidationPolicy consolidate = ConsolidationPolicy .of(ConsolidationType.valueOf(type.getAsString().toUpperCase())); final VPackSlice threshold = vpack.get("threshold"); if (threshold.isNumber()) { consolidate.threshold(threshold.getAsDouble()); } final VPackSlice segmentThreshold = vpack.get("segmentThreshold"); if (segmentThreshold.isInteger()) { consolidate.segmentThreshold(segmentThreshold.getAsLong()); } return consolidate; } return null; } };
/** * Build a GeoResult from the given ArangoCursor * * @param cursor * query result from driver * @return GeoResult object */ private GeoResult<?> buildGeoResult(final ArangoCursor<?> cursor) { GeoResult<?> geoResult = null; while (cursor.hasNext() && geoResult == null) { final Object object = cursor.next(); if (!(object instanceof VPackSlice)) { continue; } final VPackSlice slice = (VPackSlice) object; final VPackSlice distSlice = slice.get("_distance"); final Double distanceInMeters = distSlice.isDouble() ? distSlice.getAsDouble() : null; if (distanceInMeters == null) { continue; } final Object entity = operations.getConverter().read(domainClass, slice); final Distance distance = new Distance(distanceInMeters / 1000, Metrics.KILOMETERS); geoResult = new GeoResult<>(entity, distance); } return geoResult; }
/** * Build a GeoResult from the given ArangoCursor * * @param cursor * query result from driver * @return GeoResult object */ private GeoResult<?> buildGeoResult(final ArangoCursor<?> cursor) { GeoResult<?> geoResult = null; while (cursor.hasNext() && geoResult == null) { final Object object = cursor.next(); if (!(object instanceof VPackSlice)) { continue; } final VPackSlice slice = (VPackSlice) object; final VPackSlice distSlice = slice.get("_distance"); final Double distanceInMeters = distSlice.isDouble() ? distSlice.getAsDouble() : null; if (distanceInMeters == null) { continue; } final Object entity = operations.getConverter().read(domainClass, slice); final Distance distance = new Distance(distanceInMeters / 1000, Metrics.KILOMETERS); geoResult = new GeoResult<>(entity, distance); } return geoResult; }