nl.openedge.baritus.validation
Class AbstractValidator

java.lang.Object
  extended bynl.openedge.baritus.validation.AbstractValidator
All Implemented Interfaces:
ValidationRuleDependend
Direct Known Subclasses:
AbstractFieldValidator, AbstractFormValidator

public abstract class AbstractValidator
extends java.lang.Object
implements ValidationRuleDependend

convenience class

Author:
Eelco Hillenius

Constructor Summary
AbstractValidator()
          construct
AbstractValidator(ValidationActivationRule rule)
          construct with validator activation rule
 
Method Summary
protected  java.lang.String getFieldName(FormBeanContext formBeanContext, java.lang.String name)
          Get the - possibly translated - name of the field.
 java.lang.String getLocalizedMessage(java.lang.String key)
          get localized message for given key
 java.lang.String getLocalizedMessage(java.lang.String key, java.util.Locale locale)
          get localized message for given key and locale.
 java.lang.String getLocalizedMessage(java.lang.String key, java.util.Locale locale, java.lang.Object[] parameters)
          Get localized message for given key and locale and format it with the given parameters.
 java.lang.String getLocalizedMessage(java.lang.String key, java.lang.Object[] parameters)
          Get localized message for given key and format it with the given parameters.
 ValidationActivationRule getValidationActivationRule()
          Get the registered validation rule.
 void removeValidationActivationRule()
          Remove the validation rule.
protected  void setErrorMessage(FormBeanContext formBeanContext, java.lang.String name, java.lang.String errorMessageKey, java.lang.Object[] messageArguments)
          set error message in formBeanContext using the provided name, the current locale that is stored in the form bean context, the provided errorMessageKey and the provided arguments for parsing the localized message; the message will be stored in the form bean context with key that was provided as argument name.
 void setValidationRule(ValidationActivationRule rule)
          Set the validation rule.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractValidator

public AbstractValidator()
construct


AbstractValidator

public AbstractValidator(ValidationActivationRule rule)
construct with validator activation rule

Parameters:
rule - validator activation rule
Method Detail

getLocalizedMessage

public java.lang.String getLocalizedMessage(java.lang.String key)
get localized message for given key

Parameters:
key - key of message
Returns:
String localized message

getLocalizedMessage

public java.lang.String getLocalizedMessage(java.lang.String key,
                                            java.util.Locale locale)
get localized message for given key and locale. If locale is null, the default locale will be used

Parameters:
key - key of message
locale - locale for message
Returns:
String localized message

getLocalizedMessage

public java.lang.String getLocalizedMessage(java.lang.String key,
                                            java.lang.Object[] parameters)
Get localized message for given key and format it with the given parameters. If locale is null, the default locale will be used

Parameters:
key - key of message
parameters - parameters for the message
Returns:
String localized message

getLocalizedMessage

public java.lang.String getLocalizedMessage(java.lang.String key,
                                            java.util.Locale locale,
                                            java.lang.Object[] parameters)
Get localized message for given key and locale and format it with the given parameters. If locale is null, the default locale will be used

Parameters:
key - key of message
locale - locale for message
parameters - parameters for the message
Returns:
String localized message

getValidationActivationRule

public ValidationActivationRule getValidationActivationRule()
Description copied from interface: ValidationRuleDependend
Get the registered validation rule.

Specified by:
getValidationActivationRule in interface ValidationRuleDependend
Returns:
the registered validation rule or null if none was registered
See Also:
ValidationRuleDependend.getValidationActivationRule()

removeValidationActivationRule

public void removeValidationActivationRule()
Description copied from interface: ValidationRuleDependend
Remove the validation rule.

Specified by:
removeValidationActivationRule in interface ValidationRuleDependend
See Also:
ValidationRuleDependend.removeValidationActivationRule()

setValidationRule

public void setValidationRule(ValidationActivationRule rule)
Description copied from interface: ValidationRuleDependend
Set the validation rule.

Specified by:
setValidationRule in interface ValidationRuleDependend
Parameters:
rule - the rule
See Also:
ValidationRuleDependend.setValidationRule(nl.openedge.baritus.validation.ValidationActivationRule)

getFieldName

protected java.lang.String getFieldName(FormBeanContext formBeanContext,
                                        java.lang.String name)
Get the - possibly translated - name of the field. If lookup in the resources failed, the provided name will be returned as is.

Parameters:
formBeanContext - form bean context
name - original name of field
Returns:
String the - possibly translated - name of the field. If lookup in the resources failed, the provided name will be returned as is.

setErrorMessage

protected void setErrorMessage(FormBeanContext formBeanContext,
                               java.lang.String name,
                               java.lang.String errorMessageKey,
                               java.lang.Object[] messageArguments)
set error message in formBeanContext using the provided name, the current locale that is stored in the form bean context, the provided errorMessageKey and the provided arguments for parsing the localized message; the message will be stored in the form bean context with key that was provided as argument name. If no message was found, the provided errorMessageKey will be used.

Parameters:
formBeanContext - form bean context
name - untransalated name of the field
errorMessageKey - message key for error
messageArguments - arguments for parsing the message


Copyright © 2003-2004 Open Edge. All Rights Reserved.