optional Z after date
This commit is contained in:
@@ -31,10 +31,12 @@ public class FilterQuery implements GenericFilterQuery {
|
|||||||
String[] pathSplit = split[1].split("\\.");
|
String[] pathSplit = split[1].split("\\.");
|
||||||
Predicate predicate = switch (split[2]) {
|
Predicate predicate = switch (split[2]) {
|
||||||
case "int" -> filterGeneric(cb, root, pathSplit, split[0], Integer.parseInt(split[3]));
|
case "int" -> filterGeneric(cb, root, pathSplit, split[0], Integer.parseInt(split[3]));
|
||||||
case "date" -> filterGeneric(cb, root, pathSplit, split[0], Date.from(Instant.parse(split[3])));
|
case "date" ->
|
||||||
|
filterGeneric(cb, root, pathSplit, split[0], Date.from(Instant.parse(split[3].endsWith("Z") ? split[3] : split[3] + "Z")));
|
||||||
case "localdate" -> filterGeneric(cb, root, pathSplit, split[0], LocalDate.parse(split[3]));
|
case "localdate" -> filterGeneric(cb, root, pathSplit, split[0], LocalDate.parse(split[3]));
|
||||||
case "localtime" -> filterGeneric(cb, root, pathSplit, split[0], LocalTime.parse(split[3]));
|
case "localtime" -> filterGeneric(cb, root, pathSplit, split[0], LocalTime.parse(split[3]));
|
||||||
default -> filterGeneric(cb, root, pathSplit, split[0], split[3]);
|
case "string" -> filterGeneric(cb, root, pathSplit, split[0], split[3]);
|
||||||
|
default -> throw new IllegalArgumentException("unknown filter datatype: " + split[2]);
|
||||||
};
|
};
|
||||||
predicates.add(predicate);
|
predicates.add(predicate);
|
||||||
}
|
}
|
||||||
@@ -59,7 +61,7 @@ public class FilterQuery implements GenericFilterQuery {
|
|||||||
case "le" -> cb.lessThanOrEqualTo(path, value);
|
case "le" -> cb.lessThanOrEqualTo(path, value);
|
||||||
case "null" -> cb.isNull(path);
|
case "null" -> cb.isNull(path);
|
||||||
case "nn" -> cb.isNotNull(path);
|
case "nn" -> cb.isNotNull(path);
|
||||||
default -> throw new IllegalArgumentException("unknown filter: " + operator);
|
default -> throw new IllegalArgumentException("unknown filter operator: " + operator);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user