org.jtheque.core.managers.state
Class StateManager

java.lang.Object
  extended by org.jtheque.core.managers.state.StateManager
All Implemented Interfaces:
IManager, IStateManager

public final class StateManager
extends java.lang.Object
implements IStateManager, IManager

A state manager implementation.

Author:
Baptiste Wicht

Constructor Summary
StateManager()
           
 
Method Summary
 void close()
          Close the manager.
<T extends IState>
T
createState(java.lang.Class<T> c)
          Create and return a state.
<T extends IState>
T
getOrCreateState(java.lang.Class<T> c)
          Return the state of a certain class.
<T extends IState>
T
getState(java.lang.Class<T> c)
          Return the state of a certain class.
 void init()
          Init the manager.
 void loadStates()
          Load the states.
 void preInit()
          Pre-init the manager.
 void registerState(IState state)
          Register a new state.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StateManager

public StateManager()
Method Detail

preInit

public void preInit()
Description copied from interface: IManager
Pre-init the manager. This operation is called before modules preplug.

Specified by:
preInit in interface IManager

loadStates

public void loadStates()
                throws ManagerException
Load the states.

Specified by:
loadStates in interface IStateManager
Throws:
ManagerException - If an error occurs during the reading of the states.

init

public void init()
          throws ManagerException
Description copied from interface: IManager
Init the manager. This operation is called after modules preplug but before module plug.

Specified by:
init in interface IManager
Throws:
ManagerException - If an error occurs during the init process.

close

public void close()
           throws ManagerException
Description copied from interface: IManager
Close the manager.

Specified by:
close in interface IManager
Throws:
ManagerException - If an error occurs during the close process.

getState

public <T extends IState> T getState(java.lang.Class<T> c)
Description copied from interface: IStateManager
Return the state of a certain class.

Specified by:
getState in interface IStateManager
Type Parameters:
T - The state type.
Parameters:
c - The state class.
Returns:
The state.

getOrCreateState

public <T extends IState> T getOrCreateState(java.lang.Class<T> c)
                                  throws StateException
Description copied from interface: IStateManager
Return the state of a certain class. If the state has not been yet created, it would be created.

Specified by:
getOrCreateState in interface IStateManager
Type Parameters:
T - The state type.
Parameters:
c - The state class.
Returns:
The state.
Throws:
StateException - If an error occurs during the state getting.

createState

public <T extends IState> T createState(java.lang.Class<T> c)
                             throws StateException
Description copied from interface: IStateManager
Create and return a state.

Specified by:
createState in interface IStateManager
Type Parameters:
T - The state type.
Parameters:
c - The state class.
Returns:
The state.
Throws:
StateException - If an error occurs during the state creation.

registerState

public void registerState(IState state)
Description copied from interface: IStateManager
Register a new state.

Specified by:
registerState in interface IStateManager
Parameters:
state - The state to register.


Copyright © 2009 JTheque. All Rights Reserved.