Skip to content

Commit ae9ce62

Browse files
authored
chore: remove obsolete JpaQueryBuilder class (#190)
1 parent 9445f89 commit ae9ce62

File tree

3 files changed

+32
-470
lines changed

3 files changed

+32
-470
lines changed

graphql-jpa-query-schema/src/main/java/com/introproventures/graphql/jpa/query/schema/impl/JpaPredicateBuilder.java

+31-13
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@
2828
import java.util.ArrayList;
2929
import java.util.Collection;
3030
import java.util.Date;
31-
import java.util.EnumSet;
31+
import java.util.HashMap;
32+
import java.util.Map;
3233
import java.util.Set;
3334
import java.util.UUID;
3435

@@ -74,23 +75,40 @@
7475
*/
7576
class JpaPredicateBuilder {
7677

78+
public static final Map<Class<?>, Class<?>> WRAPPERS_TO_PRIMITIVES = new HashMap<Class<?>, Class<?>>();
79+
public static final Map<Class<?>, Class<?>> PRIMITIVES_TO_WRAPPERS = new HashMap<Class<?>, Class<?>>();
80+
81+
static {
82+
PRIMITIVES_TO_WRAPPERS.put(boolean.class, Boolean.class);
83+
PRIMITIVES_TO_WRAPPERS.put(byte.class, Byte.class);
84+
PRIMITIVES_TO_WRAPPERS.put(char.class, Character.class);
85+
PRIMITIVES_TO_WRAPPERS.put(double.class, Double.class);
86+
PRIMITIVES_TO_WRAPPERS.put(float.class, Float.class);
87+
PRIMITIVES_TO_WRAPPERS.put(int.class, Integer.class);
88+
PRIMITIVES_TO_WRAPPERS.put(long.class, Long.class);
89+
PRIMITIVES_TO_WRAPPERS.put(short.class, Short.class);
90+
PRIMITIVES_TO_WRAPPERS.put(void.class, Void.class);
91+
92+
WRAPPERS_TO_PRIMITIVES.put(Boolean.class, boolean.class);
93+
WRAPPERS_TO_PRIMITIVES.put(Byte.class, byte.class);
94+
WRAPPERS_TO_PRIMITIVES.put(Character.class, char.class);
95+
WRAPPERS_TO_PRIMITIVES.put(Double.class, double.class);
96+
WRAPPERS_TO_PRIMITIVES.put(Float.class, float.class);
97+
WRAPPERS_TO_PRIMITIVES.put(Integer.class, int.class);
98+
WRAPPERS_TO_PRIMITIVES.put(Long.class, long.class);
99+
WRAPPERS_TO_PRIMITIVES.put(Short.class, short.class);
100+
WRAPPERS_TO_PRIMITIVES.put(Void.class, void.class);
101+
}
102+
77103
private final CriteriaBuilder cb;
78104

79-
private final EnumSet<Logical> globalOptions;
80-
81105
/**
82-
* Field name can be prepended with (comma separated list of local options)
83-
* if field is prepended with (), even without options, any global options
84-
* avoided and defaults are used.Defaults: for numbers and booleas -
85-
* equality; for strings case insensitive beginning matches; for dates
86-
* greater or equal;
87-
*
106+
* JpaPredicateBuilder constructor
107+
*
88108
* @param cb
89-
* @param globalOptions
90109
*/
91-
public JpaPredicateBuilder(CriteriaBuilder cb, EnumSet<Logical> globalOptions) {
110+
public JpaPredicateBuilder(CriteriaBuilder cb) {
92111
this.cb = cb;
93-
this.globalOptions = globalOptions;
94112
}
95113

96114
protected Predicate addOrNull(Path<?> root, Predicate p) {
@@ -656,7 +674,7 @@ private Predicate getTypedPredicate(From<?,?> from, Path<?> field, PredicateFilt
656674
PredicateFilter predicateFilter = new PredicateFilter(filter.getField(), value, criterias);
657675

658676
if (type.isPrimitive())
659-
type = JpaQueryBuilder.PRIMITIVES_TO_WRAPPERS.get(type);
677+
type = PRIMITIVES_TO_WRAPPERS.get(type);
660678
if (type.equals(String.class)) {
661679
return getStringPredicate((Path<String>)field, filter);
662680
}

0 commit comments

Comments
 (0)