Commit cbc79dcd authored by Matija Obreza's avatar Matija Obreza
Browse files

Properly typed NumberFilter

parent 131c2065
...@@ -21,33 +21,33 @@ import com.querydsl.core.types.dsl.NumberPath; ...@@ -21,33 +21,33 @@ import com.querydsl.core.types.dsl.NumberPath;
/** /**
* Utility filtering for numeric types. Matches all constraints. * Utility filtering for numeric types. Matches all constraints.
*/ */
public class NumberFilter { public class NumberFilter<T extends Number & Comparable<?>> {
/** /**
* Equal * Equal
*/ */
public Double eq; public T eq;
/** /**
* Greater than * Greater than
*/ */
public Double gt; public T gt;
/** /**
* Greater than or equal * Greater than or equal
*/ */
public Double ge; public T ge;
/** /**
* Less than * Less than
*/ */
public Double lt; public T lt;
/** /**
* Less than or equal * Less than or equal
*/ */
public Double le; public T le;
public BooleanBuilder buildQuery(final NumberPath<Double> val) { public BooleanBuilder buildQuery(final NumberPath<T> val) {
final BooleanBuilder and = new BooleanBuilder(); final BooleanBuilder and = new BooleanBuilder();
if (eq != null) { if (eq != null) {
and.and(val.eq(eq)); and.and(val.eq(eq));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment