Interface ConstraintEnforcer
-
- All Known Implementing Classes:
ConstraintEnforcerImpl
public interface ConstraintEnforcerTheConstraintEnforcerclass is used to distribute constraints to all subscribers.- See Also:
- EventMaid Documentation
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidenforce(Object constraint)Sends the given constraint to all interested subscribers.<T> SubscriptionIdrespondTo(Class<T> aClass, Consumer<T> responder)Adds the givenConsumerasSubscriberfor the given class.voidunsubscribe(SubscriptionId subscriptionId)Removes allSubscribersmatching the givenSubscriptionId.
-
-
-
Method Detail
-
enforce
void enforce(Object constraint)
Sends the given constraint to all interested subscribers.- Parameters:
constraint- the constraint to be enforced
-
respondTo
<T> SubscriptionId respondTo(Class<T> aClass, Consumer<T> responder)
Adds the givenConsumerasSubscriberfor the given class.- Type Parameters:
T- the type of the constraint- Parameters:
aClass- the class of constraintresponder- theConsumerto be called for a matching constraint- Returns:
- a
SubscriptionIdidentifying theConsumer
-
unsubscribe
void unsubscribe(SubscriptionId subscriptionId)
Removes allSubscribersmatching the givenSubscriptionId.- Parameters:
subscriptionId- theSubscriptionIdto remove
-
-