/** Finds the maximum value for the given property over all Objects matching the query. */ public double maxDouble() { return (Double) query.callInReadTx(new Callable<Double>() { @Override public Double call() { return nativeMaxDouble(queryHandle, query.cursorHandle(), propertyId); } }); }
/** Finds the minimum value for the given property over all Objects matching the query. */ public double minDouble() { return (Double) query.callInReadTx(new Callable<Double>() { @Override public Double call() { return nativeMinDouble(queryHandle, query.cursorHandle(), propertyId); } }); }
/** Sums up all values for the given property over all Objects matching the query. */ public long sum() { return (Long) query.callInReadTx(new Callable<Long>() { @Override public Long call() { return nativeSum(queryHandle, query.cursorHandle(), propertyId); } }); }
/** Finds the maximum value for the given property over all Objects matching the query. */ public long max() { return (Long) query.callInReadTx(new Callable<Long>() { @Override public Long call() { return nativeMax(queryHandle, query.cursorHandle(), propertyId); } }); }
public String findString() { return (String) query.callInReadTx(new Callable<String>() { @Override public String call() { boolean distinctCase = distinct && !noCaseIfDistinct; return nativeFindString(queryHandle, query.cursorHandle(), propertyId, unique, distinct, distinctCase, enableNull, nullValueString); } }); }
private Object findNumber() { return query.callInReadTx(new Callable<Object>() { @Override public Object call() { return nativeFindNumber(queryHandle, query.cursorHandle(), propertyId, unique, distinct, enableNull, nullValueLong, nullValueFloat, nullValueDouble); } }); }
/** Sums up all values for the given property over all Objects matching the query. */ public double sumDouble() { return (Double) query.callInReadTx(new Callable<Double>() { @Override public Double call() { return nativeSumDouble(queryHandle, query.cursorHandle(), propertyId); } }); }
/** Finds the minimum value for the given property over all Objects matching the query. */ public long min() { return (Long) query.callInReadTx(new Callable<Long>() { @Override public Long call() { return nativeMin(queryHandle, query.cursorHandle(), propertyId); } }); }
/** Calculates the average of all values for the given property over all Objects matching the query. */ public double avg() { return (Double) query.callInReadTx(new Callable<Double>() { @Override public Double call() { return nativeAvg(queryHandle, query.cursorHandle(), propertyId); } }); }
public long count() { return (Long) query.callInReadTx(new Callable<Long>() { @Override public Long call() { return nativeCount(queryHandle, query.cursorHandle(), propertyId, distinct); } }); }
/** * Find the values for the given byte property for objects matching the query. * <p> * Note: null values are excluded from results. * <p> * Note: results are not guaranteed to be in any particular order. */ public byte[] findBytes() { return (byte[]) query.callInReadTx(new Callable<byte[]>() { @Override public byte[] call() { return nativeFindBytes(queryHandle, query.cursorHandle(), propertyId, distinct, enableNull, (byte) nullValueLong); } }); }
/** * Find the values for the given int property for objects matching the query. * <p> * Note: null values are excluded from results. * <p> * Note: results are not guaranteed to be in any particular order. * <p> * See also: {@link #distinct} */ public short[] findShorts() { return (short[]) query.callInReadTx(new Callable<short[]>() { @Override public short[] call() { return nativeFindShorts(queryHandle, query.cursorHandle(), propertyId, distinct, enableNull, (short) nullValueLong); } }); }
/** * Find the values for the given int property for objects matching the query. * <p> * Note: null values are excluded from results. * <p> * Note: results are not guaranteed to be in any particular order. * <p> * See also: {@link #distinct} */ public char[] findChars() { return (char[]) query.callInReadTx(new Callable<char[]>() { @Override public char[] call() { return nativeFindChars(queryHandle, query.cursorHandle(), propertyId, distinct, enableNull, (char) nullValueLong); } }); }
/** * Find the values for the given int property for objects matching the query. * <p> * Note: null values are excluded from results. * <p> * Note: results are not guaranteed to be in any particular order. * <p> * See also: {@link #distinct} */ public int[] findInts() { return (int[]) query.callInReadTx(new Callable<int[]>() { @Override public int[] call() { return nativeFindInts(queryHandle, query.cursorHandle(), propertyId, distinct, enableNull, (int) nullValueLong); } }); }
/** * Find the values for the given int property for objects matching the query. * <p> * Note: null values are excluded from results. * <p> * Note: results are not guaranteed to be in any particular order. * <p> * See also: {@link #distinct} */ public float[] findFloats() { return (float[]) query.callInReadTx(new Callable<float[]>() { @Override public float[] call() { return nativeFindFloats(queryHandle, query.cursorHandle(), propertyId, distinct, enableNull, nullValueFloat); } }); }
/** * Find the values for the given int property for objects matching the query. * <p> * Note: null values are excluded from results. * <p> * Note: results are not guaranteed to be in any particular order. * <p> * See also: {@link #distinct} */ public double[] findDoubles() { return (double[]) query.callInReadTx(new Callable<double[]>() { @Override public double[] call() { return nativeFindDoubles(queryHandle, query.cursorHandle(), propertyId, distinct, enableNull, nullValueDouble); } }); }
/** * Find the values for the given long property for objects matching the query. * <p> * Note: null values are excluded from results. * <p> * Note: results are not guaranteed to be in any particular order. * <p> * See also: {@link #distinct} * * @return Found longs */ public long[] findLongs() { return (long[]) query.callInReadTx(new Callable<long[]>() { @Override public long[] call() { return nativeFindLongs(queryHandle, query.cursorHandle(), propertyId, distinct, enableNull, nullValueLong); } }); }
/** * Find all Objects matching the query between the given offset and limit. This helps with pagination. */ @Nonnull public List<T> find(final long offset, final long limit) { ensureNoFilterNoComparator(); return callInReadTx(new Callable<List<T>>() { @Override public List<T> call() { List entities = nativeFind(handle, cursorHandle(), offset, limit); resolveEagerRelations(entities); return entities; } }); }
/** * Find the first Object matching the query. */ @Nullable public T findFirst() { ensureNoFilterNoComparator(); return callInReadTx(new Callable<T>() { @Override public T call() { @SuppressWarnings("unchecked") T entity = (T) nativeFindFirst(handle, cursorHandle()); resolveEagerRelation(entity); return entity; } }); }
/** * Find the unique Object matching the query. * * @throws io.objectbox.exception.NonUniqueResultException if result was not unique */ @Nullable public T findUnique() { ensureNoFilterNoComparator(); return callInReadTx(new Callable<T>() { @Override public T call() { @SuppressWarnings("unchecked") T entity = (T) nativeFindUnique(handle, cursorHandle()); resolveEagerRelation(entity); return entity; } }); }