blob: c1fde7181d896c66acf691cfcbf1ef9c8edc1a35 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
package org.apache.qpid.nclient.amqp.state;
import org.apache.qpid.nclient.core.AMQPException;
public class AMQPStateMachine
{
protected void checkIfValidStateTransition(AMQPState correctState,AMQPState currentState,AMQPState requiredState) throws IllegalStateTransitionException
{
if (currentState != correctState)
{
throw new IllegalStateTransitionException(currentState,requiredState);
}
}
protected void checkIfValidStateTransition(AMQPState[] correctStates,AMQPState currentState,AMQPState requiredState) throws IllegalStateTransitionException
{
for(AMQPState correctState :correctStates)
{
if (currentState == correctState)
{
return;
}
}
throw new IllegalStateTransitionException(currentState,requiredState);
}
}
|