package se.citerus.dddsample.domain.shared; /** * NOT decorator, used to create a new specifcation that is the inverse (NOT) of the given spec. */ public class NotSpecification extends AbstractSpecification { private Specification spec1; /** * Create a new NOT specification based on another spec. * * @param spec1 Specification instance to not. */ public NotSpecification(final Specification spec1) { this.spec1 = spec1; } /** * {@inheritDoc} */ public boolean isSatisfiedBy(final T t) { return !spec1.isSatisfiedBy(t); } }