org.glassfish.jersey.internal.inject
Class ReferencingFactory<T>

java.lang.Object
  extended by org.glassfish.jersey.internal.inject.ReferencingFactory<T>
Type Parameters:
T -
All Implemented Interfaces:
org.glassfish.hk2.api.Factory<T>

public abstract class ReferencingFactory<T>
extends Object
implements org.glassfish.hk2.api.Factory<T>

Factory that provides injection of the referenced instance.

Author:
Marek Potociar (marek.potociar at oracle.com)

Constructor Summary
ReferencingFactory(javax.inject.Provider<Ref<T>> referenceFactory)
          Create new referencing injection factory.
 
Method Summary
 void dispose(T instance)
           
 T provide()
           
static
<T> org.glassfish.hk2.api.Factory<Ref<T>>
referenceFactory()
          Get a reference factory providing an empty reference.
static
<T> org.glassfish.hk2.api.Factory<Ref<T>>
referenceFactory(T initialValue)
          Get a reference factory providing an initialized reference.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ReferencingFactory

public ReferencingFactory(javax.inject.Provider<Ref<T>> referenceFactory)
Create new referencing injection factory.

Parameters:
referenceFactory - reference provider backing the factory.
Method Detail

provide

public T provide()
Specified by:
provide in interface org.glassfish.hk2.api.Factory<T>

dispose

public void dispose(T instance)
Specified by:
dispose in interface org.glassfish.hk2.api.Factory<T>

referenceFactory

public static <T> org.glassfish.hk2.api.Factory<Ref<T>> referenceFactory()
Get a reference factory providing an empty reference.

Type Parameters:
T - reference type.
Returns:
reference factory providing an empty reference.

referenceFactory

public static <T> org.glassfish.hk2.api.Factory<Ref<T>> referenceFactory(T initialValue)
Get a reference factory providing an initialized reference.

Type Parameters:
T - reference type.
Parameters:
initialValue - initial value stored in the reference provided by the returned factory.
Returns:
reference factory providing a reference initialized with an initialValue.


Copyright © 2007-2014, Oracle and/or its affiliates. All Rights Reserved. Use is subject to license terms.