JBoss Modular Service Kernel API 1.0.0.CR2

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

java.lang.Object
  extended by org.jboss.msc.inject.CastingInjector<T>
Type Parameters:
T - the type to which the argument should be cast
All Implemented Interfaces:
Injector<Object>

public final class CastingInjector<T>
extends Object
implements Injector<Object>

An injector which casts the value to a specific type.

Author:
David M. Lloyd

Constructor Summary
CastingInjector(Injector<T> target, Class<T> type)
          Construct a new instance.
 
Method Summary
 void inject(Object value)
          Inject the given value.
 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

CastingInjector

public CastingInjector(Injector<T> target,
                       Class<T> type)
Construct a new instance.

Parameters:
target - the injection target
type - the type to cast to
Method Detail

inject

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

Specified by:
inject in interface Injector<Object>
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<Object>

JBoss Modular Service Kernel API 1.0.0.CR2

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