[
http://www.stripesframework.org/jira/browse/STS-539?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Tim Fennell updated STS-539:
----------------------------
Fix Version/s: Release 1.5
> ScopedLocalizableError should have public accessors for defaultName, key, and
> parameters
> ----------------------------------------------------------------------------------------
>
> Key: STS-539
> URL: http://www.stripesframework.org/jira/browse/STS-539
> Project: Stripes
> Issue Type: Improvement
> Components: Validation
> Affects Versions: Release 1.4.3, Release 1.5
> Environment: All
> Reporter: Ryan Asleson
> Fix For: Release 1.5
>
>
> I need the Stripes localization stuff to be more pluggable than it currently
> is. Most specifically, for the validator annotations, I need to be able to
> specify the exact key that should be used to look up the field name from the
> custom content repository our applications use.
> My thought is this: first, leverage the new "label" attribute in the
> @Validation annotation and in it put the field name key. For the field name
> key in the "label" attribute to be used to look up the field name from the
> content repository, I can subclass the ScopedLocalizableError class and
> override the resolveFieldName method (which is actually in the SimpleError
> superclass) to use the "label" attribute to look up the actual field name
> text from the content repository.
> Since Stripes uses ScopedLocalizableError in several places (and can't be
> replaced) I'm thinking that I can create an Interceptor that uses the
> @Intercepts({LifecycleStage.BindingAndValidation}) annotation. In the
> intercept method, I could get the validation errors from the
> ActionBeanContext, and then iterate through the errors. For each
> ScopedLocalizableError, I would create an instance of
> MyScopedLocalizableError (which obviously extends ScopedLocalizableError) so
> the overridden resolveFieldName method can be used.
> However, there is no way to transfer the state of the ScopedLocalizableError
> to the new subclass I'm creating. The subclass instance needs to have the
> same state as the ScopedLocalizableError. Specifically, the parameters in
> ScopedLocalizableError's constructor -- defaultName, key, and the optional
> parameters -- need to have public getter methods.
> Can ScopedLocalizableError be extended to include public getter methods for
> defaultName, key, and the optional parameters? So I can do something like
> this
> public class MyScopedLocalizableError extends ScopedLocalizableError {
> public MyScopedLocalizableError(ScopedLocalizableError error) {
> super(error.getDefaultName, error.getKey, error.getparameters);
> }
> }
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://www.stripesframework.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Register now and save $200. Hurry, offer ends at 11:59 p.m.,
Monday, April 7! Use priority code J8TLD2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
Stripes-development mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-development