|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.myfaces.extensions.validator.core.validation.strategy.AbstractValidationStrategy
org.apache.myfaces.extensions.validator.core.validation.strategy.AbstractAnnotationValidationStrategy<A>
public abstract class AbstractAnnotationValidationStrategy<A extends Annotation>
This class provides an easier handling of violation messages. This abstract class is a good candidate as super-class for custom validation strategies.
| Field Summary | |
|---|---|
protected static String |
DETAIL_MESSAGE_KEY_POSTFIX
|
| Fields inherited from class org.apache.myfaces.extensions.validator.core.validation.strategy.AbstractValidationStrategy |
|---|
logger |
| Constructor Summary | |
|---|---|
AbstractAnnotationValidationStrategy()
|
|
| Method Summary | |
|---|---|
protected String |
getErrorMessageDetail(A annotation)
Returns the error message (the detailed message) provided by the given constraint. |
protected String |
getErrorMessageSummary(A annotation)
Returns the error message (the summary) provided by the given constraint. |
protected String |
getLabel(javax.faces.context.FacesContext facesContext,
javax.faces.component.UIComponent uiComponent,
MetaDataEntry metaDataEntry)
Returns the label of the uiComponent field that could be used in the error messages. |
protected javax.faces.application.FacesMessage |
getValidationErrorFacesMessage(A annotation)
Creates the FacesMessage that
will be used to inform the user of a validation error. |
protected abstract String |
getValidationErrorMsgKey(A 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 validatorException)
Executes the registered ValidationExceptionInterceptor
to process the validation exception. |
protected String |
resolveMessage(String key)
Uses the given message key to resolve the actual message in the correct language. |
void |
setMessageResolver(MessageResolver messageResolver)
Injection point for a MessageResolver
that needs to be used by this
ValidationStrategy. |
| Methods inherited from class org.apache.myfaces.extensions.validator.core.validation.strategy.AbstractValidationStrategy |
|---|
initValidation, processValidation, validate |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected static final String DETAIL_MESSAGE_KEY_POSTFIX
| Constructor Detail |
|---|
public AbstractAnnotationValidationStrategy()
| Method Detail |
|---|
protected String resolveMessage(String key)
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)
key - key of the error message that needs to be resolved.
protected String getErrorMessageSummary(A annotation)
getValidationErrorMsgKey(A) method for obtaining the message-/key which then is
resolved by the method resolveMessage.
annotation - The annotation associated with the
ValidationStrategy.
FacesMessage.protected String getErrorMessageDetail(A annotation)
getValidationErrorMsgKey(A) method for obtaining the message-/key which then is
resolved by the method resolveMessage.
When the key isn't found, the resulting exception is just logged but not propagated.
So the detail message isn't required and null is returned instead.
annotation - The annotation associated with the
ValidationStrategy.
FacesMessage or null.protected javax.faces.application.FacesMessage getValidationErrorFacesMessage(A annotation)
FacesMessage that
will be used to inform the user of a validation error. This method can be called by
subclasses in the processValidation
method when a ValidatorException is thrown.
annotation - The annotation associated with the
ValidationStrategy.
protected abstract String getValidationErrorMsgKey(A annotation)
annotation - The annotation associated with the
ValidationStrategy.
public void setMessageResolver(MessageResolver messageResolver)
MessageResolver
that needs to be used by this
ValidationStrategy.
messageResolver - messageResolver that needs to be used by this validationStrategy.
protected boolean processAfterValidatorException(javax.faces.context.FacesContext facesContext,
javax.faces.component.UIComponent uiComponent,
MetaDataEntry metaDataEntry,
Object convertedObject,
javax.faces.validator.ValidatorException validatorException)
ValidationExceptionInterceptor
to process the validation exception.
Adds the label of the component to the
MetaDataEntry.
processAfterValidatorException in class AbstractValidationStrategyfacesContext - The JSF ContextuiComponent - 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.validatorException - The validation exception that occurred.
ExtValUtils.tryToThrowValidatorExceptionForComponent(javax.faces.component.UIComponent, javax.faces.application.FacesMessage, java.lang.Throwable)
protected String getLabel(javax.faces.context.FacesContext facesContext,
javax.faces.component.UIComponent uiComponent,
MetaDataEntry metaDataEntry)
facesContext - The JSF ContextuiComponent - 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.
UIComponent which can be used in the violation msg.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||