You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Oliver B. Fischer (JIRA)" <ji...@apache.org> on 2014/01/13 11:01:06 UTC

[jira] [Commented] (WICKET-5470) Remove 'final' from org.apache.wicket.markup.html.form.EnumChoiceRenderer#getDisplayValue

    [ https://issues.apache.org/jira/browse/WICKET-5470?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13869392#comment-13869392 ] 

Oliver B. Fischer commented on WICKET-5470:
-------------------------------------------

Hi Martin,

that do you think about the following solution?

public final Object getDisplayValue(T object)
{
  final String value = getDisplayValueRaw(object);

  return postprocess(value);
} 


> Remove 'final' from org.apache.wicket.markup.html.form.EnumChoiceRenderer#getDisplayValue
> -----------------------------------------------------------------------------------------
>
>                 Key: WICKET-5470
>                 URL: https://issues.apache.org/jira/browse/WICKET-5470
>             Project: Wicket
>          Issue Type: Improvement
>          Components: wicket
>    Affects Versions: 6.13.0
>            Reporter: Martin Grigorov
>            Assignee: Martin Grigorov
>            Priority: Minor
>             Fix For: 6.14.0, 7.0.0
>
>
> org.apache.wicket.markup.html.form.EnumChoiceRenderer#getDisplayValue() adds unnecessary indirection by providing overrideable #postprocess() method.
> If an application doesn't want to use the default implementation to resolve a display value by using i18n resources then it should provide its own custom implementation of IChoiceRenderer because org.apache.wicket.markup.html.form.EnumChoiceRenderer#getDisplayValue is final and it will throw MissingResourceException.
> If an application needs to use different logic it should be able to override #getDisplayValue(). If it needs to do something like #postprocess() then it can do:
> public Object getDisplayValue() {
>   Object orig = super.getDisplayValue();
>   return manipulate(orig);
> }



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)