com.sun.hk2.component
Class ConstructorWomb<T>

java.lang.Object
  extended by com.sun.hk2.component.AbstractInhabitantImpl<T>
      extended by com.sun.hk2.component.AbstractWombImpl<T>
          extended by com.sun.hk2.component.ConstructorWomb<T>
All Implemented Interfaces:
Holder<T>, Inhabitant<T>, Womb<T>

public class ConstructorWomb<T>
extends AbstractWombImpl<T>

Creates an object from its constructor.

Author:
Kohsuke Kawaguchi

Nested Class Summary
 
Nested classes/interfaces inherited from interface com.sun.hk2.component.Holder
Holder.Impl<T>
 
Field Summary
 
Fields inherited from class com.sun.hk2.component.AbstractWombImpl
type
 
Constructor Summary
ConstructorWomb(java.lang.Class<T> type, Habitat habitat, MultiMap<java.lang.String,java.lang.String> metadata)
           
 
Method Summary
 T create(Inhabitant onBehalfOf)
          Creates a new instance.
 void extract(java.lang.Object component, ScopeInstance si)
          Extracts resources identified with Extract annotations into the given scope.
 void initialize(T t, Inhabitant onBehalfOf)
          Performs initialization of object, such as dependency injection.
 
Methods inherited from class com.sun.hk2.component.AbstractWombImpl
get, inject, metadata, release, type, typeName
 
Methods inherited from class com.sun.hk2.component.AbstractInhabitantImpl
companions, get, getSerializedMetadata, getSerializedMetadata, lead, setCompanions
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.jvnet.hk2.component.Womb
get
 
Methods inherited from interface org.jvnet.hk2.component.Inhabitant
companions, getSerializedMetadata, getSerializedMetadata, lead, setCompanions
 

Constructor Detail

ConstructorWomb

public ConstructorWomb(java.lang.Class<T> type,
                       Habitat habitat,
                       MultiMap<java.lang.String,java.lang.String> metadata)
Method Detail

create

public T create(Inhabitant onBehalfOf)
         throws ComponentException
Description copied from interface: Womb
Creates a new instance. The caller is supposed to call the #initialize(T, Inhabitant) right away. This 2-phase initialization allows us to handle cycle references correctly.

Throws:
ComponentException

initialize

public void initialize(T t,
                       Inhabitant onBehalfOf)
                throws ComponentException
Description copied from interface: Womb
Performs initialization of object, such as dependency injection.

Specified by:
initialize in interface Womb<T>
Overrides:
initialize in class AbstractWombImpl<T>
Throws:
ComponentException

extract

public void extract(java.lang.Object component,
                    ScopeInstance si)
             throws ComponentException
Extracts resources identified with Extract annotations into the given scope.

This method is for the use within HK2, and not really meant to be used by application code.

Parameters:
component - the component we should extract resources from
Throws:
ComponentException - if the resource extract fail


Copyright © 2009 Sun Microsystems, Inc.. All Rights Reserved.