[
https://issues.jboss.org/browse/SEAMFACES-24?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Shane Bryzak updated SEAMFACES-24:
----------------------------------
Fix Version/s: 3.0.0.Beta3
(was: 3.0.0.Beta1)
> Provide convenience classes for Validators/Converters
> -----------------------------------------------------
>
> Key: SEAMFACES-24
> URL: https://issues.jboss.org/browse/SEAMFACES-24
> Project: Seam Faces
> Issue Type: Feature Request
> Components: Validation & Conversion
> Reporter: Lincoln Baxter III
> Fix For: 3.0.0.Beta3
>
>
> Provide generic abstract classes implementing Validator and Converter, for
> convenient removal of typecasting. Work will need to be done to figure out
> how to best handle ClassCastExceptions in the case when the provided value
> argument is not of the type required.
> --------------------------------------------------------------------------------------------------------------------------------------
> public abstract class Converter<T> implements javax.faces.convert.Converter
> {
> FacesContext context;
> public abstract T toObject(UIComponent comp, String value);
> public abstract String toString(UIComponent comp, T value);
> @Override
> public Object getAsObject(final FacesContext context, final UIComponent
> comp, final String value)
> {
> this.context = context;
> return toObject(comp, value);
> }
> @Override
> @SuppressWarnings("unchecked")
> public String getAsString(final FacesContext context, final UIComponent
> comp, final Object value)
> {
> this.context = context;
> return toString(comp, (T) value);
> }
> public FacesContext getContext()
> {
> return context;
> }
> }
> ---------------------------------------------------------------------------------------------------------------------------------------
> public abstract class Validator<T> implements javax.faces.validator.Validator
> {
> FacesContext context;
> public abstract void validate(UIComponent component, T value) throws
> ValidatorException;
> @Override
> @SuppressWarnings("unchecked")
> public void validate(final FacesContext context, final UIComponent
> component, final Object value) throws javax.faces.validator.ValidatorException
> {
> this.context = context;
> validate(component, (T) value);
> }
> public FacesContext getContext()
> {
> return context;
> }
> }
> ---------------------------------------------------------------------------------------------------------------------------------------
> Provide extension of ValidatorException to remove need for creating new
> FacesMessage objects when throwing ValidatorExceptions from Validators.
> public class ValidatorException extends
> javax.faces.validator.ValidatorException
> {
> public ValidatorException(final String message)
> {
> super(new FacesMessage(message));
> }
> }
--
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
_______________________________________________
seam-issues mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/seam-issues