Class Projections
- java.lang.Object
-
- io.micronaut.data.model.query.factory.Projections
-
public class Projections extends java.lang.Object
Projections used to customize the results of a query.- Since:
- 1.0
- Author:
- Graeme Rocher
-
-
Field Summary
Fields Modifier and Type Field Description static QueryModel.CountProjection
COUNT_PROJECTION
static QueryModel.IdProjection
ID_PROJECTION
-
Constructor Summary
Constructors Constructor Description Projections()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static QueryModel.AvgProjection
avg(java.lang.String name)
Computes the average value of a property.static QueryModel.CountProjection
count()
Projection that returns the number of records from the query.static QueryModel.CountDistinctProjection
countDistinct(java.lang.String property)
Projection that signifies to return only distinct results.static QueryModel.DistinctProjection
distinct()
Projection that signifies to return only distinct results.static QueryModel.DistinctPropertyProjection
distinct(java.lang.String property)
Projection that signifies to return only distinct results.static QueryModel.GroupPropertyProjection
groupProperty(java.lang.String property)
Defines a group by projection for datastores that support it.static QueryModel.IdProjection
id()
Projection used to obtain the id of an object.static QueryModel.LiteralProjection
literal(java.lang.Object value)
A projection that projects a simple literal.static QueryModel.MaxProjection
max(java.lang.String name)
Computes the pageSize value of a property.static QueryModel.MinProjection
min(java.lang.String name)
Computes the min value of a property.static QueryModel.PropertyProjection
property(java.lang.String name)
A projection that obtains the value of a property of an entity.static QueryModel.SumProjection
sum(java.lang.String name)
Computes the sum of a property.
-
-
-
Field Detail
-
ID_PROJECTION
public static final QueryModel.IdProjection ID_PROJECTION
-
COUNT_PROJECTION
public static final QueryModel.CountProjection COUNT_PROJECTION
-
-
Method Detail
-
id
public static QueryModel.IdProjection id()
Projection used to obtain the id of an object.- Returns:
- The IdProjection instance
-
count
public static QueryModel.CountProjection count()
Projection that returns the number of records from the query. instead of the results themselves- Returns:
- The CountProjection instance
-
literal
public static QueryModel.LiteralProjection literal(java.lang.Object value)
A projection that projects a simple literal.- Parameters:
value
- The literal value- Returns:
- The LiteralProjection instance
-
property
public static QueryModel.PropertyProjection property(java.lang.String name)
A projection that obtains the value of a property of an entity.- Parameters:
name
- The name of the property- Returns:
- The PropertyProjection instance
-
sum
public static QueryModel.SumProjection sum(java.lang.String name)
Computes the sum of a property.- Parameters:
name
- The name of the property- Returns:
- The PropertyProjection instance
-
min
public static QueryModel.MinProjection min(java.lang.String name)
Computes the min value of a property.- Parameters:
name
- The name of the property- Returns:
- The PropertyProjection instance
-
max
public static QueryModel.MaxProjection max(java.lang.String name)
Computes the pageSize value of a property.- Parameters:
name
- The name of the property- Returns:
- The PropertyProjection instance
-
avg
public static QueryModel.AvgProjection avg(java.lang.String name)
Computes the average value of a property.- Parameters:
name
- The name of the property- Returns:
- The PropertyProjection instance
-
distinct
public static QueryModel.DistinctProjection distinct()
Projection that signifies to return only distinct results.- Returns:
- Distinct projection
-
distinct
public static QueryModel.DistinctPropertyProjection distinct(java.lang.String property)
Projection that signifies to return only distinct results.- Parameters:
property
- The name of the property- Returns:
- Distinct projection
-
countDistinct
public static QueryModel.CountDistinctProjection countDistinct(java.lang.String property)
Projection that signifies to return only distinct results.- Parameters:
property
- The name of the property- Returns:
- Distinct projection
-
groupProperty
public static QueryModel.GroupPropertyProjection groupProperty(java.lang.String property)
Defines a group by projection for datastores that support it.- Parameters:
property
- The property name- Returns:
- The projection list
-
-