# com.beasys.commerce.foundation
State Interface

public interface State
extends `Belonging`

Represents a discrete state in a state machine or workflow. It is contained by a `StateMachine``` and refered to by `Transition``` A name that identifies the state uniquely within the context of a state machine.

                      name
     [State] <*>------> [String]

Related Topics

``StateHome``
``StateImpl``

All Known Implementing Classes
  `StateImpl`

All Superinterfaces
  `Belonging`, `BusinessSmartComponent`, `Cloneable`, `Comparable`, `Serializable`

## Method Summary

`public void` | `enter`(`Transition` trans) This method is invoked whenever the state is entered.
`public void` | `error`(`Transition` trans) This method is invoked whenever the state is transitioned from in erro.
`public void` | `exit`(`Transition` trans) This method is invoked whenever the state is transitioned from.
`public `TransitionPolicy`` | `getEnterPolicy`() Get the transition policy that is invoked when the state is entered.
`public `TransitionPolicy`` | `getErrorPolicy`() Set the transition policy that is invoked when the state is exited with an invalid transition.
`public `TransitionPolicy`` | `getExitPolicy`() Get the transition policy that is invoked when the state is exited.
`public `String`` | `getName`() Get the value of name
`public void` | `setEnterPolicy`(`TransitionPolicy` policy) Set a transition policy that is invoked when the state is entered.
`public void` | `setErrorPolicy`(`TransitionPolicy` policy) Set a transition policy that is invoked when the state is exited with an invalid transition.
`public void` | `setExitPolicy`(`TransitionPolicy` policy) Set a transition policy that is invoked when the state is exited.
`public void` | `setName`(`String` name) Set the value of name

Methods from interface `com.beasys.commerce.foundation.`Belonging``
``clone`, `equals`, `interfaceName`, `setByValue`, `value``

Methods from interface `java.lang.`Comparable``
`compareTo`

## Method Detail

### enter(Transition) Method

    public void enter(Transition trans)

This method is invoked whenever the state is entered. It searches for an enter policy and invokes it.

### error(Transition) Method

    public void error(Transition trans)

This method is invoked whenever the state is transitioned from in erro. It searches for an Error Policy and invokes it if present

### exit(Transition) Method

    public void exit(Transition trans)

This method is invoked whenever the state is transitioned from. It searches for an Exit Policy and invokes it if present.

### getEnterPolicy() Method

    public TransitionPolicy getEnterPolicy()

Get the transition policy that is invoked when the state is entered.

### getErrorPolicy() Method

    public TransitionPolicy getErrorPolicy()

Set the transition policy that is invoked when the state is exited with an invalid transition.

### getExitPolicy() Method

    public TransitionPolicy getExitPolicy()

Get the transition policy that is invoked when the state is exited.

### getName() Method

    public String getName()

Get the value of name

#### Returns

name.

### setEnterPolicy(TransitionPolicy) Method

    public void setEnterPolicy(TransitionPolicy policy)

Set a transition policy that is invoked when the state is entered.

### setErrorPolicy(TransitionPolicy) Method

    public void setErrorPolicy(TransitionPolicy policy)

Set a transition policy that is invoked when the state is exited with an invalid transition.

### setExitPolicy(TransitionPolicy) Method

    public void setExitPolicy(TransitionPolicy policy)

Set a transition policy that is invoked when the state is exited.

### setName(String) Method

    public void setName(String name)

Set the value of name

#### Parameters

name
  name to be added