|
Project Wonder 2.0 | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object er.extensions.ERXValidationFactory
The validation factory controls creating validation exceptions, both from model thrown exceptions and custom validation exceptions. The factory is responsible for resolving validation remplates for validation exceptions and generating validation messages.
Nested Class Summary | |
static interface |
ERXValidationFactory.ExceptionDelegateInterface
Exception delegates can be used to provide hooks to customize how messages are generated for validation exceptions and how tempates are looked up. |
static interface |
ERXValidationFactory.FactoryInterface
The validation factory interface. |
Field Summary | |
static ERXLogger |
log
logging support |
protected Constructor |
regularConstructor
caches the constructor used to build validation exceptions |
static String |
VALIDATION_TEMPLATE_PREFIX
holds the value 'ValidationTemplate.' |
Constructor Summary | |
ERXValidationFactory()
|
Method Summary | |
void |
configureFactory()
Method used to configure the validation factory for operation. |
NSKeyValueCoding |
contextForException(ERXValidationException erv)
The context for a given validation exception can be used to resolve keys in validation template. |
protected NSArray |
convertAdditionalExceptions(NSValidation.ValidationException ex)
Converts the additional exceptions contained in an Exception to ERXValidationException subclasses. |
ERXValidationException |
convertException(NSValidation.ValidationException eov)
Converts a model thrown validation exception into an ERXValidationException .
|
ERXValidationException |
convertException(NSValidation.ValidationException eov,
Object value)
Converts a given model thrown validation exception into an ERXValidationException .
|
ERXValidationException |
createCustomException(EOEnterpriseObject eo,
String method)
Creates a custom validation exception for a given enterprise object and method. |
ERXValidationException |
createCustomException(EOEnterpriseObject eo,
String property,
Object value,
String method)
Creates a custom validation exception. |
ERXValidationException |
createException(EOEnterpriseObject eo,
String property,
Object value,
String type)
Entry point for creating validation exceptions. |
static Object |
defaultDelegate()
Returns the default validation delegate that will be set on all validation exceptions created. |
static ERXValidationFactory |
defaultFactory()
Returns the default factory. |
String |
messageForException(ERXValidationException erv)
Entry point for generating an exception message for a given message. |
protected Constructor |
regularValidationExceptionConstructor()
Simple method used to lookup and cache the constructor to build validation exceptions. |
void |
resetTemplateCache(NSNotification n)
Called when the Localizer is reset. |
static void |
setDefaultDelegate(Object obj)
Sets the default validation delegate that will be set on all validation exceptions that are created by the factory. |
static void |
setDefaultFactory(ERXValidationFactory aFactory)
Sets the default factory to be used for converting model thrown exceptions. |
void |
setDelimiter(String delimiter)
sets the template delimiter to be used when parsing templates for creating validation exception messages. |
void |
setValidationExceptionClass(Class class1)
Sets the validation class to be used when creating validation exceptions. |
boolean |
shouldRecreateException(ERXValidationException erv,
Object value)
Decides if an existing ERXValidationException
should be re-created. |
String |
templateDelimiter()
Returns the template delimiter, the default delimiter is "@". |
protected String |
templateForEntityPropertyType(String entityName,
String property,
String type,
String targetLanguage)
Finds a template for a given entity, property key, exception type and target language. |
String |
templateForException(ERXValidationException erv)
Entry point for finding a template for a given validation exception. |
String |
templateForKeyPath(String key,
String language)
Get the template for a given key in a given language. |
Class |
validationExceptionClass()
Returns the validation exception class to use when creating exceptions. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final ERXLogger log
public static final String VALIDATION_TEMPLATE_PREFIX
protected Constructor regularConstructor
Constructor Detail |
public ERXValidationFactory()
Method Detail |
public static void setDefaultFactory(ERXValidationFactory aFactory)
aFactory
- new factorypublic static ERXValidationFactory defaultFactory()
public static Object defaultDelegate()
public static void setDefaultDelegate(Object obj)
obj
- default validation delegatepublic void setValidationExceptionClass(Class class1)
class1
- validation exception classpublic Class validationExceptionClass()
ERXValidationException
is used.
protected Constructor regularValidationExceptionConstructor()
public ERXValidationException createException(EOEnterpriseObject eo, String property, Object value, String type)
ERXValidationException
.
eo
- enterprise object that is failing validationproperty
- attribute that failed validationvalue
- that failed validatingtype
- of the validation exception
public boolean shouldRecreateException(ERXValidationException erv, Object value)
ERXValidationException
should be re-created. This is useful if you have several subclasses of
exceptions for different types of objects or messages and the framework can
only convert to the base type given the information it has at that point.
erv
- previous validation exceptionvalue
- value that failed validating
public ERXValidationException createCustomException(EOEnterpriseObject eo, String method)
null
for proptery and value.
eo
- enterprise object failing validation
public ERXValidationException createCustomException(EOEnterpriseObject eo, String property, Object value, String method)
eo
- enterprise object failing validationproperty
- attribute that failed validationvalue
- that failed validationmethod
- unique identified usually corresponding to a
method name to pick up the validation template
public ERXValidationException convertException(NSValidation.ValidationException eov)
ERXValidationException
.
This is a cover method for the two argument version
passing in null as the value.
eov
- validation exception to be converted
public ERXValidationException convertException(NSValidation.ValidationException eov, Object value)
ERXValidationException
.
This method is used by ERXEntityClassDescription
to convert model thrown validation exceptions. This isn't
a very elegant solution, but until we can register our
our validation exception class this is what we have to do.
eov
- validation exception to be convertedvalue
- that failed validation
protected NSArray convertAdditionalExceptions(NSValidation.ValidationException ex)
ex
- validation exception
public String messageForException(ERXValidationException erv)
getMessage
off of ERXValidationException
calls this method passing in itself as the parameter.
erv
- validation exception
public String templateForException(ERXValidationException erv)
erv
- validation exception
public void resetTemplateCache(NSNotification n)
n
- notification posted when the localizer
is reset.public NSKeyValueCoding contextForException(ERXValidationException erv)
erv
- a given validation exception
public String templateDelimiter()
public void setDelimiter(String delimiter)
delimiter
- to be set.public void configureFactory()
protected String templateForEntityPropertyType(String entityName, String property, String type, String targetLanguage)
entityName
- name of the entityproperty
- key nametype
- validation exception typetargetLanguage
- target language name
public String templateForKeyPath(String key, String language)
ERXLocalizer
to handle the actual lookup.
|
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 |