站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > JBoss 3.2.7 common API Documentation 英文版文档

State (JBoss/Common API) - JBoss 3.2.7 common API Documentation 英文版文档


org.jboss.util.state
Class State

java.lang.Object
  extended byorg.jboss.util.CloneableObject
      extended byorg.jboss.util.state.State
All Implemented Interfaces:
Cloneable, Serializable
Direct Known Subclasses:
AcceptableState, StateAdapter

public class State
extends CloneableObject
implements Serializable

Provides the basic interface for states (both accepting, acceptable and final) of a state machine.

Each state is immutable and has a name and integer value. States are considered equivilent if the integer values equal.

Note that the second opperand is an annonymous class, changing its equivilence from a vanilla Type instance.

State objects also can contain an optional opaque object. This is provided for applications to make use of the state machine for managing data assocciated with the state.

Version:
$Revision: 1.3 $
Author:
Jason Dillon
See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class org.jboss.util.CloneableObject
CloneableObject.Cloneable
 
Field Summary
 String name
          The human readable name of the state.
protected  Object opaque
          The optional opaque user data for the state.
 int value
          The integer value of the state.
 
Constructor Summary
State(int value)
           
State(int value, String name)
           
 
Method Summary
 boolean equals(Object obj)
          Check for state equality.
 String getName()
          Returns the name of the state, or if null returns the integer value as a string.
 Object getOpaque()
           
 int getValue()
           
 int hashCode()
          Returns the has code of the object.
 void setOpaque(Object obj)
           
 String toIdentityString()
          Returns the identity string of this state.
 String toString()
           
 
Methods inherited from class org.jboss.util.CloneableObject
clone
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

value

public final int value
The integer value of the state.

States with the same value are equal.


name

public final String name
The human readable name of the state.


opaque

protected Object opaque
The optional opaque user data for the state.

Constructor Detail

State

public State(int value,
             String name)

State

public State(int value)
Method Detail

getValue

public int getValue()

getName

public String getName()
Returns the name of the state, or if null returns the integer value as a string.


setOpaque

public void setOpaque(Object obj)

getOpaque

public Object getOpaque()

toString

public String toString()

toIdentityString

public String toIdentityString()
Returns the identity string of this state.

This is the same value returned by Object.toString().


hashCode

public int hashCode()
Returns the has code of the object.

Returns:
The integer value of the state.

equals

public boolean equals(Object obj)
Check for state equality.

States are considered equal if the integer values of the State objects are equivilent.



Copyright © 2002 JBoss Group, LLC. All Rights Reserved.