to.etc.iocular
Interface Container

All Known Implementing Classes:
BasicContainer

public interface Container

An actual store of instantiated resources, part of a container tree. A container has a definition determining the possible object wirings, and a store containing the already instantiated objects.

Instantiating a container is a very cheap operation. Objects defined for the container are only retrieved/instantiated when they are needed. The container itself is configured with a predefined ContainerDefinition; the definition is typically created at application startup and *is* expensive to create.

Author:
jal Created on Mar 25, 2007

Method Summary
 void destroy()
           
<T> T
findObject(java.lang.Class<T> theClass)
          Return the 'unnamed' object with the specified class from this container.
<T> T
findObject(java.lang.String name, java.lang.Class<T> theClass)
           
<T> T
getObject(java.lang.Class<T> theClass)
          Return the 'unnamed' object with the specified class from this container.
<T> T
getObject(java.lang.String name, java.lang.Class<T> theClass)
           
 void setParameter(java.lang.Class<?> theClass, java.lang.Object instance)
          Set the parameter as identified by it's target class to the specified instance.
 void setParameter(java.lang.Object instance)
          Set a container parameter object.
 void setParameter(java.lang.String name, java.lang.Object instance)
          Sets the parameter with the specified name to the instance passed.
 void start()
           
 

Method Detail

start

void start()

destroy

void destroy()

findObject

<T> T findObject(java.lang.Class<T> theClass)
Return the 'unnamed' object with the specified class from this container. If the object is not known this will return null!! This should not normally be used; use the 'getObject' call with the same signature instead: it throws an exception when the associated object is not found.

Parameters:
theClass -
Returns:

getObject

<T> T getObject(java.lang.Class<T> theClass)
            throws java.lang.Exception
Return the 'unnamed' object with the specified class from this container. If the object is not known this will throw a IocNotFoundException.

Parameters:
theClass -
Returns:
Throws:
java.lang.Exception

findObject

<T> T findObject(java.lang.String name,
                 java.lang.Class<T> theClass)

getObject

<T> T getObject(java.lang.String name,
                java.lang.Class<T> theClass)
            throws java.lang.Exception
Throws:
java.lang.Exception

setParameter

void setParameter(java.lang.Object instance)
Set a container parameter object. The parameter to set is inferred from the object type.

Parameters:
instance -

setParameter

void setParameter(java.lang.Class<?> theClass,
                  java.lang.Object instance)
Set the parameter as identified by it's target class to the specified instance. This instance CAN be null, in which case null will be set into contructors and/or setters dependent on this parameter.

Parameters:
clz -
instance -

setParameter

void setParameter(java.lang.String name,
                  java.lang.Object instance)
Sets the parameter with the specified name to the instance passed. This instance CAN be null, in which case null will be set into contructors and/or setters dependent on this parameter.

Parameters:
name -
instance -