Implemented by:
- EOEnterpriseObject
- EOCustomObject
- EOGenericRecord
- Package:
- com.apple.client.eocontrol
- com.apple.yellow.eocontrol
The EOValidation interface defines the way that enterprise objects validate their values. The validation methods check for illegal value types, values outside of established limits, illegal relationships, and so on. EOCustomObject and EOGenericRecord provide default implementations of EOValidation, which are described in detail in this specification.
There are two kinds of validation methods. The first validates individual properties, and the second validates an entire object to see if it's ready for a specific operation (inserting, updating, and deleting). The two different types are discussed in more detail in the sections "Validating Individual Properties" and "Validating Before an Operation".
public abstract void
validateForDelete
()
EOCustomObject's implementation sends the receiver's EOClassDescription
a message (which performs basic checking based on the presence or
absence of values). Subclasses should invoke super
's implementation
before performing their own validation, and should combine any exception thrown by super
's
implementation with their own.
See Also:
propagateDeleteWithEditingContext (EOEnterpriseObject), EOValidation.
Exception constructor
public abstract void
validateForInsert
()
The method validateForSave
is the
generic validation method for when an object is written to the external
store. If an object performs validation that isn't specific to
insertion, it should go in validateForSave
.
public abstract void
validateForSave
()
userInfo
dictionary
under the EOValidation.Exception.
AdditionalExceptionsKey. Subclasses
should invoke super
's implementation before
performing their own validation, and should combine any exception thrown by super
's implementation
with their own.
Enterprise objects can implement this method to check that
certain relations between properties hold; for example, that the
end date of a vacation period follows the begin date. To validate
an individual property, you can simply implement a method for it
as described under validateValueForKey
.
See Also:
EOValidation.
Exception constructor
public abstract void
validateForUpdate
()
The method validateForSave
is the
generic validation method for when an object is written to the external
store. If an object performs validation that isn't specific to
updating, it should go in validateForSave
.
public abstract Object
validateValueForKey
(
Object value,
String key)
Enterprise objects can implement individual validate
Key methods
to check limits, test for nonsense values, and otherwise confirm
individual properties. To validate multiple properties based on
relations among them, override the appropriate
validateFor...
method.
See Also:
EOValidation.
Exception constructor