From 7c279747beb43c7e88633a6228a155a30e6834f7 Mon Sep 17 00:00:00 2001 From: Benjamin Culkin Date: Mon, 27 May 2024 11:38:33 -0400 Subject: Initial import --- .../israfil/foundation/valuemodel/Vetoable.java | 44 ++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 israfil-foundation-valuemodel/src/main/java/net/israfil/foundation/valuemodel/Vetoable.java (limited to 'israfil-foundation-valuemodel/src/main/java/net/israfil/foundation/valuemodel/Vetoable.java') diff --git a/israfil-foundation-valuemodel/src/main/java/net/israfil/foundation/valuemodel/Vetoable.java b/israfil-foundation-valuemodel/src/main/java/net/israfil/foundation/valuemodel/Vetoable.java new file mode 100644 index 0000000..5369287 --- /dev/null +++ b/israfil-foundation-valuemodel/src/main/java/net/israfil/foundation/valuemodel/Vetoable.java @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2003-2007 Israfil Consulting Services Corporation + * Copyright (c) 2003-2007 Christian Edward Gruber + * All Rights Reserved + * + * $Id: Types.java 129 2006-12-31 23:20:02Z cgruber $ + */ +package net.israfil.foundation.valuemodel; + +/** + * An interface for objects that can notify observers of changes to itself + * before the change. The objects thus notified can veto the change. The + * specific behaviour for vetoing is undefined and is dependent upon the + * particular implementation of the vetoable object and its vetoers. + * The changing object should call the provided callback signature, with the + * parameter being the object that was changed in its new state. The vetoer + * is responsible for knowing what it needs to know in order to validate or + * veto the change. + * + * Using a dynamic selector rather than a strong interface allows code + * to be notified of the change even if it was not constructed with the + * notification interface, though it does need to match the signature. + * + * @author Christian Edward Gruber + * @author Latest: $Author: cgruber $ + * @version $Revision: 129 $ + */ +public interface Vetoable { + + /** Add one or more vetoers to this object, with a callback method spec + * that will be invoked upon a data change. The callback method should + * contain three parameters. The first is the notification source (the + * holder or whatever), the second the old value, and the third the new + * value. It also should return a boolean approving the change (or + * returning false to veto it) + */ + public void addVetoers(String callback, Object ... approvers); + + /** + * Remove one or more vetoers from vetoable object. + */ + public void removeVetoers(Object ... approvers); + +} -- cgit v1.2.3