Class IdentitySpecification<A extends AggregateRoot<I>,I>
- java.lang.Object
-
- org.seedstack.business.specification.IdentitySpecification<A,I>
-
- Type Parameters:
A- the aggregate type this specification applies to.I- the aggregate identifier type.
- All Implemented Interfaces:
Specification<A>
public class IdentitySpecification<A extends AggregateRoot<I>,I> extends Object implements Specification<A>
A specification that can only be applied toAggregateRoots and that is satisfied only if the candidate aggregate has an identifier equal to the expected one.
-
-
Constructor Summary
Constructors Constructor Description IdentitySpecification(I expectedIdentifier)Creates a specification satisfied only if the candidate aggregate has an identifier equal to the identifier passed as argument.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description IgetExpectedIdentifier()Returns the identifier that is expected.booleanisSatisfiedBy(A candidate)Evaluates if the candidate object passed as argument satisfies the specification.StringtoString()-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.seedstack.business.specification.Specification
and, asPredicate, negate, or
-
-
-
-
Constructor Detail
-
IdentitySpecification
public IdentitySpecification(I expectedIdentifier)
Creates a specification satisfied only if the candidate aggregate has an identifier equal to the identifier passed as argument.- Parameters:
expectedIdentifier- the expected identifier.
-
-
Method Detail
-
isSatisfiedBy
public boolean isSatisfiedBy(A candidate)
Description copied from interface:SpecificationEvaluates if the candidate object passed as argument satisfies the specification.- Specified by:
isSatisfiedByin interfaceSpecification<A extends AggregateRoot<I>>- Parameters:
candidate- the candidate object to check.- Returns:
- true if the candidate object satisfies the specification, false otherwise.
-
getExpectedIdentifier
public I getExpectedIdentifier()
Returns the identifier that is expected.- Returns:
- the expected identifier.
-
-