ewe.database
Interface DataValidator
- All Known Implementing Classes:
- FieldModifier
- public interface DataValidator
|
Method Summary |
void |
validateEntry(Database database,
DatabaseEntry newData,
DatabaseEntry oldData)
This method can be used to either alter data before it is saved into the database or
to abort a particular operation by throwing an InvalidDataException. |
validateEntry
public void validateEntry(Database database,
DatabaseEntry newData,
DatabaseEntry oldData)
throws InvalidDataException,
IOException
- This method can be used to either alter data before it is saved into the database or
to abort a particular operation by throwing an InvalidDataException.
This method is called under four circumstances.
- When a new DatabaseEntry is being saved - in which case the newData parameter
holds the new data while the oldData parameter will be null.
- When a DatabaseEntry is being modified - in which case the newData parameter
holds the new data while the oldData parameter will hold the old data.
- When a DatabaseEntry is being deleted - in which case the newData parameter
will be null while the oldData parameter will hold the old data.
- When a DatabaseEntry is being read - in which case the newData parameter refers
to the same object as the oldData parameter (i.e. newData == oldData).
- Parameters:
database - The Database that holds the data.newData - The data being saved or changed or read. If you need to modify the data,
then modify this parameter.oldData - The original data before the change or deletion.
- Throws:
InvalidDataException - If the operation should be disallowed due to bad data.
IOException