public class PropertyQuery
extends java.lang.Object
Query.property(Property)
.
Note: Property values do currently not consider any order defined for the main Query
object
(subject to change in a future version).Modifier and Type | Method and Description |
---|---|
double |
avg()
Calculates the average of all values for the given number property over all Objects matching the query.
|
long |
avgLong()
Calculates the average of all values for the given integer property over all Objects matching the query.
|
long |
count()
The count of non-null values.
|
PropertyQuery |
distinct()
Only distinct values should be returned (e.g.
|
PropertyQuery |
distinct(QueryBuilder.StringOrder stringOrder)
For string properties you can specify
QueryBuilder.StringOrder.CASE_SENSITIVE if you
want to have case sensitive distinct values (e.g. |
java.lang.Boolean |
findBoolean() |
java.lang.Byte |
findByte() |
byte[] |
findBytes()
Find the values for the given byte property for objects matching the query.
|
java.lang.Character |
findChar() |
char[] |
findChars()
Find the values for the given int property for objects matching the query.
|
java.lang.Double |
findDouble() |
double[] |
findDoubles()
Find the values for the given int property for objects matching the query.
|
java.lang.Float |
findFloat() |
float[] |
findFloats()
Find the values for the given int property for objects matching the query.
|
java.lang.Integer |
findInt() |
int[] |
findInts()
Find the values for the given int property for objects matching the query.
|
java.lang.Long |
findLong() |
long[] |
findLongs()
Find the values for the given long property for objects matching the query.
|
java.lang.Short |
findShort() |
short[] |
findShorts()
Find the values for the given int property for objects matching the query.
|
java.lang.String |
findString() |
java.lang.String[] |
findStrings()
Find the values for the given string property for objects matching the query.
|
long |
max()
Finds the maximum value for the given property over all Objects matching the query.
|
double |
maxDouble()
Finds the maximum value for the given property over all Objects matching the query.
|
long |
min()
Finds the minimum value for the given property over all Objects matching the query.
|
double |
minDouble()
Finds the minimum value for the given property over all objects matching the query.
|
PropertyQuery |
nullValue(java.lang.Object nullValue)
By default, null values are not returned by find methods (primitive arrays cannot contains nulls).
|
PropertyQuery |
reset()
Clears all values (e.g.
|
long |
sum()
Sums up all values for the given property over all Objects matching the query.
|
double |
sumDouble()
Sums up all values for the given property over all Objects matching the query.
|
PropertyQuery |
unique()
For find methods returning single values, e.g.
|
public PropertyQuery reset()
public PropertyQuery distinct()
Note: strings default to case-insensitive comparision;
to change that call distinct(QueryBuilder.StringOrder)
.
public PropertyQuery distinct(QueryBuilder.StringOrder stringOrder)
QueryBuilder.StringOrder.CASE_SENSITIVE
if you
want to have case sensitive distinct values (e.g. returning "foo","Foo","FOO" instead of "foo").public PropertyQuery unique()
findInt()
, this will additional verify that the
resulting value is unique.
If there is any other resulting value resulting from this query, an exception will be thrown.
Can be combined with distinct()
.
Will be ignored for find methods returning multiple values, e.g. findInts()
.
public PropertyQuery nullValue(java.lang.Object nullValue)
public java.lang.String[] findStrings()
Note: null values are excluded from results.
Note: results are not guaranteed to be in any particular order.
See also: distinct()
, distinct(QueryBuilder.StringOrder)
public long[] findLongs()
Note: null values are excluded from results.
Note: results are not guaranteed to be in any particular order.
See also: distinct()
public int[] findInts()
Note: null values are excluded from results.
Note: results are not guaranteed to be in any particular order.
See also: distinct()
public short[] findShorts()
Note: null values are excluded from results.
Note: results are not guaranteed to be in any particular order.
See also: distinct()
public char[] findChars()
Note: null values are excluded from results.
Note: results are not guaranteed to be in any particular order.
See also: distinct()
public byte[] findBytes()
Note: null values are excluded from results.
Note: results are not guaranteed to be in any particular order.
public float[] findFloats()
Note: null values are excluded from results.
Note: results are not guaranteed to be in any particular order.
See also: distinct()
public double[] findDoubles()
Note: null values are excluded from results.
Note: results are not guaranteed to be in any particular order.
See also: distinct()
public java.lang.String findString()
public java.lang.Long findLong()
public java.lang.Integer findInt()
public java.lang.Short findShort()
public java.lang.Character findChar()
public java.lang.Byte findByte()
public java.lang.Boolean findBoolean()
public java.lang.Float findFloat()
public java.lang.Double findDouble()
public long sum()
sumDouble()
instead if you cannot guarantee the sum to be in the long value range.NumericOverflowException
- if the sum exceeds the numbers Long
can
represent.
This is different from Java arithmetic where it would "wrap around" (e.g. max. value + 1 = min. value).public double sumDouble()
sum()
is usually preferred for sums.public long max()
public double maxDouble()
public long min()
public double minDouble()
public double avg()
For integer properties you can also use avgLong()
.
public long avgLong()
For floating-point properties use avg()
.
public long count()
See also: distinct()