org.apache.myfaces.extensions.validator.baseval.strategy
Class RequiredStrategy

java.lang.Object
  extended by org.apache.myfaces.extensions.validator.core.validation.strategy.AbstractValidationStrategy
      extended by org.apache.myfaces.extensions.validator.core.validation.strategy.AbstractAnnotationValidationStrategy<Required>
          extended by org.apache.myfaces.extensions.validator.baseval.strategy.RequiredStrategy
All Implemented Interfaces:
ValidationStrategy

@SkipValidationSupport
@NullValueAwareValidationStrategy
@EmptyValueAwareValidationStrategy
public class RequiredStrategy
extends AbstractAnnotationValidationStrategy<Required>

Since:
1.x.1

Field Summary
 
Fields inherited from class org.apache.myfaces.extensions.validator.core.validation.strategy.AbstractAnnotationValidationStrategy
DETAIL_MESSAGE_KEY_POSTFIX
 
Fields inherited from class org.apache.myfaces.extensions.validator.core.validation.strategy.AbstractValidationStrategy
logger
 
Constructor Summary
RequiredStrategy()
           
 
Method Summary
protected  String getValidationErrorMsgKey(Required annotation)
          Returns the key for the message that needs to be resolved for the violation-message.
protected  boolean processAfterValidatorException(javax.faces.context.FacesContext facesContext, javax.faces.component.UIComponent uiComponent, MetaDataEntry metaDataEntry, Object convertedObject, javax.faces.validator.ValidatorException e)
          Executes the registered ValidationExceptionInterceptor to process the validation exception.
 void processValidation(javax.faces.context.FacesContext facesContext, javax.faces.component.UIComponent uiComponent, MetaDataEntry metaDataEntry, Object convertedObject)
          Validates the given value based on the given meta-data entry.
protected  String resolveMessage(String key)
          Uses the given message key to resolve the actual message in the correct language.
 
Methods inherited from class org.apache.myfaces.extensions.validator.core.validation.strategy.AbstractAnnotationValidationStrategy
getErrorMessageDetail, getErrorMessageSummary, getLabel, getValidationErrorFacesMessage, setMessageResolver
 
Methods inherited from class org.apache.myfaces.extensions.validator.core.validation.strategy.AbstractValidationStrategy
initValidation, validate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RequiredStrategy

public RequiredStrategy()
Method Detail

processValidation

public void processValidation(javax.faces.context.FacesContext facesContext,
                              javax.faces.component.UIComponent uiComponent,
                              MetaDataEntry metaDataEntry,
                              Object convertedObject)
                       throws javax.faces.validator.ValidatorException
Description copied from class: AbstractValidationStrategy
Validates the given value based on the given meta-data entry. The method throws a ValidatorException if a violation is detected

Specified by:
processValidation in class AbstractValidationStrategy
Parameters:
facesContext - The JSF Context
uiComponent - The JSF component that contained the value entered by the user.
metaDataEntry - The data holder which stores the meta-data and some information where the meta-data was around.
convertedObject - Converted object of the user entered value.
Throws:
javax.faces.validator.ValidatorException - When violation of the validation rules occurs.

getValidationErrorMsgKey

protected String getValidationErrorMsgKey(Required annotation)
Description copied from class: AbstractAnnotationValidationStrategy
Returns the key for the message that needs to be resolved for the violation-message.

Specified by:
getValidationErrorMsgKey in class AbstractAnnotationValidationStrategy<Required>
Parameters:
annotation - The annotation associated with the ValidationStrategy.
Returns:
The key of the error message.

resolveMessage

protected String resolveMessage(String key)
Description copied from class: AbstractAnnotationValidationStrategy
Uses the given message key to resolve the actual message in the correct language. The current UIViewRoot provides the target locale. When a MessageResolver is available, it is used to resolve the message. Otherwise the default rules are taken to define the MessageResolver. ExtValUtils.getMessageResolverForValidationStrategy( org.apache.myfaces.extensions.validator.core.validation.strategy.ValidationStrategy)

Overrides:
resolveMessage in class AbstractAnnotationValidationStrategy<Required>
Parameters:
key - key of the error message that needs to be resolved.
Returns:
Resolved message.

processAfterValidatorException

protected boolean processAfterValidatorException(javax.faces.context.FacesContext facesContext,
                                                 javax.faces.component.UIComponent uiComponent,
                                                 MetaDataEntry metaDataEntry,
                                                 Object convertedObject,
                                                 javax.faces.validator.ValidatorException e)
Description copied from class: AbstractAnnotationValidationStrategy
Executes the registered ValidationExceptionInterceptor to process the validation exception. Adds the label of the component to the MetaDataEntry.

Overrides:
processAfterValidatorException in class AbstractAnnotationValidationStrategy<Required>
Parameters:
facesContext - The JSF Context
uiComponent - The JSF component that contained the value entered by the user.
metaDataEntry - The data holder which stores the meta-data and some information where the meta-data was around.
convertedObject - Converted object of the user entered value.
e - The validation exception that occurred.
Returns:
should return true when you like to have the ValidatorException thrown by the ExtValUtils#tryToThrowValidatorExceptionForComponent method. ExtValUtils.tryToThrowValidatorExceptionForComponent(javax.faces.component.UIComponent, javax.faces.application.FacesMessage, java.lang.Throwable)


Copyright © 2008-2014 The Apache Software Foundation. All Rights Reserved.