1 package org.hibernate.criterion; 3 4 import org.hibernate.type.Type; 5 6 18 public final class Projections { 19 20 private Projections() { 21 } 23 24 27 public static Projection distinct(Projection proj) { 28 return new Distinct(proj); 29 } 30 31 34 public static ProjectionList projectionList() { 35 return new ProjectionList(); 36 } 37 38 41 public static Projection rowCount() { 42 return new RowCountProjection(); 43 } 44 45 48 public static CountProjection count(String propertyName) { 49 return new CountProjection(propertyName); 50 } 51 52 55 public static CountProjection countDistinct(String propertyName) { 56 return new CountProjection(propertyName).setDistinct(); 57 } 58 59 62 public static AggregateProjection max(String propertyName) { 63 return new AggregateProjection("max", propertyName); 64 } 65 66 69 public static AggregateProjection min(String propertyName) { 70 return new AggregateProjection("min", propertyName); 71 } 72 73 76 public static AggregateProjection avg(String propertyName) { 77 return new AvgProjection(propertyName); 78 } 79 80 83 public static AggregateProjection sum(String propertyName) { 84 return new AggregateProjection("sum", propertyName); 85 } 86 87 90 public static Projection sqlProjection(String sql, String [] columnAliases, Type[] types) { 91 return new SQLProjection(sql, columnAliases, types); 92 } 93 94 97 public static Projection sqlGroupProjection(String sql, String groupBy, String [] columnAliases, Type[] types) { 98 return new SQLProjection(sql, groupBy, columnAliases, types); 99 } 100 101 104 public static PropertyProjection groupProperty(String propertyName) { 105 return new PropertyProjection(propertyName, true); 106 } 107 108 111 public static PropertyProjection property(String propertyName) { 112 return new PropertyProjection(propertyName); 113 } 114 115 118 public static IdentifierProjection id() { 119 return new IdentifierProjection(); 120 } 121 122 125 public static Projection alias(Projection projection, String alias) { 126 return new AliasedProjection(projection, alias); 127 } 128 } 129 | Popular Tags |