javax.enterprise.inject.spi
Class Unmanaged<T>

java.lang.Object
  extended by javax.enterprise.inject.spi.Unmanaged<T>

public class Unmanaged<T>
extends java.lang.Object

Helper class for injecting and calling lifecycle callbacks unmanaged instances for use by framework and library integrators.

 Unmanaged<Foo> unmanagedFoo = new Unmanaged<Foo>(Foo.class);
 UnmanagedInstance<Foo> fooInstance = unmanagedFoo.newInstance();
 Foo foo = fooInstance.produce().inject().postConstruct().get();
 ... // Use the foo instance
 fooInstance.preDestroy().dispose();
 

An instance of this class can be safely held for the lifetime of the application.

Unmanaged.UnmanagedInstances created by this class are not suitable for sharing between threads.

Since:
1.1
Author:
Pete Muir

Nested Class Summary
static class Unmanaged.UnmanagedInstance<T>
          Represents a non-contextual instance.
 
Constructor Summary
Unmanaged(BeanManager manager, java.lang.Class<T> clazz)
          Create an injector for the given class
Unmanaged(java.lang.Class<T> clazz)
          Create an injector for the given class, using the current bean manager
 
Method Summary
 Unmanaged.UnmanagedInstance<T> newInstance()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Unmanaged

public Unmanaged(BeanManager manager,
                 java.lang.Class<T> clazz)
Create an injector for the given class


Unmanaged

public Unmanaged(java.lang.Class<T> clazz)
Create an injector for the given class, using the current bean manager

Method Detail

newInstance

public Unmanaged.UnmanagedInstance<T> newInstance()


Copyright © 2008-2013 JBoss by Red Hat, Inc.. All Rights Reserved.