Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Wicket-Guice's InjectionFlagCachingGuiceComponentInjector is removed. The replacement is GuiceComponentInjector. The caching mechanism that InjectionFlagCachingGuiceComponentInjector provided is moved to org.apache.wicket.injection.Injector so that the caching is re-used for both Wicket-Spring and Wicket-Guice.

Visitors

Visitors have been cleaned up. Dependency on magic return values defined in Component#IVisitor have been replaced with a Component#IVisit object that allows the visitor to control the flow of the traversal.

Code Block

formComponent.visitChildren(Radio.class, new IVisitor<Component>()
{
	public /*[1]*/ Object component(Component component /*[2]*/)
	{
		if (value.equals(component.getDefaultModelObject()))
		{
			addFormComponentValue(formComponent,((Radio<?>)component).getValue());
			return STOP_TRAVERSAL; /*[3]*/
		}
		return CONTINUE_TRAVERSAL_BUT_DONT_GO_DEEPER; /*[4]*/
	}
});
Code Block

formComponent.visitChildren(Radio.class, new IVisitor<Component, Void>()
{
	public void /*[1]*/ component(final Component component, final IVisit<Void> visit /*[2]*/)
	{
		if (value.equals(component.getDefaultModelObject()))
		{
			addFormComponentValue(formComponent,((Radio<?>)component).getValue());
			visit.stop(); /*[3]*/
		}
		else
		{
			visit.dontGoDeeper(); /*[4]*/
		}
	}
});

Wiki Markup
\[1] The new style visitor no longer returns a value, instead the value can be returned using visit.stop(value)
\[2] The new visit object is introduced to control the visitor traversal
\[3] Instead of relying on magic return values the traversal is stopped by using the new visit object
\[4] Same as \[3] but a different method on IVisit is used