net.israfil.micro.container
Class AbstractContainer

java.lang.Object
  extended by net.israfil.micro.container.AbstractContainer
All Implemented Interfaces:
Container
Direct Known Subclasses:
DefaultAutoWiringAdaptableContainer

public abstract class AbstractContainer
extends java.lang.Object
implements Container

A convenience abstract class that implements basic component storage and lookup, as well as basic component instance assignment.

Author:
Christian Edward Gruber

Constructor Summary
AbstractContainer()
           
AbstractContainer(Container parent)
           
 
Method Summary
protected  Container getParent()
           
protected  java.lang.Object getStoredComponent(java.lang.Object key)
           
 boolean hasComponent(java.lang.Object key)
          Returns true if the Component is available and prepared.
 boolean isRunning()
          Returns true if the container has been started, and false if it has not been started.
protected  boolean isStored(java.lang.Object key)
           
 void start()
          Begin the lifecycle of the container, after which components should be accessible.
protected  void store(java.lang.Object key, java.lang.Object component)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface net.israfil.micro.container.Container
getComponent
 

Constructor Detail

AbstractContainer

public AbstractContainer()

AbstractContainer

public AbstractContainer(Container parent)
Method Detail

isStored

protected boolean isStored(java.lang.Object key)

hasComponent

public boolean hasComponent(java.lang.Object key)
Description copied from interface: Container
Returns true if the Component is available and prepared. It throws a ContainerNotStarted runtime exception if the this method is used before the container is started. This method must be implemented by implementors of Container in a thread-safe and reentrant way.

Specified by:
hasComponent in interface Container

isRunning

public boolean isRunning()
Description copied from interface: Container
Returns true if the container has been started, and false if it has not been started.

Specified by:
isRunning in interface Container

start

public void start()
Description copied from interface: Container
Begin the lifecycle of the container, after which components should be accessible. Implementors should stop any component registration as of the start() call. Subsequent start() calls should be ignored.

Specified by:
start in interface Container

getParent

protected Container getParent()

getStoredComponent

protected java.lang.Object getStoredComponent(java.lang.Object key)

store

protected void store(java.lang.Object key,
                     java.lang.Object component)


Copyright © 2008. All Rights Reserved.