to.etc.iocular.def
Class BasicContainerBuilder

java.lang.Object
  extended by to.etc.iocular.def.BasicContainerBuilder
All Implemented Interfaces:
Builder

public class BasicContainerBuilder
extends java.lang.Object
implements Builder

This allows creation of a container definition from within Java source code. When building is complete a ContainerDefinition is created by calling createDefinition(). At that time all of the data entered in the builder is checked for consistency, build plans are created for all defined components and if all goes well a definition gets returned.

Author:
jal Created on Apr 3, 2007

Method Summary
<T> void
bind(java.lang.Class<T> intf, java.lang.Class<T> impl)
          Defines an interface's implementation class.
static BasicContainerBuilder createBuilder(java.lang.String name)
          Create a "normal" builder for a container that has no parent container and no base container (does not inherit).
static BasicContainerBuilder createChildBuilder(ContainerDefinition parent, java.lang.String name)
          Create a builder for a container that is a child container of a parent container.
 ContainerDefinition createDefinition()
          Walk the completed data and build a ContainerDefinition.
static BasicContainerBuilder createInheritedBuilder(ContainerDefinition base, java.lang.String name)
          Create an inherited container.
 ComponentRef findReferenceFor(java.util.Stack<ComponentBuilder> stack, ComponentPropertyDef pd)
          Return a reference for a property setter.
static java.lang.String getLocationString(int stackoffset)
           
 java.lang.String getName()
           
 ComponentBuilder register()
           
 ComponentBuilder registerInstance(java.lang.Object inst)
          Register an instance of an object.
 ComponentBuilder registerInstance(java.lang.String name, java.lang.Object inst)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

createBuilder

public static BasicContainerBuilder createBuilder(java.lang.String name)
Create a "normal" builder for a container that has no parent container and no base container (does not inherit).

Parameters:
name -
Returns:

createChildBuilder

public static BasicContainerBuilder createChildBuilder(ContainerDefinition parent,
                                                       java.lang.String name)
Create a builder for a container that is a child container of a parent container.

Parameters:
parent -
name -
Returns:

createInheritedBuilder

public static BasicContainerBuilder createInheritedBuilder(ContainerDefinition base,
                                                           java.lang.String name)
Create an inherited container.

Parameters:
base -
name -
Returns:

bind

public <T> void bind(java.lang.Class<T> intf,
                     java.lang.Class<T> impl)
Defines an interface's implementation class.

Specified by:
bind in interface Builder
See Also:
Builder.bind(java.lang.Class, java.lang.Class)

getLocationString

public static java.lang.String getLocationString(int stackoffset)

register

public ComponentBuilder register()
Specified by:
register in interface Builder

registerInstance

public ComponentBuilder registerInstance(java.lang.Object inst)
Register an instance of an object. This also registers the class into the per-class data tables.

See Also:
to.etc.iocular.Builder#registerInstance(java.lang.Object)

registerInstance

public ComponentBuilder registerInstance(java.lang.String name,
                                         java.lang.Object inst)

getName

public java.lang.String getName()

createDefinition

public ContainerDefinition createDefinition()
Walk the completed data and build a ContainerDefinition.

Specified by:
createDefinition in interface Builder
See Also:
Builder.createDefinition()

findReferenceFor

public ComponentRef findReferenceFor(java.util.Stack<ComponentBuilder> stack,
                                     ComponentPropertyDef pd)
Return a reference for a property setter. FIXME URGENT Needs proper implementation using the data in the property def, like component name, type etc.

Parameters:
stack -
pd -
Returns: