Interface GenericContractValidator<T extends AbstractContractModel>
-
- Type Parameters:
T
-
- All Known Subinterfaces:
AccessContractValidator
,IngestContractValidator
,ManagementContractValidator
public interface GenericContractValidator<T extends AbstractContractModel>
Used to validate contracts (any class that extends AbstractContractModel) and to apply acceptance rules. Bellow the example of usage :private static GenericContractValidator checkDuplicateInDatabaseValidator() { return (contract, contractName) -> { GenericRejectionCause rejection = null; boolean exist = ... exists in database?; if (exist) { rejection = GenericRejectionCause.rejectDuplicatedInDatabase(contractName); } return (rejection == null) ? Optional.empty() : Optional.of(rejection); }; }
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
GenericContractValidator.GenericRejectionCause
Generic Rejection Cause inner class
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description java.util.Optional<GenericContractValidator.GenericRejectionCause>
validate(T contract, java.lang.String contractName)
Validate a contract object
-
-
-
Method Detail
-
validate
java.util.Optional<GenericContractValidator.GenericRejectionCause> validate(T contract, java.lang.String contractName)
Validate a contract object- Parameters:
contract
- to validatecontractName
-- Returns:
- empty optional if OK, Else return the rejection cause
-
-