
org.seedstack.business.specification.SubstitutableSpecification Maven / Gradle / Ivy
/*
* Copyright © 2013-2024, The SeedStack authors
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
package org.seedstack.business.specification;
/**
* Specifications that can be substituted by another specification without changing the
* satisfaction result should implement this interface.
*
* @param the type of the candidate object the specification applies to.
*/
public interface SubstitutableSpecification extends Specification {
/**
* Returns the specification it can be be substituted with.
*
* @return the specification this specification can be substituted with.
*/
Specification getSubstitute();
@Override
default boolean isSatisfiedBy(T candidate) {
return getSubstitute().isSatisfiedBy(candidate);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy