edu.memphis.ccrg.lida.framework.initialization
Class InitializableImpl

java.lang.Object
  extended by edu.memphis.ccrg.lida.framework.initialization.InitializableImpl
All Implemented Interfaces:
Initializable
Direct Known Subclasses:
ActionImpl, ActivatibleImpl, FrameworkModuleImpl, StrategyImpl, TaskSpawnerImpl

public class InitializableImpl
extends java.lang.Object
implements Initializable

Default implementation of Initializable

Author:
Ryan J. McCall, Javier Snaider

Constructor Summary
InitializableImpl()
           
 
Method Summary
 boolean containsParameter(java.lang.String key)
          Returns whether a parameter with specified key is in this Initializable
<T> T
getParam(java.lang.String name, T defaultValue)
          Method to read parameters from the Map of properties set by the Initializable.init(Map) method.
 java.util.Map<java.lang.String,?> getParameters()
          Returns the Map of parameters of this initializable
 void init()
          This is a convenience method for custom initialization.
 void init(java.util.Map<java.lang.String,?> params)
          Initialize this object with parameters.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

InitializableImpl

public InitializableImpl()
Method Detail

init

public void init(java.util.Map<java.lang.String,?> params)
Description copied from interface: Initializable
Initialize this object with parameters.

Specified by:
init in interface Initializable
Parameters:
params - Map of parameters indexed by their String names
See Also:
AgentXmlFactory

init

public void init()
This is a convenience method for custom initialization. It is called from init(Map). Subclasses can overwrite this method and call getParam(String, Object) to access parameters by name. If this method is overridden, the init of the superclass must be called first.

Specified by:
init in interface Initializable

getParam

public <T> T getParam(java.lang.String name,
                      T defaultValue)
Description copied from interface: Initializable
Method to read parameters from the Map of properties set by the Initializable.init(Map) method.

Specified by:
getParam in interface Initializable
Type Parameters:
T - expected type of the parameter
Parameters:
name - the parameter name
defaultValue - the default value to be returned if the parameter doesn't exist
Returns:
the value of the parameter or the default value

containsParameter

public boolean containsParameter(java.lang.String key)
Description copied from interface: Initializable
Returns whether a parameter with specified key is in this Initializable

Specified by:
containsParameter in interface Initializable
Parameters:
key - String
Returns:
true if specified key exists

getParameters

public java.util.Map<java.lang.String,?> getParameters()
Description copied from interface: Initializable
Returns the Map of parameters of this initializable

Specified by:
getParameters in interface Initializable
Returns:
the Map of parameters