|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.commons.inject.impl.AbstractInjector
public abstract class AbstractInjector
Abstract implementation of an injector.
| Constructor Summary | |
|---|---|
AbstractInjector()
|
|
| Method Summary | ||
|---|---|---|
protected abstract
|
getBinding(IKey<T> pKey)
|
|
|
getInstance(Class<T> pType)
Returns an instance of pType, if a matching binding is present. |
|
|
getInstance(Class<T> pType,
String pName)
Returns an instance of the given type, with the given name, if a matching binding is present. |
|
|
getInstance(IKey<T> pKey)
Returns an instance of the binding that has been registered for the given key. |
|
void |
injectMembers(Object pInstance)
Injects members into the given instance, as if it where created by the injector itself. |
|
protected abstract
|
requireBinding(IKey<T> pKey)
|
|
|
requireInstance(Class<T> pType)
Returns an instance of pType, if a matching binding is present. |
|
|
requireInstance(Class<T> pType,
String pName)
Returns an instance of the given type, with the given name, if a matching binding is present. |
|
|
requireInstance(IKey<T> pKey)
Returns an instance of the binding that has been registered for the given key. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public AbstractInjector()
| Method Detail |
|---|
protected abstract <T> IBinding<T> getBinding(IKey<T> pKey)
protected abstract <T> IBinding<T> requireBinding(IKey<T> pKey)
public <T> T getInstance(Class<T> pType)
IInjectorpType, if a matching binding is present.
This is a shortcut for
getInstance(pType, "")or
getInstance(pType, Key.NO_NAME)
getInstance in interface IInjectorpType - The requested type.
IInjector.getInstance(Class, String),
IInjector.getInstance(IKey),
IInjector.requireInstance(Class)
public <T> T getInstance(Class<T> pType,
String pName)
IInjectorKey key = new Key(pType, pName); getInstance(key)or
Key key = new Key(pType, pName, Key.NO_ANNOTATIONS); getInstance(key)
getInstance in interface IInjectorpType - The requested type.pName - The requested objects name.
IInjector.getInstance(IKey),
IInjector.requireInstance(Class, String)public <T> T getInstance(IKey<T> pKey)
IInjector
getInstance in interface IInjectorpKey - A binding key, for which a binding has been registered.
IInjector.getInstance(Class),
IInjector.getInstance(Class, String),
IInjector.requireInstance(IKey)
public <T> T requireInstance(Class<T> pType)
throws NoSuchBindingException
IInjectorpType, if a matching binding is present.
This is a shortcut for
requireInstance(pType, "")or
requireInstance(pType, Key.NO_NAME)
requireInstance in interface IInjectorpType - The requested type.
NoSuchBindingException - No matching binding has been registered with
the injector.IInjector.getInstance(Class, String),
IInjector.getInstance(IKey),
IInjector.requireInstance(Class)
public <T> T requireInstance(Class<T> pType,
String pName)
throws NoSuchBindingException
IInjectorKey key = new Key(pType, pName); requireInstance(key)or
Key key = new Key(pType, pName, Key.NO_ANNOTATIONS); requireInstance(key)
requireInstance in interface IInjectorpType - The requested type.pName - The requested objects name.
NoSuchBindingException - No matching binding has been registered with
the injector.IInjector.getInstance(Class, String),
IInjector.requireInstance(Class),
IInjector.requireInstance(IKey)
public <T> T requireInstance(IKey<T> pKey)
throws NoSuchBindingException
IInjector
requireInstance in interface IInjectorpKey - A binding key, for which a binding has been registered.
NoSuchBindingException - No matching binding has been registered with
the injector.IInjector.getInstance(IKey),
IInjector.requireInstance(Class),
IInjector.requireInstance(Class, String)public void injectMembers(Object pInstance)
IInjectorinjector itself. In other words, fills fields
and invokes methods annotated with @Inject, assuming that a binding
is present for those fields, and method parameters.
injectMembers in interface IInjector
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||