public final class Projections extends Object
The <tt>criterion</tt> package may be used by applications as a framework for building new kinds of <tt>Projection</tt>. However, it is intended that most applications will simply use the built-in projection types via the static factory methods of this class.
The factory methods that take an alias allow the projected value to be referred to by criterion and order instances.
See also the Restrictions
factory methods for generating Criterion
instances
Criteria
Modifier and Type | Method and Description |
---|---|
static Projection |
alias(Projection projection,
String alias)
Assign an alias to a projection, by wrapping it
|
static AggregateProjection |
avg(String propertyName)
A property average value projection
|
static CountProjection |
count(String propertyName)
A property value count projection
|
static CountProjection |
countDistinct(String propertyName)
A distinct property value count projection
|
static Projection |
distinct(Projection projection)
Create a distinct projection from a projection.
|
static PropertyProjection |
groupProperty(String propertyName)
A grouping property value projection
|
static IdentifierProjection |
id()
An identifier value projection.
|
static AggregateProjection |
max(String propertyName)
A property maximum value projection
|
static AggregateProjection |
min(String propertyName)
A property minimum value projection
|
static ProjectionList |
projectionList()
Create a new projection list.
|
static PropertyProjection |
property(String propertyName)
A property value projection
|
static Projection |
rowCount()
The query row count, ie.
|
static Projection |
sqlGroupProjection(String sql,
String groupBy,
String[] columnAliases,
Type[] types)
A grouping SQL projection, specifying both select clause and group by clause fragments
|
static Projection |
sqlProjection(String sql,
String[] columnAliases,
Type[] types)
A SQL projection, a typed select clause fragment
|
static AggregateProjection |
sum(String propertyName)
A property value sum projection
|
public static PropertyProjection property(String propertyName)
A property value projection
propertyName
- The name of the property whose values should be projectedPropertyProjection
public static PropertyProjection groupProperty(String propertyName)
A grouping property value projection
propertyName
- The name of the property to groupPropertyProjection
public static IdentifierProjection id()
An identifier value projection.
IdentifierProjection
public static Projection distinct(Projection projection)
Create a distinct projection from a projection.
projection
- The project to treat distinctlyDistinct
public static ProjectionList projectionList()
Create a new projection list.
public static Projection rowCount()
The query row count, ie. <tt>count(*)</tt>
RowCountProjection
public static CountProjection count(String propertyName)
A property value count projection
propertyName
- The name of the property to count overCountProjection
public static CountProjection countDistinct(String propertyName)
A distinct property value count projection
propertyName
- The name of the property to count overCountProjection
public static AggregateProjection max(String propertyName)
A property maximum value projection
propertyName
- The property for which to find the maxAggregateProjection
public static AggregateProjection min(String propertyName)
A property minimum value projection
propertyName
- The property for which to find the minAggregateProjection
public static AggregateProjection avg(String propertyName)
A property average value projection
propertyName
- The property over which to find the averageAvgProjection
public static AggregateProjection sum(String propertyName)
A property value sum projection
propertyName
- The property over which to sumAggregateProjection
public static Projection alias(Projection projection, String alias)
Assign an alias to a projection, by wrapping it
projection
- The projection to be aliasedalias
- The alias to applyAliasedProjection
public static Projection sqlProjection(String sql, String[] columnAliases, Type[] types)
A SQL projection, a typed select clause fragment
sql
- The SQL fragmentcolumnAliases
- The column aliasestypes
- The resulting typesSQLProjection
public static Projection sqlGroupProjection(String sql, String groupBy, String[] columnAliases, Type[] types)
A grouping SQL projection, specifying both select clause and group by clause fragments
sql
- The SQL SELECT fragmentgroupBy
- The SQL GROUP BY fragmentcolumnAliases
- The column aliasestypes
- The resulting typesSQLProjection
Copyright © 2001-2018 Red Hat, Inc. All Rights Reserved.