org.datamanager.kernel
Class AbstractEventConstraint
java.lang.Object
|
+--org.datamanager.kernel.AbstractEventConstraint
- All Implemented Interfaces:
- Constraint, EntityValue, EventConstraint, Serializable
- Direct Known Subclasses:
- AndEventConstraint, EventContainsEntityConstraint, EventTypeIsConstraint, NotEventConstraint, OrEventConstraint
- public abstract class AbstractEventConstraint
- extends Object
- implements EventConstraint
This class is an abstract EventConstraint class. It implements the
EventConstraint interface located in org.datamanager.constraint,
and provides a public describes() method, which is exactly the
same as the public abstract accepts() method in EventConstriant.
Every EventConstraint should ideally extend this class instead of
implementing EventConstraint themselves. By doing so the constraint
will gain extra power while working with Entities in the kernel.
For example, a when a constraint is working on an Entity, calling
methods such as getValue() and getAttributes(), it should not
cause DataManagerEvents to be fired. If the constriant is a
subclass of AbstractConstraint then no events will be fired,
otherwise events will.
If a constraint has already been written to implement
EventConstraint it can easily be modified to use this class
instead simply by changing implements EventConstraint to
extends AbstractEventConstraint and renaming the accepts() method
to describes().
- Version:
- $Revision: 1.9 $
- Author:
- Matthew Farrellee
- See Also:
EntityConstraint
,
DataManagerEvent
,
Serialized Form
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DEBUG_ACCEPTS_MESSAGE
public static final String DEBUG_ACCEPTS_MESSAGE
- See Also:
- Constant Field Values
AbstractEventConstraint
public AbstractEventConstraint()
accepts
public final boolean accepts(DataManagerEvent event)
throws DataManagerException
- The accepts() method required by the EventConstraint interface.
This class implements this method and makes it final, so
no subclasses can override the work that is done by this
class. Eventually this accepts() method will call the
describes() method that should be implemented by subclasses.
- Specified by:
accepts
in interface EventConstraint
- Parameters:
event
- An event to check.
- Returns:
- Whether the event is acceptable or not.
DataManagerException
describes
protected abstract boolean describes(DataManagerEvent event)
throws DataManagerException
- The method required by this class. This method has the
exact same semantics as the interface EventConstraint's
accepts() method.
- Parameters:
event
- An entity to check.
- Returns:
- Whether the event is acceptable or not.
DataManagerException
See the Helium Website