- Type Parameters:
V- type of the entity attribute or a subtype or primitive wrapper type for the entity attribute.
- All Superinterfaces:
Constraint<V>
A constraint that requires a null value.
A parameter-based repository method can impose a constraint on an
entity attribute by defining a method parameter that is of type
Null. For example,
@Find
List<Car> ofUnknownModel(@By(_Car.MAKE) String make,
@By(_Car.MODEL) Null<String> nullModel);
...
found = cars.ofUnknownModel("Jakarta Motors",
Null.instance());
Repository methods can also accept Null constraints at run time
in the form of a Restriction on an Expression. For example,
@Find
List<Car> searchAll(Restriction<Car> restrict, Order<Car> sorts);
...
found = cars.searchAll(Restrict.all(_Car.make.equalTo("Jakarta Motors"),
_Car.model.isNull()),
Order.by(_Car.year.desc(),
_Car.price.asc()));
The entity and static metamodel for the code
examples within this class are shown in the Attribute Javadoc.
- Since:
- 1.1
-
Method Summary
Static MethodsMethods inherited from interface jakarta.data.constraint.Constraint
negate
-
Method Details
-
instance
Requires that the constraint target has a
nullvalue. For example,found = cars.ofMakeAndModel("Jakarta Motors", Null.instance());- Type Parameters:
V- type of the entity attribute or a subtype or primitive wrapper type for the entity attribute.- Returns:
- a
Nullconstraint.
-