|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.wicket.injection.Injector org.apache.wicket.injection.ConfigurableInjector org.apache.wicket.guice.GuiceComponentInjector
public class GuiceComponentInjector
Injects fields/members of components using Guice.
Add this to your application in its Application.init()
method like so:
addComponentInstantiationListener(new GuiceComponentInjector(this));
There are different constructors for this object depending on how you want to wire things. See the javadoc for the constructors for more information.
Nested Class Summary | |
---|---|
static class |
GuiceComponentInjector.MoreThanOneBindingException
|
Constructor Summary | |
---|---|
GuiceComponentInjector(Application app)
Creates a new Wicket GuiceComponentInjector instance. |
|
GuiceComponentInjector(Application app,
com.google.inject.Injector injector)
Creates a new Wicket GuiceComponentInjector instance, using the provided Guice Injector instance. |
|
GuiceComponentInjector(Application app,
com.google.inject.Module... modules)
Creates a new Wicket GuiceComponentInjector instance, using the supplied Guice Module
instances to create a new Guice Injector instance internally. |
Method Summary | |
---|---|
static Annotation |
findBindingAnnotation(Annotation[] annotations)
|
protected IFieldValueFactory |
getFieldValueFactory()
Return the field value factory that will be used to inject objects |
Object |
inject(Object object)
Injects proxies using IFieldValueFactory obtained by calling getFieldValueFactory() method |
void |
onInstantiation(Component component)
Called for every component that is instantiated. |
Methods inherited from class org.apache.wicket.injection.Injector |
---|
getInstance, inject, isBoundaryClass |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public GuiceComponentInjector(Application app)
Internally this will create a new Guice Injector
instance, with no Module
instances. This is only useful if your beans have appropriate ImplementedBy
annotations on them so that they can be automatically picked up with no extra configuration
code.
app
- public GuiceComponentInjector(Application app, com.google.inject.Module... modules)
Module
instances to create a new Guice Injector
instance internally.
app
- modules
- public GuiceComponentInjector(Application app, com.google.inject.Injector injector)
Injector
instance.
app
- injector
- Method Detail |
---|
public Object inject(Object object)
ConfigurableInjector
inject
in class ConfigurableInjector
object
- object to be injected
public void onInstantiation(Component component)
IComponentInstantiationListener
onInstantiation
in interface IComponentInstantiationListener
component
- the component that is being instantiated.public static Annotation findBindingAnnotation(Annotation[] annotations) throws GuiceComponentInjector.MoreThanOneBindingException
annotations
-
GuiceComponentInjector.MoreThanOneBindingException
protected IFieldValueFactory getFieldValueFactory()
ConfigurableInjector
getFieldValueFactory
in class ConfigurableInjector
ConfigurableInjector.getFieldValueFactory()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |