|
Project Wonder 2.0 | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.lang.Throwable java.lang.Exception java.lang.RuntimeException com.webobjects.foundation.NSValidation.ValidationException er.extensions.ERXValidationException
ERXValidationExceptions extends the regular
NSValidation.ValidationException
to add template based resolution of the validation exception. See more
information about resolving templates in the ERXValidationFactory
.
Nested Class Summary |
Field Summary | |
protected NSKeyValueCoding |
_context
holds a reference to the context of the exception |
protected NSArray |
additionalExceptions
caches any set additionalExceptions |
static String |
CustomMethodException
corresponds to a custom method exception |
protected Object |
delegate
holds a reference to the exception delegate |
static String |
ExceedsMaximumLengthException
corresponds to a model thrown 'maximum length of attribute exceeded' exception |
static String |
InvalidNumberException
corresponds to a number formatter exception |
static ERXLogger |
log
logging support |
static String |
MandatoryToManyRelationshipException
corresponds to a model thrown 'manditory toMany relationship' exception |
static String |
MandatoryToOneRelationshipException
corresponds to a model thrown 'mandatory toOne relationship' exception |
protected String |
message
caches the validation message |
protected String |
method
holds the method if one is provided |
static String |
NullPropertyException
corresponds to a model thrown 'null property' exception |
protected Object |
object
holds the object that failed validation |
static String |
ObjectRemovalException
corresponds to a model thrown 'object removal' exception |
static String |
ObjectsRemovalException
corresponds to a model thrown 'objects removal' exception |
protected String |
targetLanguage
holds the target language if provided |
protected String |
type
holds the type of the exception |
protected Object |
value
holds the value that failed validation |
static String |
ValueConversionException
corresponds to a model thrown 'Error converting value of class' exception |
Fields inherited from class com.webobjects.foundation.NSValidation.ValidationException |
_CLASS, AdditionalExceptionsKey, ValidatedKeyUserInfoKey, ValidatedObjectUserInfoKey |
Fields inherited from interface com.webobjects.foundation.NSKeyValueCoding |
_CLASS, NullValue |
Constructor Summary | |
ERXValidationException(String type,
Object object,
String key)
Default constructor that builds a validation exception without the failed value specified. |
|
ERXValidationException(String type,
Object object,
String key,
Object value)
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. |
Method Summary | |
NSArray |
additionalExceptions()
Cover method to return any additional exceptions that occurred. |
EOAttribute |
attribute()
Cover method for getting the attribute corresponding to the propertyKey and entity off of the objet. |
NSKeyValueCoding |
context()
The current context of the validation exception. |
Object |
delegate()
Gets the current delegate for this validation exception. |
String |
displayNameForEntity()
Generates a displayable and localized version of the current object's entity name. |
String |
displayNameForProperty()
Generates a displayable and localized version of the current propertyKey (also called key). |
EOEnterpriseObject |
eoObject()
Cover method that casts the object of
the validation exception to an EOEnterpriseObject. |
boolean |
equals(Object anotherObject)
Compares this exception to anything else. |
String |
getMessage()
Gets the message for this exception. |
boolean |
isCustomMethodException()
Convience method to determine if this exception was a custom thrown exception instead of a model thrown exception. |
protected String |
localizedDisplayNameForKey(String key)
Creates a localized display name for a given key using the class description's displayNameForKey
and then using a localizer for the current "targetLanguage" or
the current localizer to translate the string. |
String |
method()
Returns method name. |
Object |
object()
Overrides super implementation to allow for setable object value. |
String |
propertyKey()
Cover method for returning the key of
the validation exception under the name propertyKey. |
void |
setAdditionalExceptions(NSArray exceptions)
Sets the array of additional exceptions that has occurried. |
void |
setContext(NSKeyValueCoding context)
Sets the context that can be used to resolve key bindings in validation templates. |
void |
setDelegate(Object obj)
Sets the delegate for the current validation exception. |
void |
setMethod(String aMethod)
Sets the custom method name that threw the validation exception. |
void |
setObject(Object aValue)
Sets the object that failed validation. |
void |
setTargetLanguage(String aValue)
Sets the target language to use when rendering the validation message. |
void |
setType(String aType)
Sets the validation type of this exception. |
void |
setValue(Object aValue)
Sets the value that failed validation. |
void |
takeValueForKey(Object obj,
String key)
Implementation of the key value coding. |
String |
targetLanguage()
Returns the target language to display the validation message in. |
String |
toString()
Returns the formatted description of the validation exception without calling getMessage . |
String |
type()
Cover method to return the type of the validation exception. |
Object |
value()
Returns the value that failed validation. |
Object |
valueForKey(String key)
Implementation of key value coding. |
Methods inherited from class com.webobjects.foundation.NSValidation.ValidationException |
aggregateExceptionWithExceptions, exceptionAddingEntriesToUserInfo, exceptionWithObjectAndKey, key, userInfo |
Methods inherited from class java.lang.Throwable |
fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final ERXLogger log
public static final String NullPropertyException
public static final String InvalidNumberException
public static final String MandatoryToOneRelationshipException
public static final String MandatoryToManyRelationshipException
public static final String ObjectRemovalException
public static final String ObjectsRemovalException
public static final String ExceedsMaximumLengthException
public static final String ValueConversionException
public static final String CustomMethodException
protected String message
protected String method
protected String type
protected Object value
protected Object object
protected String targetLanguage
protected NSArray additionalExceptions
protected volatile NSKeyValueCoding _context
protected volatile Object delegate
Constructor Detail |
public ERXValidationException(String type, Object object, String key)
ERXValidationFactory
should be used.
type
- of the exception, should be one of the constaints
defined in this class.object
- that is throwing the exceptionkey
- property key that failed validationpublic ERXValidationException(String type, Object object, String key, Object value)
ERXValidationFactory
should be used.
type
- of the exception, should be one of the constaints
defined in this class.object
- that is throwing the exceptionkey
- property key that failed validationvalue
- that failed validationMethod Detail |
public String getMessage()
public Object valueForKey(String key)
valueForKey
in interface NSKeyValueCoding
key
- to look up
public void takeValueForKey(Object obj, String key)
takeValueForKey
in interface NSKeyValueCoding
obj
- value to be set on this exceptionkey
- to be setpublic boolean isCustomMethodException()
public String method()
public void setMethod(String aMethod)
aMethod
- name to be set.public EOEnterpriseObject eoObject()
object
of
the validation exception to an EOEnterpriseObject.
public Object object()
public String propertyKey()
key
of
the validation exception under the name propertyKey.
public EOAttribute attribute()
public String type()
public void setType(String aType)
aType
- name to set on this validation
exception.public Object value()
public void setValue(Object aValue)
aValue
- that failed validationpublic void setObject(Object aValue)
aValue
- object that failed validationpublic String targetLanguage()
public void setTargetLanguage(String aValue)
aValue
- name fo the language to render the validation
exception in.public Object delegate()
ERXValidationFactory
is returned.
public void setDelegate(Object obj)
obj
- delegate to be used for this validation exception.public NSKeyValueCoding context()
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.
public void setContext(NSKeyValueCoding context)
context
- of the current exceptionpublic void setAdditionalExceptions(NSArray exceptions)
exceptions
- array of additional exceptionspublic NSArray additionalExceptions()
public String displayNameForProperty()
public String displayNameForEntity()
protected String localizedDisplayNameForKey(String key)
displayNameForKey
and then using a localizer for the current "targetLanguage" or
the current localizer to translate the string.
key
- to be translated
public boolean equals(Object anotherObject)
public String toString()
getMessage
.
|
Last updated: Do, Dez 9, 2004 12:46 PM CET | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |