JVM | Platform | Status |
---|---|---|
OpenJDK (Temurin) Current | Linux | |
OpenJDK (Temurin) LTS | Linux | |
OpenJDK (Temurin) Current | Windows | |
OpenJDK (Temurin) LTS | Windows |
Trivial parameter validation functions intended for use in HTTP servlet applications.
- Type-safe parameter validation.
- Written in pure Java 21.
- OSGi ready.
- JPMS ready.
- ISC license.
- High-coverage automated test suite.
Use the Vindicator
class to build a validator, and then call check()
. After
calling check()
, parameters can be inspected in a type-safe manner:
final var v =
Vindication.start();
final var p0 =
v.addRequiredParameter("u0", Vindication.integerUnsigned());
final var p1 =
v.addRequiredParameter("u1", Vindication.integerUnsignedLong());
final var p2 =
v.addRequiredParameter("s0", Vindication.integerSigned());
final var p3 =
v.addRequiredParameter("s1", Vindication.integerSignedLong());
final var p4 =
v.addRequiredParameter("i0", Vindication.integerBig());
v.check(Map.ofEntries(
Map.entry("u0", new String[]{"23"}),
Map.entry("u1", new String[]{"24"}),
Map.entry("s0", new String[]{"-23"}),
Map.entry("s1", new String[]{"-24"}),
Map.entry("i0", new String[]{"-4703919738795935661825"})
));
assertEquals(23, p0.get());
assertEquals(24L, p1.get());
assertEquals(-23, p2.get());
assertEquals(-24L, p3.get());
assertEquals(new BigInteger("-4703919738795935661825"), p4.get());