KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > hibernate > criterion > Property


1 //$Id: Property.java,v 1.6 2005/02/12 07:19:14 steveebersole Exp $
2
package org.hibernate.criterion;
3
4 import java.util.Collection JavaDoc;
5
6 /**
7  * A factory for property-specific criterion and projection instances
8  * @author Gavin King
9  */

10 public class Property extends PropertyProjection {
11     //private String propertyName;
12
protected Property(String JavaDoc propertyName) {
13         super(propertyName);
14     }
15
16     public Criterion between(Object JavaDoc min, Object JavaDoc max) {
17         return Restrictions.between(getPropertyName(), min, max);
18     }
19
20     public Criterion in(Collection JavaDoc values) {
21         return Restrictions.in(getPropertyName(), values);
22     }
23
24     public Criterion in(Object JavaDoc[] values) {
25         return Restrictions.in(getPropertyName(), values);
26     }
27
28     public SimpleExpression like(Object JavaDoc value) {
29         return Restrictions.like(getPropertyName(), value);
30     }
31
32     public SimpleExpression like(String JavaDoc value, MatchMode matchMode) {
33         return Restrictions.like(getPropertyName(), value, matchMode);
34     }
35
36     public SimpleExpression eq(Object JavaDoc value) {
37         return Restrictions.eq(getPropertyName(), value);
38     }
39
40     public SimpleExpression ne(Object JavaDoc value) {
41         return Restrictions.ne(getPropertyName(), value);
42     }
43
44     public SimpleExpression gt(Object JavaDoc value) {
45         return Restrictions.gt(getPropertyName(), value);
46     }
47
48     public SimpleExpression lt(Object JavaDoc value) {
49         return Restrictions.lt(getPropertyName(), value);
50     }
51
52     public SimpleExpression le(Object JavaDoc value) {
53         return Restrictions.le(getPropertyName(), value);
54     }
55
56     public SimpleExpression ge(Object JavaDoc 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 JavaDoc other) {
85         return Restrictions.eqProperty( getPropertyName(), other );
86     }
87
88     public PropertyExpression neProperty(String JavaDoc other) {
89         return Restrictions.neProperty( getPropertyName(), other );
90     }
91     
92     public PropertyExpression leProperty(String JavaDoc other) {
93         return Restrictions.leProperty( getPropertyName(), other );
94     }
95
96     public PropertyExpression geProperty(String JavaDoc other) {
97         return Restrictions.geProperty( getPropertyName(), other );
98     }
99     
100     public PropertyExpression ltProperty(String JavaDoc other) {
101         return Restrictions.ltProperty( getPropertyName(), other );
102     }
103
104     public PropertyExpression gtProperty(String JavaDoc 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     /*public PropertyProjection project() {
141         return Projections.property(getPropertyName());
142     }*/

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 JavaDoc propertyName) {
157         return new Property(propertyName);
158     }
159     
160     /**
161      * Get a component attribute of this property
162      */

163     public Property getProperty(String JavaDoc 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