public class Field
extends java.lang.Object
implements java.io.Serializable
Search
.Search
,
Serialized FormModifier and Type | Field and Description |
---|---|
protected java.lang.String |
key
The key to use for the property when using result mode
RESULT_MAP . |
static int |
OP_AVG
Possible value for
operator . |
static int |
OP_COUNT
Possible value for
operator . |
static int |
OP_COUNT_DISTINCT
Possible value for
operator . |
static int |
OP_CUSTOM
Possible value for
operator . |
static int |
OP_MAX
Possible value for
operator . |
static int |
OP_MIN
Possible value for
operator . |
static int |
OP_PROPERTY
Possible value for
operator . |
static int |
OP_SUM
Possible value for
operator . |
protected int |
operator
The operator to apply to the column: for example
OP_COUNT, OP_SUM, OP_MAX . |
protected java.lang.String |
property
The property to include in the result.
|
static java.lang.String |
ROOT_ENTITY
Property string representing the root entity of the search.
|
Constructor and Description |
---|
Field() |
Field(java.lang.String property) |
Field(java.lang.String property,
int operator) |
Field(java.lang.String property,
int operator,
java.lang.String key) |
Field(java.lang.String property,
java.lang.String key) |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object obj) |
java.lang.String |
getKey() |
int |
getOperator() |
java.lang.String |
getProperty() |
int |
hashCode() |
void |
setKey(java.lang.String key) |
void |
setOperator(int operator) |
void |
setProperty(java.lang.String property) |
java.lang.String |
toString() |
public static final java.lang.String ROOT_ENTITY
protected java.lang.String property
protected java.lang.String key
RESULT_MAP
.protected int operator
OP_COUNT, OP_SUM, OP_MAX
. The default is
OP_PROPERTY
.public static final int OP_PROPERTY
operator
. This is the default value
and does not apply any operator to the column. All the rows in the result
set are returned.public static final int OP_COUNT
operator
. This returns the number of
rows in the result set where the given property is non-null.public static final int OP_COUNT_DISTINCT
operator
. This returns the number of
distinct values of the given property in the result set.public static final int OP_MAX
operator
. This returns the maximum
value of the given property in the result set.public static final int OP_MIN
operator
. This returns the minimum
value of the given property in the result set.public static final int OP_SUM
operator
. This returns the sum of the
given property in all rows of the result set.public static final int OP_AVG
operator
. This returns the average
value of the given property in the result set.public static final int OP_CUSTOM
operator
. This allows a free-form
JPQL/HQL select-clause expression. When using this operator, the
expression is set in the "property" property of the Field. Reference
properties by wrapping them with curly braces ({}).
Here are some examples:
new Field("{firstName}||' '||{initial}||' '||upper({lastName})", Field.OP_CUSTOM); new Field("max(({top} - {bottom}) / 2)", Field.OP_CUSTOM);
public Field()
public Field(java.lang.String property)
public Field(java.lang.String property, java.lang.String key)
public Field(java.lang.String property, int operator)
public Field(java.lang.String property, int operator, java.lang.String key)
public java.lang.String getProperty()
public void setProperty(java.lang.String property)
public java.lang.String getKey()
public void setKey(java.lang.String key)
public int getOperator()
public void setOperator(int operator)
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object