1 package org.hibernate.criterion; 3 4 import java.util.Collection ; 5 6 10 public class Property extends PropertyProjection { 11 protected Property(String propertyName) { 13 super(propertyName); 14 } 15 16 public Criterion between(Object min, Object max) { 17 return Restrictions.between(getPropertyName(), min, max); 18 } 19 20 public Criterion in(Collection values) { 21 return Restrictions.in(getPropertyName(), values); 22 } 23 24 public Criterion in(Object [] values) { 25 return Restrictions.in(getPropertyName(), values); 26 } 27 28 public SimpleExpression like(Object value) { 29 return Restrictions.like(getPropertyName(), value); 30 } 31 32 public SimpleExpression like(String value, MatchMode matchMode) { 33 return Restrictions.like(getPropertyName(), value, matchMode); 34 } 35 36 public SimpleExpression eq(Object value) { 37 return Restrictions.eq(getPropertyName(), value); 38 } 39 40 public SimpleExpression ne(Object value) { 41 return Restrictions.ne(getPropertyName(), value); 42 } 43 44 public SimpleExpression gt(Object value) { 45 return Restrictions.gt(getPropertyName(), value); 46 } 47 48 public SimpleExpression lt(Object value) { 49 return Restrictions.lt(getPropertyName(), value); 50 } 51 52 public SimpleExpression le(Object value) { 53 return Restrictions.le(getPropertyName(), value); 54 } 55 56 public SimpleExpression ge(Object value) { 57 return Restrictions.ge(getPropertyName(), value); 58 } 59 60 public PropertyExpression eqProperty(Property other) { 61 return Restrictions.eqProperty( getPropertyName(), other.getPropertyName() ); 62 } 63 64 public PropertyExpression neProperty(Property other) { 65 return Restrictions.neProperty( getPropertyName(), other.getPropertyName() ); 66 } 67 68 public PropertyExpression leProperty(Property other) { 69 return Restrictions.leProperty( getPropertyName(), other.getPropertyName() ); 70 } 71 72 public PropertyExpression geProperty(Property other) { 73 return Restrictions.geProperty( getPropertyName(), other.getPropertyName() ); 74 } 75 76 public PropertyExpression ltProperty(Property other) { 77 return Restrictions.ltProperty( getPropertyName(), other.getPropertyName() ); 78 } 79 80 public PropertyExpression gtProperty(Property other) { 81 return Restrictions.gtProperty( getPropertyName(), other.getPropertyName() ); 82 } 83 84 public PropertyExpression eqProperty(String other) { 85 return Restrictions.eqProperty( getPropertyName(), other ); 86 } 87 88 public PropertyExpression neProperty(String other) { 89 return Restrictions.neProperty( getPropertyName(), other ); 90 } 91 92 public PropertyExpression leProperty(String other) { 93 return Restrictions.leProperty( getPropertyName(), other ); 94 } 95 96 public PropertyExpression geProperty(String other) { 97 return Restrictions.geProperty( getPropertyName(), other ); 98 } 99 100 public PropertyExpression ltProperty(String other) { 101 return Restrictions.ltProperty( getPropertyName(), other ); 102 } 103 104 public PropertyExpression gtProperty(String other) { 105 return Restrictions.gtProperty( getPropertyName(), other ); 106 } 107 108 public Criterion isNull() { 109 return Restrictions.isNull(getPropertyName()); 110 } 111 112 public Criterion isNotNull() { 113 return Restrictions.isNotNull(getPropertyName()); 114 } 115 116 public Criterion isEmpty() { 117 return Restrictions.isEmpty(getPropertyName()); 118 } 119 120 public Criterion isNotEmpty() { 121 return Restrictions.isNotEmpty(getPropertyName()); 122 } 123 124 public CountProjection count() { 125 return Projections.count(getPropertyName()); 126 } 127 128 public AggregateProjection max() { 129 return Projections.max(getPropertyName()); 130 } 131 132 public AggregateProjection min() { 133 return Projections.min(getPropertyName()); 134 } 135 136 public AggregateProjection avg() { 137 return Projections.avg(getPropertyName()); 138 } 139 140 143 144 public PropertyProjection group() { 145 return Projections.groupProperty(getPropertyName()); 146 } 147 148 public Order asc() { 149 return Order.asc(getPropertyName()); 150 } 151 152 public Order desc() { 153 return Order.desc(getPropertyName()); 154 } 155 156 public static Property forName(String propertyName) { 157 return new Property(propertyName); 158 } 159 160 163 public Property getProperty(String propertyName) { 164 return forName( getPropertyName() + '.' + propertyName ); 165 } 166 167 public Criterion eq(DetachedCriteria subselect) { 168 return Subqueries.propertyEq( getPropertyName(), subselect ); 169 } 170 171 public Criterion ne(DetachedCriteria subselect) { 172 return Subqueries.propertyNe( getPropertyName(), subselect ); 173 } 174 175 public Criterion lt(DetachedCriteria subselect) { 176 return Subqueries.propertyLt( getPropertyName(), subselect ); 177 } 178 179 public Criterion le(DetachedCriteria subselect) { 180 return Subqueries.propertyLe( getPropertyName(), subselect ); 181 } 182 183 public Criterion gt(DetachedCriteria subselect) { 184 return Subqueries.propertyGt( getPropertyName(), subselect ); 185 } 186 187 public Criterion ge(DetachedCriteria subselect) { 188 return Subqueries.propertyGe( getPropertyName(), subselect ); 189 } 190 191 public Criterion notIn(DetachedCriteria subselect) { 192 return Subqueries.propertyNotIn( getPropertyName(), subselect ); 193 } 194 195 public Criterion in(DetachedCriteria subselect) { 196 return Subqueries.propertyIn( getPropertyName(), subselect ); 197 } 198 199 public Criterion eqAll(DetachedCriteria subselect) { 200 return Subqueries.propertyEqAll( getPropertyName(), subselect ); 201 } 202 203 public Criterion gtAll(DetachedCriteria subselect) { 204 return Subqueries.propertyGtAll( getPropertyName(), subselect ); 205 } 206 207 public Criterion ltAll(DetachedCriteria subselect) { 208 return Subqueries.propertyLtAll( getPropertyName(), subselect ); 209 } 210 211 public Criterion leAll(DetachedCriteria subselect) { 212 return Subqueries.propertyLeAll( getPropertyName(), subselect ); 213 } 214 215 public Criterion geAll(DetachedCriteria subselect) { 216 return Subqueries.propertyGeAll( getPropertyName(), subselect ); 217 } 218 219 public Criterion gtSome(DetachedCriteria subselect) { 220 return Subqueries.propertyGtSome( getPropertyName(), subselect ); 221 } 222 223 public Criterion ltSome(DetachedCriteria subselect) { 224 return Subqueries.propertyLtSome( getPropertyName(), subselect ); 225 } 226 227 public Criterion leSome(DetachedCriteria subselect) { 228 return Subqueries.propertyLeSome( getPropertyName(), subselect ); 229 } 230 231 public Criterion geSome(DetachedCriteria subselect) { 232 return Subqueries.propertyGeSome( getPropertyName(), subselect ); 233 } 234 235 } 236 | Popular Tags |