You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Fabian T. (JIRA)" <ji...@apache.org> on 2017/06/23 12:12:00 UTC

[jira] [Updated] (WICKET-6410) ChoiceRenderer getObject always calls IModel#getObject when id is null

     [ https://issues.apache.org/jira/browse/WICKET-6410?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Fabian T. updated WICKET-6410:
------------------------------
    Description: 
{code:java}
@Override
	public T getObject(String id, IModel<? extends List<? extends T>> choices)
	{
		List<? extends T> _choices = choices.getObject();
		for (int index = 0; index < _choices.size(); index++)
		{
			// Get next choice
			final T choice = _choices.get(index);
			if (getIdValue(choice, index).equals(id))
			{
				return choice;
			}
		}
		return null;
	}
}
{code}

This Methode always calls „choices.getObject();”, even if the id is null or empty.

In our project we got some bigger SQL Statements behind some getObject methods of different dropDownChoices. Avoiding to call getObject when the id is null or empty increases the performance.

Feel free to correct me if I mess up something else with this fix.


  was:

{code:java}
@Override
	public T getObject(String id, IModel<? extends List<? extends T>> choices)
	{
		List<? extends T> _choices = {color:red}choices.getObject();{color}
		for (int index = 0; index < _choices.size(); index++)
		{
			// Get next choice
			final T choice = _choices.get(index);
			if (getIdValue(choice, index).equals(id))
			{
				return choice;
			}
		}
		return null;
	}
}
{code}

This Methode always calls „choices.getObject();”, even if the id is null or empty.

In our project we got some bigger SQL Statements behind some getObject methods of different dropDownChoices. Avoiding to call getObject when the id is null or empty increases the performance.

Feel free to correct me if I mess up something else with this fix.



> ChoiceRenderer getObject always calls IModel#getObject when id is null
> ----------------------------------------------------------------------
>
>                 Key: WICKET-6410
>                 URL: https://issues.apache.org/jira/browse/WICKET-6410
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 7.1.0
>            Reporter: Fabian T.
>            Priority: Trivial
>
> {code:java}
> @Override
> 	public T getObject(String id, IModel<? extends List<? extends T>> choices)
> 	{
> 		List<? extends T> _choices = choices.getObject();
> 		for (int index = 0; index < _choices.size(); index++)
> 		{
> 			// Get next choice
> 			final T choice = _choices.get(index);
> 			if (getIdValue(choice, index).equals(id))
> 			{
> 				return choice;
> 			}
> 		}
> 		return null;
> 	}
> }
> {code}
> This Methode always calls „choices.getObject();”, even if the id is null or empty.
> In our project we got some bigger SQL Statements behind some getObject methods of different dropDownChoices. Avoiding to call getObject when the id is null or empty increases the performance.
> Feel free to correct me if I mess up something else with this fix.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)