diff --git a/pom.xml b/pom.xml
index 90a3020..4c3d531 100644
--- a/pom.xml
+++ b/pom.xml
@@ -6,12 +6,12 @@
dev.struchkov.haiti
haiti
- 0.0.4
+ 1.4.0
dev.struchkov.haiti.filter
haiti-filter-criteria
- 0.0.4
+ 0.0.5
Haiti Filter Criteria
Fast creation of filtering requests using the Criteria Api wrapper.
@@ -28,13 +28,12 @@
- 11
+ 17
${java.version}
${java.version}
UTF-8
UTF-8
- 0.0.4
1.0.1
3.9.0
diff --git a/src/main/java/dev/struchkov/haiti/filter/criteria/CriteriaQuery.java b/src/main/java/dev/struchkov/haiti/filter/criteria/CriteriaQuery.java
index 10b0e9a..f69cefb 100644
--- a/src/main/java/dev/struchkov/haiti/filter/criteria/CriteriaQuery.java
+++ b/src/main/java/dev/struchkov/haiti/filter/criteria/CriteriaQuery.java
@@ -2,6 +2,7 @@ package dev.struchkov.haiti.filter.criteria;
import dev.struchkov.haiti.filter.FilterQuery;
+import dev.struchkov.haiti.utils.Inspector;
import java.util.ArrayList;
import java.util.Arrays;
@@ -9,8 +10,7 @@ import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
-import static dev.struchkov.haiti.utils.Assert.Utils.nullPointer;
-import static dev.struchkov.haiti.utils.Assert.isNotNull;
+import static dev.struchkov.haiti.utils.Inspector.Utils.nullPointer;
public class CriteriaQuery implements FilterQuery {
@@ -36,7 +36,7 @@ public class CriteriaQuery implements FilterQuery {
* @param fieldName Имя поля сущности, которое отвечает за название таблицы.
*/
public CriteriaQuery join(String... fieldName) {
- isNotNull(fieldName, nullPointer("fieldName"));
+ Inspector.isNotNull(fieldName, nullPointer("fieldName"));
joinTables = Arrays.stream(fieldName)
.map(JoinTable::of)
.collect(Collectors.toList());
@@ -44,14 +44,14 @@ public class CriteriaQuery implements FilterQuery {
}
public CriteriaQuery join(JoinTable... joinTables) {
- isNotNull(joinTables, nullPointer("joinTables"));
+ Inspector.isNotNull(joinTables, nullPointer("joinTables"));
this.joinTables = Arrays.stream(joinTables).collect(Collectors.toList());
return this;
}
@Override
public > FilterQuery between(String field, Y from, Y to) {
- isNotNull(field, nullPointer(FIELD_NAME));
+ Inspector.isNotNull(field, nullPointer(FIELD_NAME));
if (from != null && to != null) {
containers.add(simpleCriteriaQuery.between(joinTables, field, from, to));
}
@@ -60,7 +60,7 @@ public class CriteriaQuery implements FilterQuery {
@Override
public > FilterQuery greaterThan(String field, Y value) {
- isNotNull(field, nullPointer(FIELD_NAME));
+ Inspector.isNotNull(field, nullPointer(FIELD_NAME));
if (value != null) {
containers.add(simpleCriteriaQuery.greaterThan(joinTables, field, value));
}
@@ -69,7 +69,7 @@ public class CriteriaQuery implements FilterQuery {
@Override
public > FilterQuery lessThan(String field, Y value) {
- isNotNull(field, nullPointer(FIELD_NAME));
+ Inspector.isNotNull(field, nullPointer(FIELD_NAME));
if (value != null) {
containers.add(simpleCriteriaQuery.lessThan(joinTables, field, value));
}
@@ -78,7 +78,7 @@ public class CriteriaQuery implements FilterQuery {
@Override
public FilterQuery matchPhrase(String field, Object value) {
- isNotNull(field, nullPointer(FIELD_NAME));
+ Inspector.isNotNull(field, nullPointer(FIELD_NAME));
if (value != null) {
containers.add(simpleCriteriaQuery.matchPhrase(joinTables, field, value));
}
@@ -87,7 +87,7 @@ public class CriteriaQuery implements FilterQuery {
@Override
public FilterQuery matchPhrase(String field, Set values) {
- isNotNull(field, nullPointer(FIELD_NAME));
+ Inspector.isNotNull(field, nullPointer(FIELD_NAME));
if (values != null && !values.isEmpty()) {
containers.addAll(
values.stream()
@@ -119,7 +119,7 @@ public class CriteriaQuery implements FilterQuery {
@Override
public FilterQuery like(String field, String value, boolean ignoreCase) {
- isNotNull(field, nullPointer(FIELD_NAME));
+ Inspector.isNotNull(field, nullPointer(FIELD_NAME));
containers.add(
ignoreCase
? simpleCriteriaQuery.likeIgnoreCase(joinTables, field, value)
@@ -130,7 +130,7 @@ public class CriteriaQuery implements FilterQuery {
@Override
public FilterQuery checkBoolInt(String field, Boolean flag) {
- isNotNull(field, nullPointer(FIELD_NAME));
+ Inspector.isNotNull(field, nullPointer(FIELD_NAME));
if (flag != null) {
containers.add(
simpleCriteriaQuery.between(joinTables, field, 0, Integer.MAX_VALUE)
diff --git a/src/main/java/dev/struchkov/haiti/filter/criteria/JoinTable.java b/src/main/java/dev/struchkov/haiti/filter/criteria/JoinTable.java
index 3bef8df..4a2e60c 100644
--- a/src/main/java/dev/struchkov/haiti/filter/criteria/JoinTable.java
+++ b/src/main/java/dev/struchkov/haiti/filter/criteria/JoinTable.java
@@ -1,8 +1,8 @@
package dev.struchkov.haiti.filter.criteria;
-import dev.struchkov.haiti.utils.Assert;
+import dev.struchkov.haiti.utils.Inspector;
-import static dev.struchkov.haiti.utils.Assert.Utils.nullPointer;
+import static dev.struchkov.haiti.utils.Inspector.Utils.nullPointer;
/**
* @author upagge 15.04.2021
@@ -18,12 +18,12 @@ public class JoinTable {
}
public static JoinTable of(String tableName) {
- Assert.isNotNull(tableName, nullPointer("tableName"));
+ Inspector.isNotNull(tableName, nullPointer("tableName"));
return new JoinTable(tableName, JoinTypeOperation.LEFT);
}
public static JoinTable of(String tableName, JoinTypeOperation joinType) {
- Assert.isNotNull(tableName, nullPointer("tableName"));
+ Inspector.isNotNull(tableName, nullPointer("tableName"));
return new JoinTable(tableName, joinType);
}
diff --git a/src/main/java/dev/struchkov/haiti/filter/criteria/SimpleCriteriaQuery.java b/src/main/java/dev/struchkov/haiti/filter/criteria/SimpleCriteriaQuery.java
index 3ea1294..98040ac 100644
--- a/src/main/java/dev/struchkov/haiti/filter/criteria/SimpleCriteriaQuery.java
+++ b/src/main/java/dev/struchkov/haiti/filter/criteria/SimpleCriteriaQuery.java
@@ -1,6 +1,6 @@
package dev.struchkov.haiti.filter.criteria;
-import dev.struchkov.haiti.utils.Assert;
+import dev.struchkov.haiti.utils.Inspector;
import org.hibernate.query.criteria.internal.path.PluralAttributeJoinSupport;
import javax.persistence.criteria.From;
@@ -15,7 +15,7 @@ import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
-import static dev.struchkov.haiti.utils.Assert.Utils.nullPointer;
+import static dev.struchkov.haiti.utils.Inspector.Utils.nullPointer;
public class SimpleCriteriaQuery {
@@ -26,8 +26,8 @@ public class SimpleCriteriaQuery {
private final Map> joinMap = new HashMap<>();
public Container matchPhrase(List joinTables, String field, Object value) {
- Assert.isNotNull(field, nullPointer(FIELD));
- Assert.isNotNull(value, nullPointer("value"));
+ Inspector.isNotNull(field, nullPointer(FIELD));
+ Inspector.isNotNull(value, nullPointer("value"));
final Container container = Container.of(joinTables);
container.setSpecification((root, query, cb) -> cb.equal(getPath(root, container).get(field), value));
@@ -46,7 +46,7 @@ public class SimpleCriteriaQuery {
}
public Container exists(List joinTables, String field) {
- Assert.isNotNull(field, nullPointer(FIELD));
+ Inspector.isNotNull(field, nullPointer(FIELD));
final Container container = Container.of(joinTables);
container.setSpecification((root, query, cb) -> cb.isNotNull(getPath(root, container).get(field)));
@@ -54,7 +54,7 @@ public class SimpleCriteriaQuery {
}
public Container likeIgnoreCase(List joinTables, String field, String value) {
- Assert.isNotNull(field, nullPointer(FIELD));
+ Inspector.isNotNull(field, nullPointer(FIELD));
final Container container = Container.of(joinTables);
container.setSpecification((root, query, cb) -> cb.like(cb.lower(getPath(root, container).get(field)), value));
@@ -62,7 +62,7 @@ public class SimpleCriteriaQuery {
}
public Container like(List joinTables, String field, String value) {
- Assert.isNotNull(field, nullPointer(FIELD));
+ Inspector.isNotNull(field, nullPointer(FIELD));
final Container container = Container.of(joinTables);
container.setSpecification((root, query, cb) -> cb.like(getPath(root, container).get(field), value));
@@ -70,7 +70,7 @@ public class SimpleCriteriaQuery {
}
public > Container between(List joinTables, String field, Y from, Y to) {
- Assert.isNotNull(field, nullPointer(FIELD));
+ Inspector.isNotNull(field, nullPointer(FIELD));
final Container container = Container.of(joinTables);
container.setSpecification((root, query, cb) -> cb.between(getPath(root, container).get(field), from, to));
@@ -78,7 +78,7 @@ public class SimpleCriteriaQuery {
}
public > Container greaterThan(List joinTables, String field, Y value) {
- Assert.isNotNull(field, nullPointer(FIELD));
+ Inspector.isNotNull(field, nullPointer(FIELD));
final Container container = Container.of(joinTables);
container.setSpecification(((root, query, cb) -> cb.greaterThan(getPath(root, container).get(field), value)));
@@ -86,7 +86,7 @@ public class SimpleCriteriaQuery {
}
public > Container lessThan(List joinTables, String field, Y value) {
- Assert.isNotNull(field, nullPointer(FIELD));
+ Inspector.isNotNull(field, nullPointer(FIELD));
final Container container = Container.of(joinTables);
container.setSpecification(((root, query, cb) -> cb.lessThan(getPath(root, container).get(field), value)));