ERXValidationException Class Reference
Inherits com::webobjects::foundation::NSKeyValueCoding.
Inherited by ERAttachmentProcessor< T extends ERAttachment >.ERXAttachmentExceedsLengthException.
List of all members.
Detailed Description
ERXValidationExceptions extends the regular
NSValidation.ValidationException to add template based resolution of the
validation exception. See more information about resolving templates in the
ERXValidationFactory.
Constructor & Destructor Documentation
Default constructor that builds a validation exception without the failed value specified. If you want to have validation templates that refer to the value that didn't pass validation use the four argument constructor. Usually for creating custom validation exceptions the ERXValidationFactory should be used.
- Parameters:
-
| type | of the exception, should be one of the constaints defined in this class. |
| object | that is throwing the exception |
| key | property key that failed validation |
Default constructor that builds a validation exception based on the type, object, key and failed value.Usually for creating custom validation exceptions the ERXValidationFactory should be used.
- Parameters:
-
| type | of the exception, should be one of the constaints defined in this class. |
| object | that is throwing the exception |
| key | property key that failed validation |
| value | that failed validation |
Member Function Documentation
| String _getMessage |
( |
|
) |
[protected] |
Cover method to return any additional exceptions that occurred. The reason this method is needed is because we wanted to have the ability to set the additional exceptions.
- Returns:
- array of additional exceptions
| EOAttribute attribute |
( |
|
) |
|
Cover method for getting the attribute corresponding to the propertyKey and entity off of the objet.
- Returns:
- EOAttribute corresponding to the propertyKey and entity.
| NSKeyValueCoding context |
( |
|
) |
|
The current context of the validation exception. Context objects are mainly used for resolving keys in validation templates. When validation exceptions are thrown in D2W pages the current D2WContext is set as the current context on the exceptions. If a context is not set then the contextForException is called off of the default ERXValidationFactory. When this also returns null, then the exception will be used as its context. This is needed because of some of the templates in ERDirectToWeb which use context.propertyKey and will display ? if none is given.
- Returns:
- current context for the validation exception.
| String displayNameForEntity |
( |
|
) |
|
Generates a displayable and localized version of the current object's entity name.
- Returns:
- localized displayable version of an object's entity name.
| String displayNameForProperty |
( |
|
) |
|
Generates a displayable and localized version of the current propertyKey (also called key).
- Returns:
- localized displayable version of the current propertyKey.
| EOEnterpriseObject eoObject |
( |
|
) |
|
Cover method that casts the object of the validation exception to an EOEnterpriseObject.
- Returns:
- object cast as an enterprise object.
| boolean equals |
( |
Object |
anotherObject |
) |
|
Compares this exception to anything else.
- Returns:
- description of the validation exception
Gets the message for this exception.
- Returns:
- the correctly formatted validation exception.
| boolean isCustomMethodException |
( |
|
) |
|
Convience method to determine if this exception was a custom thrown exception instead of a model thrown exception. A custom exception would be an exception that you throw in your validateFoo method if a particular constraint is not valid.
- Returns:
- if this exception is a custom thrown exception.
| String localizedDisplayNameForKey |
( |
String |
key |
) |
[protected] |
Creates a localized display name for a given key trying to localize it with the current "targetLanguage" or the current localizer. If there is an eoObject first try to localize "entityName.key" then "key" if nothing found.
- Parameters:
-
- Returns:
- localized display version of the given key.
Returns method name. The method name is only set if the validation exception is a custom validation exception.
- Returns:
- custom method name.
Overrides super implementation to allow for setable object value.
- Returns:
- object object for this exception.
Cover method for returning the key of the validation exception under the name propertyKey.
- Returns:
- the key of the validation exception
| void setAdditionalExceptions |
( |
NSArray |
exceptions |
) |
|
Sets the array of additional exceptions that has occurried.
- Parameters:
-
| exceptions | array of additional exceptions |
| void setContext |
( |
NSKeyValueCoding |
context |
) |
|
Sets the context that can be used to resolve key bindings in validation templates.
- Parameters:
-
| context | of the current exception |
| void setDelegate |
( |
Object |
obj |
) |
|
Sets the delegate for the current validation exception. The delegate can intervine to provide a different template for the validation exception or resolve the template in a different manner.
- Parameters:
-
| obj | delegate to be used for this validation exception. |
| void setMethod |
( |
String |
aMethod |
) |
|
Sets the custom method name that threw the validation exception.
- Parameters:
-
| void setObject |
( |
Object |
aValue |
) |
|
Sets the object that failed validation.
- Parameters:
-
| void setTargetLanguage |
( |
String |
aValue |
) |
|
Sets the target language to use when rendering the validation message. Only set a target language if you want to override the current language of the thread.
- Parameters:
-
| aValue | name fo the language to render the validation exception in. |
Sets the validation type of this exception. Should correspond to one of the type constants defined in this class. All of the model thrown validation exceptions should have the correct type already set.
- Parameters:
-
| void setValue |
( |
Object |
aValue |
) |
|
Sets the value that failed validation.
- Parameters:
-
| void takeValueForKey |
( |
Object |
obj, |
|
|
String |
key | |
|
) |
| | |
Implementation of the key value coding. Uses the default implementation.
- Parameters:
-
| obj | value to be set on this exception |
| key | to be set |
Returns the target language to display the validation message in. If a target language is not set then the current default language for the current thread is used.
- Returns:
- target language if one is set.
Returns the formatted description of the validation exception without calling getMessage.
- Returns:
- description of the validation exception
Cover method to return the type of the validation exception. The corresponds to one of the constant strings defined in this class.
- Returns:
- the type of this validation exception.
| Object valueForKey |
( |
String |
key |
) |
|
Implementation of key value coding. Uses the default implementation.
- Parameters:
-
- Returns:
- result of the lookup on the object
Member Data Documentation
volatile NSKeyValueCoding _context [protected] |
holds a reference to the context of the exception
caches any set additionalExceptions
corresponds to a custom method exception
holds a reference to the exception delegate
corresponds to a model thrown 'maximum length of attribute exceeded' exception
corresponds to a number formatter exception
corresponds to a generic 'invalid value' exception
final Logger log = Logger.getLogger(ERXValidationException.class) [static] |
corresponds to a model thrown 'manditory toMany relationship' exception
corresponds to a model thrown 'mandatory toOne relationship' exception
holds the method if one is provided
corresponds to a model thrown 'null property' exception
corresponds to a model thrown 'object removal' exception
corresponds to a model thrown 'objects removal' exception
holds the target language if provided
holds the type of the exception
corresponds to a model thrown 'Error converting value of class' exception
The documentation for this class was generated from the following file: