001package org.avaje.ebean.typequery;
002
003/**
004 * Base property for number types.
005 *
006 * @param <R> the root query bean type
007 * @param <T> the number type
008 */
009public abstract class PBaseNumber<R,T> extends TQProperty<R> {
010
011  /**
012   * Construct with a property name and root instance.
013   *
014   * @param name property name
015   * @param root the root query bean instance
016   */
017  public PBaseNumber(String name, R root) {
018    super(name , root);
019  }
020
021  /**
022   * Construct with additional path prefix.
023   */
024  public PBaseNumber(String name, R root, String prefix) {
025    super(name, root, prefix);
026  }
027
028
029  /**
030   * Is equal to.
031   *
032   * @param value the equal to bind value
033   * @return the root query bean instance
034   */
035  public R eq(T value) {
036    expr().eq(name, value);
037    return root;
038  }
039
040  /**
041   * Greater than.
042   *
043   * @param value the bind value
044   * @return the root query bean instance
045   */
046  public R gt(T value) {
047    expr().gt(name, value);
048    return root;
049  }
050
051  /**
052   * Greater than or Equal to.
053   *
054   * @param value the bind value
055   * @return the root query bean instance
056   */
057  public R ge(T value) {
058    expr().ge(name, value);
059    return root;
060  }
061
062  /**
063   * Less than.
064   *
065   * @param value the bind value
066   * @return the root query bean instance
067   */
068  public R lt(T value) {
069    expr().lt(name, value);
070    return root;
071  }
072
073
074  /**
075   * Less than or Equal to.
076   *
077   * @param value the bind value
078   * @return the root query bean instance
079   */
080  public R le(T value) {
081    expr().le(name, value);
082    return root;
083  }
084
085  /**
086   * Between lower and upper values.
087   *
088   * @param lower the lower bind value
089   * @param upper the upper bind value
090   * @return the root query bean instance
091   */
092  public R between(T lower, T upper) {
093    expr().between(name, lower, upper);
094    return root;
095  }
096
097
098  /**
099   * Is equal to.
100   *
101   * @param value the equal to bind value
102   * @return the root query bean instance
103   */
104  public R equalTo(T value) {
105    expr().eq(name, value);
106    return root;
107  }
108
109  /**
110   * Greater than.
111   *
112   * @param value the bind value
113   * @return the root query bean instance
114   */
115  public R greaterThan(T value) {
116    expr().gt(name, value);
117    return root;
118  }
119
120  /**
121   * Greater than or Equal to.
122   *
123   * @param value the bind value
124   * @return the root query bean instance
125   */
126  public R greaterOrEqualTo(T value) {
127    expr().ge(name, value);
128    return root;
129  }
130
131
132  /**
133   * Less than.
134   *
135   * @param value the bind value
136   * @return the root query bean instance
137   */
138  public R lessThan(T value) {
139    expr().lt(name, value);
140    return root;
141  }
142
143
144  /**
145   * Less than or Equal to.
146   *
147   * @param value the bind value
148   * @return the root query bean instance
149   */
150  public R lessOrEqualTo(T value) {
151    expr().le(name, value);
152    return root;
153  }
154
155
156  // Additional int versions -- seems the right thing to do
157
158  /**
159   * Is equal to.
160   *
161   * @param value the equal to bind value
162   * @return the root query bean instance
163   */
164  public R equalTo(int value) {
165    expr().eq(name, value);
166    return root;
167  }
168
169  /**
170   * Greater than.
171   *
172   * @param value the equal to bind value
173   * @return the root query bean instance
174   */
175  public R greaterThan(int value) {
176    expr().gt(name, value);
177    return root;
178  }
179
180  /**
181   * Less than.
182   *
183   * @param value the equal to bind value
184   * @return the root query bean instance
185   */
186  public R lessThan(int value) {
187    expr().lt(name, value);
188    return root;
189  }
190
191
192  /**
193   * Is equal to.
194   *
195   * @param value the equal to bind value
196   * @return the root query bean instance
197   */
198  public R eq(int value) {
199    expr().eq(name, value);
200    return root;
201  }
202
203  /**
204   * Greater than.
205   *
206   * @param value the equal to bind value
207   * @return the root query bean instance
208   */
209  public R gt(int value) {
210    expr().gt(name, value);
211    return root;
212  }
213
214  /**
215   * Less than.
216   *
217   * @param value the equal to bind value
218   * @return the root query bean instance
219   */
220  public R lt(int value) {
221    expr().lt(name, value);
222    return root;
223  }
224
225  /**
226   * Between lower and upper values.
227   *
228   * @param lower the lower bind value
229   * @param upper the upper bind value
230   * @return the root query bean instance
231   */
232  public R between(int lower, int upper) {
233    expr().between(name, lower, upper);
234    return root;
235  }
236}