JBoss Modular Service Kernel API 1.0.0.CR2

org.jboss.msc.inject
Class RetainingInjector<T>

java.lang.Object
  extended by org.jboss.msc.inject.RetainingInjector<T>
Type Parameters:
T - the injected value type
All Implemented Interfaces:
Injector<T>
Direct Known Subclasses:
AddMethodInjector, ConcurrentMapInjector, InjectedValue

public abstract class RetainingInjector<T>
extends Object
implements Injector<T>

An injector which retains its value.

Author:
David M. Lloyd

Constructor Summary
RetainingInjector()
           
 
Method Summary
protected  Value<T> getStoredValue()
          Get the value object stored in this injector.
 void inject(T value)
          Inject the given value.
protected  Value<T> setStoredValue(Value<T> value)
          Set the value object stored in this injector (must not be null).
 void uninject()
          Uninject the given value (in other words, cancel or undo a previous injection).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RetainingInjector

public RetainingInjector()
Method Detail

inject

public void inject(T value)
            throws InjectionException
Inject the given value.

Specified by:
inject in interface Injector<T>
Parameters:
value - the value
Throws:
InjectionException - if the injection failed

uninject

public void uninject()
Uninject the given value (in other words, cancel or undo a previous injection). Only called after inject() has been called.

Specified by:
uninject in interface Injector<T>

getStoredValue

protected Value<T> getStoredValue()
Get the value object stored in this injector.

Returns:
the value object

setStoredValue

protected Value<T> setStoredValue(Value<T> value)
Set the value object stored in this injector (must not be null).

Parameters:
value - the value object (must not be null)
Returns:
the old value object, or null if none was stored

JBoss Modular Service Kernel API 1.0.0.CR2

Copyright © 2011 JBoss, a division of Red Hat, Inc.