to.etc.domui.injector
Class DefaultPageInjector

java.lang.Object
  extended by to.etc.domui.injector.DefaultPageInjector
All Implemented Interfaces:
IPageInjector

public class DefaultPageInjector
extends java.lang.Object
implements IPageInjector

This is the default DomUI page injector. It is responsible for providing (injecting) values into page setters where required. This default version only accepts the @UIUrlParameter annotation and uses it to inject either URL parameter values or entities loaded from an URL parameter into the page. This can be extended to add extra methods to inject values into a page, for instance using Spring (NO! NO! Use something good instead of this piece of shit!), Guice, Pico/Nanocontainer or whatever.

Author:
Frits Jalvingh Created on Oct 23, 2009

Constructor Summary
DefaultPageInjector()
           
 
Method Summary
protected  PropertyInjector calculateInjector(PropertyInfo pi)
          Tries to find an injector to inject a value for the specified property.
protected  to.etc.domui.injector.PageInjector calculatePageInjector(java.lang.Class<? extends UrlPage> page)
          Fully recalculates the page injectors to use for the specified page.
protected  PropertyInjector calculatePropertyInjector(PropertyInfo pi, java.lang.reflect.Method annotatedMethod)
           
protected  PropertyInjector createEntityInjector(PropertyInfo pi, java.lang.String name, boolean mandatory, java.lang.Class<?> entityType)
           
protected  PropertyInjector createParameterInjector(PropertyInfo pi, java.lang.String name, boolean mandatory)
           
protected  PropertyInjector createUrlAnnotationConnector(PropertyInfo pi, UIUrlParameter upp)
           
 void injectPageValues(UrlPage page, RequestContextImpl ctx, PageParameters papa)
          This scans the page for properties that are to be injected.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultPageInjector

public DefaultPageInjector()
Method Detail

calculateInjector

@Nullable
protected PropertyInjector calculateInjector(PropertyInfo pi)
Tries to find an injector to inject a value for the specified property.

Parameters:
pi -
Returns:

calculatePropertyInjector

protected PropertyInjector calculatePropertyInjector(PropertyInfo pi,
                                                     java.lang.reflect.Method annotatedMethod)

createUrlAnnotationConnector

protected PropertyInjector createUrlAnnotationConnector(PropertyInfo pi,
                                                        UIUrlParameter upp)

createParameterInjector

protected PropertyInjector createParameterInjector(PropertyInfo pi,
                                                   java.lang.String name,
                                                   boolean mandatory)

createEntityInjector

protected PropertyInjector createEntityInjector(PropertyInfo pi,
                                                java.lang.String name,
                                                boolean mandatory,
                                                java.lang.Class<?> entityType)

calculatePageInjector

protected to.etc.domui.injector.PageInjector calculatePageInjector(java.lang.Class<? extends UrlPage> page)
Fully recalculates the page injectors to use for the specified page. This explicitly does not use the injector cache.

Parameters:
page -
Returns:

injectPageValues

public void injectPageValues(UrlPage page,
                             RequestContextImpl ctx,
                             PageParameters papa)
                      throws java.lang.Exception
This scans the page for properties that are to be injected. It scans for properties on the Page's UrlPage class and injects any stuff it finds. This version only handles the @UIUrlParameter annotation.

Specified by:
injectPageValues in interface IPageInjector
Parameters:
page -
ctx -
papa -
Throws:
java.lang.Exception
See Also:
IPageInjector.injectPageValues(to.etc.domui.dom.html.UrlPage, to.etc.domui.server.RequestContextImpl, to.etc.domui.state.PageParameters)