optional Z after date

This commit is contained in:
2025-11-01 02:01:45 +01:00
parent 9f7cf8ad49
commit e2f0ac2dc2

View File

@@ -31,10 +31,12 @@ public class FilterQuery implements GenericFilterQuery {
String[] pathSplit = split[1].split("\\.");
Predicate predicate = switch (split[2]) {
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 "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);
}
@@ -59,7 +61,7 @@ public class FilterQuery implements GenericFilterQuery {
case "le" -> cb.lessThanOrEqualTo(path, value);
case "null" -> cb.isNull(path);
case "nn" -> cb.isNotNull(path);
default -> throw new IllegalArgumentException("unknown filter: " + operator);
default -> throw new IllegalArgumentException("unknown filter operator: " + operator);
};
}