com.sdm.quasar.client.core.common
Class ComponentLifeCycle

java.lang.Object
  extended bycom.sdm.quasar.client.core.common.ComponentLifeCycle

public class ComponentLifeCycle
extends java.lang.Object

Typesafe enum: defines life cycle states that may be internally used for components that must be robust during creation or destruction. It also defines various methods checking for the correct life cycle.

This class is supposed to help an implementation, it is in no way a requirement. Thus it depends on the implementation which states are used, supported and tested.


Field Summary
static ComponentLifeCycle LIFE_CYCLE_STATE_ACTIVE
          The component has been created and initialized, it is fully functional.
static ComponentLifeCycle LIFE_CYCLE_STATE_CREATED
          The component has been created, but initialization is still pending.
static ComponentLifeCycle LIFE_CYCLE_STATE_CREATING
          The component is currently being created.
static ComponentLifeCycle LIFE_CYCLE_STATE_DISPOSED
          The component is disposed.
static ComponentLifeCycle LIFE_CYCLE_STATE_DISPOSING
          The component is currently being disposed.
 
Method Summary
static void assertActive(ComponentLifeCycle lifeCycleState)
          Checks whether the life cycle state is currently LIFE_CYCLE_STATE_ACTIVE.
static void assertCreated(ComponentLifeCycle lifeCycleState)
          Checks whether the life cycle state is currently LIFE_CYCLE_STATE_CREATED.
static void assertCreating(ComponentLifeCycle lifeCycleState)
          Checks whether the life cycle state is currently LIFE_CYCLE_STATE_CREATING.
static void assertDisposed(ComponentLifeCycle lifeCycleState)
          Checks whether the life cycle state is currently LIFE_CYCLE_STATE_DISPOSED.
static void assertDisposing(ComponentLifeCycle lifeCycleState)
          Checks whether the life cycle state is currently LIFE_CYCLE_STATE_DISPOSING.
static void assertKnownState(ComponentLifeCycle lifeCycleState)
          Tests whether the given state has a known value.
static void assertNotDisposed(ComponentLifeCycle lifeCycleState)
          Checks whether the life cycle state is currently not LIFE_CYCLE_STATE_DISPOSED.
static void assertNotDisposingOrDisposed(ComponentLifeCycle lifeCycleState)
          Checks whether the life cycle state is currently not LIFE_CYCLE_STATE_DISPOSING or LIFE_CYCLE_STATE_DISPOSED.
 java.lang.String toString()
          Returns an english name for the given state.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

LIFE_CYCLE_STATE_CREATING

public static final ComponentLifeCycle LIFE_CYCLE_STATE_CREATING
The component is currently being created. Some methods may function correctly, others may not be called.


LIFE_CYCLE_STATE_CREATED

public static final ComponentLifeCycle LIFE_CYCLE_STATE_CREATED
The component has been created, but initialization is still pending. Some methods may function correctly, others may not be called.


LIFE_CYCLE_STATE_ACTIVE

public static final ComponentLifeCycle LIFE_CYCLE_STATE_ACTIVE
The component has been created and initialized, it is fully functional. All methods should function correctly.


LIFE_CYCLE_STATE_DISPOSING

public static final ComponentLifeCycle LIFE_CYCLE_STATE_DISPOSING
The component is currently being disposed. Some methods may function correctly (e.g. getChildrenCount()), others may not be called (e.g. addChild()).


LIFE_CYCLE_STATE_DISPOSED

public static final ComponentLifeCycle LIFE_CYCLE_STATE_DISPOSED
The component is disposed. No method should be called, but some information methods may still provide correct values.

Method Detail

toString

public java.lang.String toString()
Returns an english name for the given state.

Returns:
an english name for the given state

assertKnownState

public static void assertKnownState(ComponentLifeCycle lifeCycleState)
Tests whether the given state has a known value. Known values are the defined LIFE_CYCLE_STATE_* constants in this class.

Parameters:
lifeCycleState - the life cycle state to be testet
Throws:
java.lang.IllegalStateException - if the state is unknown

assertCreating

public static void assertCreating(ComponentLifeCycle lifeCycleState)
Checks whether the life cycle state is currently LIFE_CYCLE_STATE_CREATING.

Parameters:
lifeCycleState - the life cycle state
Throws:
java.lang.IllegalStateException - if the component is not in the correct state

assertCreated

public static void assertCreated(ComponentLifeCycle lifeCycleState)
Checks whether the life cycle state is currently LIFE_CYCLE_STATE_CREATED.

Parameters:
lifeCycleState - the life cycle state
Throws:
java.lang.IllegalStateException - if the component is not in the correct state

assertActive

public static void assertActive(ComponentLifeCycle lifeCycleState)
Checks whether the life cycle state is currently LIFE_CYCLE_STATE_ACTIVE.

Parameters:
lifeCycleState - the life cycle state
Throws:
java.lang.IllegalStateException - if the component is not in the correct state

assertDisposing

public static void assertDisposing(ComponentLifeCycle lifeCycleState)
Checks whether the life cycle state is currently LIFE_CYCLE_STATE_DISPOSING.

Parameters:
lifeCycleState - the life cycle state
Throws:
java.lang.IllegalStateException - if the component is not in the correct state

assertDisposed

public static void assertDisposed(ComponentLifeCycle lifeCycleState)
Checks whether the life cycle state is currently LIFE_CYCLE_STATE_DISPOSED.

Parameters:
lifeCycleState - the life cycle state
Throws:
java.lang.IllegalStateException - if the component is not in the correct state

assertNotDisposed

public static void assertNotDisposed(ComponentLifeCycle lifeCycleState)
Checks whether the life cycle state is currently not LIFE_CYCLE_STATE_DISPOSED.

Parameters:
lifeCycleState - the life cycle state
Throws:
java.lang.IllegalStateException - if the component is not in the correct state

assertNotDisposingOrDisposed

public static void assertNotDisposingOrDisposed(ComponentLifeCycle lifeCycleState)
Checks whether the life cycle state is currently not LIFE_CYCLE_STATE_DISPOSING or LIFE_CYCLE_STATE_DISPOSED.

Parameters:
lifeCycleState - the life cycle state
Throws:
java.lang.IllegalStateException - if the component is not in the correct state