xmlBlaster 2.2.0 client API

org.xmlBlaster.util.dispatch
Class ConnectionStateEnum

java.lang.Object
  extended by org.xmlBlaster.util.dispatch.ConnectionStateEnum
All Implemented Interfaces:
java.io.Serializable

public final class ConnectionStateEnum
extends java.lang.Object
implements java.io.Serializable

This class simulates an enumeration for the connection states.

Note that this implementation has a fixed number of four states.

Author:
xmlBlaster@marcelruff.info
See Also:
Serialized Form

Field Summary
static ConnectionStateEnum ALIVE
          We have a connection (0).
static ConnectionStateEnum DEAD
          The connection is dead an no recovery is possible (2).
static ConnectionStateEnum POLLING
          We have lost the connection and are polling for it (1).
static ConnectionStateEnum UNDEF
          The connection state is not known (-1).
 
Method Summary
 boolean equals(ConnectionStateEnum other)
           
 int getInt()
          Returns the int representation of this connectionState
static ConnectionStateEnum parseConnectionState(java.lang.String state)
          Parses given string to extract the connectionState of a message.
static ConnectionStateEnum parseConnectionState(java.lang.String connectionState, ConnectionStateEnum defaultConnectionState)
          Parses given string to extract the connectionState of a message
static ConnectionStateEnum toConnectionStateEnum(int connectionState)
          Checks the given int and returns the corresponding ConnectionStateEnum instance.
 java.lang.String toString()
          Return a human readable string of the connectionState
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

UNDEF

public static final ConnectionStateEnum UNDEF
The connection state is not known (-1).


ALIVE

public static final ConnectionStateEnum ALIVE
We have a connection (0).


POLLING

public static final ConnectionStateEnum POLLING
We have lost the connection and are polling for it (1).


DEAD

public static final ConnectionStateEnum DEAD
The connection is dead an no recovery is possible (2).

Method Detail

toString

public java.lang.String toString()
Return a human readable string of the connectionState

Overrides:
toString in class java.lang.Object

equals

public boolean equals(ConnectionStateEnum other)

getInt

public final int getInt()
Returns the int representation of this connectionState


toConnectionStateEnum

public static final ConnectionStateEnum toConnectionStateEnum(int connectionState)
                                                       throws java.lang.IllegalArgumentException
Checks the given int and returns the corresponding ConnectionStateEnum instance.

Parameters:
prio - For example 7
Returns:
The enumeration object for this connectionState
Throws:
java.lang.IllegalArgumentException - if the given connectionState is invalid

parseConnectionState

public static final ConnectionStateEnum parseConnectionState(java.lang.String state)
                                                      throws java.lang.IllegalArgumentException
Parses given string to extract the connectionState of a message. We are case insensitive (e.g. "POLLING" or "poLLING" are OK).

Parameters:
state - For example "POLLING"
Returns:
The ConnectionStateEnum instance for the message connectionState
Throws:
java.lang.IllegalArgumentException - if the given connectionState is invalid

parseConnectionState

public static final ConnectionStateEnum parseConnectionState(java.lang.String connectionState,
                                                             ConnectionStateEnum defaultConnectionState)
Parses given string to extract the connectionState of a message

Parameters:
prio - For example "polling" or "alive"
defaultConnectionState - Value to use if not parsable
Returns:
The ConnectionStateEnum instance for the message connectionState

xmlBlaster 2.2.0 client API

Copyright © 1999-2014 The xmlBlaster.org contributers.