|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.myfaces.extensions.validator.core.interceptor.AbstractRendererInterceptor
org.apache.myfaces.extensions.validator.core.interceptor.AbstractValidationInterceptor
public abstract class AbstractValidationInterceptor
A basic implementation of RendererInterceptor
for validating fields.
It adds some extension point for subclasses and performs tasks like :
- storing field values (recordProcessedInformation()
)
- resetting required information property UIComponent
- calling before and after Validation interceptors
- etc ...
Field Summary |
---|
Fields inherited from class org.apache.myfaces.extensions.validator.core.interceptor.AbstractRendererInterceptor |
---|
logger |
Constructor Summary | |
---|---|
AbstractValidationInterceptor()
|
Method Summary | |
---|---|
void |
afterDecode(javax.faces.context.FacesContext facesContext,
javax.faces.component.UIComponent uiComponent,
javax.faces.render.Renderer wrapped)
Sets required property of UIComponent to false after decoding. |
void |
beforeEncodeBegin(javax.faces.context.FacesContext facesContext,
javax.faces.component.UIComponent uiComponent,
javax.faces.render.Renderer wrapped)
Before the component gets rendered the interceptor initializes the component based on the meta-data which is provided by the referenced property (if component initialization is activated). |
void |
beforeGetConvertedValue(javax.faces.context.FacesContext facesContext,
javax.faces.component.UIComponent uiComponent,
Object o,
javax.faces.render.Renderer wrapped)
The method performs the validation of the field and calls the registered interceptors regarding the validation. |
protected abstract MetaDataExtractor |
getComponentMetaDataExtractor(Map<String,Object> properties)
Implementations must return the MetaDataExtractor that will perform the extraction of the meta data from the component. |
protected ELHelper |
getELHelper()
Returns the ELHelper to be used in the process of the validation. |
protected Map<String,Object> |
getInterceptorProperties(javax.faces.component.UIComponent uiComponent)
Create the properties which can be used by a MetaDataExtractor . |
protected Class |
getModuleKey()
Identification of the validation module. |
protected Map<String,Object> |
getPropertiesForComponentMetaDataExtractor(javax.faces.component.UIComponent uiComponent)
Create the properties which can be used by a MetaDataExtractor . |
protected PropertyInformation |
getPropertyInformation(javax.faces.context.FacesContext facesContext,
javax.faces.component.UIComponent uiComponent)
Extrancts the PropertyInformation for the given component. |
protected abstract void |
initComponent(javax.faces.context.FacesContext facesContext,
javax.faces.component.UIComponent uiComponent)
Initialize the component based on the meta-data which is provided by the referenced property. |
protected boolean |
interpretEmptyStringValuesAsNull()
Uses a config parameter (javax.faces.INTERPRET_EMPTY_STRING_SUBMITTED_VALUES_AS_NULL) which was introduced by JSF 2 for converting empty strings to null. |
protected boolean |
isRequiredInitializationSupported()
In case of required initialization it's needed for some use-cases to reset the (required-)state of the components. |
protected boolean |
isValueToValidateEmpty(Object convertedObject)
Defines if a value is empty. |
protected void |
processAfterValidation(javax.faces.context.FacesContext facesContext,
javax.faces.component.UIComponent uiComponent,
Object value)
Execute the afterValidation method of the registered PropertyValidationInterceptor's. |
protected boolean |
processBeforeValidation(javax.faces.context.FacesContext facesContext,
javax.faces.component.UIComponent uiComponent,
Object value)
Execute the beforeValidation method of the registered PropertyValidationInterceptor's. |
protected boolean |
processComponent(javax.faces.component.UIComponent uiComponent)
Based on basic rules the method checks if the current component should be processed. |
protected abstract void |
processValidation(javax.faces.context.FacesContext facesContext,
javax.faces.component.UIComponent uiComponent,
Object convertedObject)
A concrete implementation has to perform the actual validation of the value. |
protected boolean |
recordProcessedInformation()
Signals if the converted value should be stored e.g. for the cross-validation process. |
protected Object |
transformValueForValidation(Object convertedObject)
Converts an empty String to null when the parameter interpretEmptyStringValuesAsNull is set. |
protected boolean |
validateEmptyFields()
Uses a config parameter (javax.faces.VALIDATE_EMPTY_FIELDS) which was introduced by JSF 2 for deactivating the validation of empty fields. |
protected boolean |
validateValue(Object convertedObject)
Evaluates if the value should be validated in case it is empty (null or no characters). |
Methods inherited from class org.apache.myfaces.extensions.validator.core.interceptor.AbstractRendererInterceptor |
---|
afterEncodeBegin, afterEncodeChildren, afterEncodeEnd, afterGetConvertedValue, beforeDecode, beforeEncodeChildren, beforeEncodeEnd, getInterceptorId, getReturnValueOnSkipRendererDelegationException |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public AbstractValidationInterceptor()
Method Detail |
---|
protected boolean isRequiredInitializationSupported()
public void afterDecode(javax.faces.context.FacesContext facesContext, javax.faces.component.UIComponent uiComponent, javax.faces.render.Renderer wrapped) throws SkipAfterInterceptorsException
afterDecode
in interface RendererInterceptor
afterDecode
in class AbstractRendererInterceptor
facesContext
- The JSF ContextuiComponent
- The current componentwrapped
- The intercepted renderer
SkipAfterInterceptorsException
- Can be thrown to stop the execution of the subsequent interceptors.public void beforeEncodeBegin(javax.faces.context.FacesContext facesContext, javax.faces.component.UIComponent uiComponent, javax.faces.render.Renderer wrapped) throws IOException, SkipBeforeInterceptorsException, SkipRendererDelegationException
beforeEncodeBegin
in interface RendererInterceptor
beforeEncodeBegin
in class AbstractRendererInterceptor
facesContext
- The JSF ContextuiComponent
- The current componentwrapped
- The intercepted renderer
IOException
- In case the response writer is accessed and there was an IO problem.
SkipBeforeInterceptorsException
- can be thrown to stop the execution of the subsequent interceptors
SkipRendererDelegationException
- can be thorwn to skip the invocation of the intercepted renderer method.protected abstract void initComponent(javax.faces.context.FacesContext facesContext, javax.faces.component.UIComponent uiComponent)
facesContext
- The JSF ContextuiComponent
- The component which is processedpublic void beforeGetConvertedValue(javax.faces.context.FacesContext facesContext, javax.faces.component.UIComponent uiComponent, Object o, javax.faces.render.Renderer wrapped) throws javax.faces.convert.ConverterException, SkipBeforeInterceptorsException, SkipRendererDelegationException
beforeGetConvertedValue
in interface RendererInterceptor
beforeGetConvertedValue
in class AbstractRendererInterceptor
facesContext
- The JSF ContextuiComponent
- The current componento
- The submitted valuewrapped
- The intercepted renderer
javax.faces.convert.ConverterException
- ExtVal validation strategies can throw
ValidatorException
s.
Due to the trick used by ExtVal it has to be converted to a ConverterException
(see AbstractValidationInterceptor
).
SkipBeforeInterceptorsException
- can be thrown to stop the execution of the subsequent interceptors
SkipRendererDelegationException
- can be thorwn to skip the invocation of the intercepted renderer method.protected boolean processBeforeValidation(javax.faces.context.FacesContext facesContext, javax.faces.component.UIComponent uiComponent, Object value)
facesContext
- The JSF ContextuiComponent
- The UIComponent which is processed.value
- The value to validate
protected void processAfterValidation(javax.faces.context.FacesContext facesContext, javax.faces.component.UIComponent uiComponent, Object value)
facesContext
- The JSF ContextuiComponent
- The UIComponent which is processed.value
- The value which has just been validated.protected PropertyInformation getPropertyInformation(javax.faces.context.FacesContext facesContext, javax.faces.component.UIComponent uiComponent)
PropertyInformation
for the given component.
facesContext
- The JSF ContextuiComponent
- The UIComponent which is processed.
protected abstract MetaDataExtractor getComponentMetaDataExtractor(Map<String,Object> properties)
MetaDataExtractor
.
properties
- Properties that can be used to determine the extractor which is returned.
protected Object transformValueForValidation(Object convertedObject)
convertedObject
- Converted objected
protected boolean validateValue(Object convertedObject)
convertedObject
- The converted value.
protected boolean isValueToValidateEmpty(Object convertedObject)
convertedObject
- The converted value.
protected boolean validateEmptyFields()
protected boolean interpretEmptyStringValuesAsNull()
protected abstract void processValidation(javax.faces.context.FacesContext facesContext, javax.faces.component.UIComponent uiComponent, Object convertedObject)
facesContext
- The JSF ContextuiComponent
- The UIComponent which is processed.convertedObject
- The (adjusted) converted value.protected boolean processComponent(javax.faces.component.UIComponent uiComponent)
uiComponent
- The UIComponent which is processed.
protected ELHelper getELHelper()
protected boolean recordProcessedInformation()
protected Class getModuleKey()
protected Map<String,Object> getPropertiesForComponentMetaDataExtractor(javax.faces.component.UIComponent uiComponent)
MetaDataExtractor
.
By default it adds a key which identifies the current validation-module
and the current component (to avoid changes of the api for quite special use-cases).
uiComponent
- The UIComponent which is processed.
protected Map<String,Object> getInterceptorProperties(javax.faces.component.UIComponent uiComponent)
MetaDataExtractor
.
Returns the properties which will be made available to interceptors. By default the moduleKey and the UIComponent
itself is added.
uiComponent
- The UIComponent which is processed.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |