T
- the type of the candidate object the specification applies to.@FunctionalInterface public interface Specification<T>
Specification
is a pattern that is able to tell if a candidate object matches some
criteria. The specification has a method isSatisfiedBy(Object)
that returns true if all
criteria are met by the candidate.Modifier and Type | Method and Description |
---|---|
default Specification<T> |
and(Specification<? super T> other)
Compose this specification with another specification through a logical AND.
|
static <T> Specification<T> |
any()
Special value for an always true specification.
|
default Predicate<T> |
asPredicate()
Express this specification as a Java
Predicate . |
boolean |
isSatisfiedBy(T candidate)
Evaluates if the candidate object passed as argument satisfies the specification.
|
default Specification<T> |
negate()
Negate this specification.
|
static <T> Specification<T> |
none()
Special value for an always false specification.
|
default Specification<T> |
or(Specification<? super T> other)
Compose this specification with another specification through a logical OR.
|
static <T> Specification<T> any()
T
- the type of the candidate object the specification applies to.TrueSpecification
.static <T> Specification<T> none()
T
- the type of the candidate object the specification applies to.FalseSpecification
.default Specification<T> and(Specification<? super T> other)
other
- the other specification.AndSpecification
composing this specification with the specification passed
as argument.default Specification<T> negate()
NotSpecification
negating this specification.default Specification<T> or(Specification<? super T> other)
other
- the other specification.OrSpecification
composing this specification with the specification passed
as argument.default Predicate<T> asPredicate()
Predicate
.Predicate
corresponding to this specification.boolean isSatisfiedBy(T candidate)
candidate
- the candidate object to check.Copyright © 2013-2018–2019 SeedStack. All rights reserved.