[
https://issues.apache.org/jira/browse/WICKET-2520?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12765608#action_12765608
]
Keith R. Bennett commented on WICKET-2520:
------------------------------------------
More on this...
I see that the comment on the StringAutoCompleteRenderer class says:
* An renderer that assumes that assist objects are {...@link String}s. Great
for quickly generating a
* list of assists.
Do I understand correctly, that assist objects means the underlying objects
being rendered? If so, nothing in the class really requires that the object be
a string; to generate the string, toString() is called. So it would be great
if the class could be defined as:
StringAutoCompleteRenderer<T> extends AbstractAutoCompleteTextRenderer<T>
If this means that "String" in the class name is inappropriate, then the class
could be renamed to DefaultAutoCompleteRenderer or SimpleAutoCompleteRenderer.
Another question...if this class is intended for Strings, why is it defined as:
...extends AbstractAutoCompleteTextRenderer<Object>
instead of:
extends AbstractAutoCompleteTextRenderer<String>?
If I'm misunderstanding the intent, clarification would be appreciated.
Thanks,
Keith
> Use of Object instead of generic T in StringAutoCompleteRenderer
> ----------------------------------------------------------------
>
> Key: WICKET-2520
> URL: https://issues.apache.org/jira/browse/WICKET-2520
> Project: Wicket
> Issue Type: Bug
> Components: wicket-extensions
> Affects Versions: 1.4.2
> Environment: N/A
> Reporter: Keith R. Bennett
> Priority: Minor
> Original Estimate: 0.25h
> Remaining Estimate: 0.25h
>
> The method getTextValue is defined in
> org.apache.wicket.extensions.ajax.markup.html.autocomplete.AbstractAutoCompleteRenderer
> as:
> protected abstract String getTextValue(T object);
> ...but overridden in StringAutoCompleteRenderer as:
> // @see AbstractAutoCompleteTextRenderer#getTextValue(Object)
> protected String getTextValue(Object object)
> {
> return object.toString();
> }
> The Javadoc implies that the intention is to override the superclass' method.
> I think the parameter type should be changed from Object to T.
> I recommend that when using something like T, to name the parameter 'value'
> rather than 'object'. 'object' is misleading, as, by convention, it implies
> that its data type is Object.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.