org.apache.qpid.framing
Enum AMQType

java.lang.Object
  extended by java.lang.Enum<AMQType>
      extended by org.apache.qpid.framing.AMQType
All Implemented Interfaces:
Serializable, Comparable<AMQType>

public enum AMQType
extends Enum<AMQType>

AMQType is a type that represents the different possible AMQP field table types. It provides operations for each of the types to perform tasks such as calculating the size of an instance of the type, converting types between AMQP and Java native types, and reading and writing instances of AMQP types in binary formats to and from byte buffers.

CRC Card
Responsibilities Collaborations
Get the equivalent one byte identifier for a type.
Calculate the size of an instance of an AMQP parameter type. EncodingUtils
Convert an instance of an AMQP parameter into a compatable Java object tagged with its AMQP type. AMQTypedValue
Write an instance of an AMQP parameter type to a byte buffer. EncodingUtils
Read an instance of an AMQP parameter from a byte buffer. EncodingUtils


Enum Constant Summary
ASCII_CHARACTER
           
ASCII_STRING
           
BINARY
           
BOOLEAN
           
BYTE
           
DECIMAL
           
DOUBLE
           
FIELD_TABLE
          Implements the field table type.
FLOAT
           
INT
           
INTEGER
           
LONG
           
LONG_STRING
           
SHORT
           
TIMESTAMP
           
VOID
           
WIDE_STRING
           
 
Method Summary
 AMQTypedValue asTypedValue(Object value)
          Converts an instance of the type to an equivalent Java native representation, packaged as an AMQTypedValue tagged with its AMQP type.
abstract  int getEncodingSize(Object value)
          Calculates the size of an instance of the type in bytes.
 byte identifier()
          Extracts the byte identifier for the typ.
(package private) abstract  Object readValueFromBuffer(org.apache.mina.common.ByteBuffer buffer)
          Reads an instance of the type from a specified byte buffer.
abstract  Object toNativeValue(Object value)
          Converts an instance of the type to an equivalent Java native representation.
static AMQType valueOf(String name)
          Returns the enum constant of this type with the specified name.
static AMQType[] values()
          Returns an array containing the constants of this enum type, in the order they are declared.
 void writeToBuffer(Object value, org.apache.mina.common.ByteBuffer buffer)
          Writes an instance of the type to a specified byte buffer, preceded by its one byte identifier.
(package private) abstract  void writeValueImpl(Object value, org.apache.mina.common.ByteBuffer buffer)
          Writes an instance of the type to a specified byte buffer.
 
Methods inherited from class java.lang.Enum
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Enum Constant Detail

LONG_STRING

public static final AMQType LONG_STRING

INTEGER

public static final AMQType INTEGER

DECIMAL

public static final AMQType DECIMAL

TIMESTAMP

public static final AMQType TIMESTAMP

FIELD_TABLE

public static final AMQType FIELD_TABLE
Implements the field table type. The native value of a field table type will be an instance of FieldTable, which itself may contain name/value pairs encoded as AMQTypedValues.


VOID

public static final AMQType VOID

BINARY

public static final AMQType BINARY

ASCII_STRING

public static final AMQType ASCII_STRING

WIDE_STRING

public static final AMQType WIDE_STRING

BOOLEAN

public static final AMQType BOOLEAN

ASCII_CHARACTER

public static final AMQType ASCII_CHARACTER

BYTE

public static final AMQType BYTE

SHORT

public static final AMQType SHORT

INT

public static final AMQType INT

LONG

public static final AMQType LONG

FLOAT

public static final AMQType FLOAT

DOUBLE

public static final AMQType DOUBLE
Method Detail

values

public static AMQType[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
for (AMQType c : AMQType.values())
    System.out.println(c);

Returns:
an array containing the constants of this enum type, in the order they are declared

valueOf

public static AMQType valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

Parameters:
name - the name of the enum constant to be returned.
Returns:
the enum constant with the specified name
Throws:
IllegalArgumentException - if this enum type has no constant with the specified name
NullPointerException - if the argument is null

identifier

public final byte identifier()
Extracts the byte identifier for the typ.

Returns:
The byte identifier for the typ.

getEncodingSize

public abstract int getEncodingSize(Object value)
Calculates the size of an instance of the type in bytes.

Parameters:
value - An instance of the type.
Returns:
The size of the instance of the type in bytes.

toNativeValue

public abstract Object toNativeValue(Object value)
Converts an instance of the type to an equivalent Java native representation.

Parameters:
value - An instance of the type.
Returns:
An equivalent Java native representation.

asTypedValue

public AMQTypedValue asTypedValue(Object value)
Converts an instance of the type to an equivalent Java native representation, packaged as an AMQTypedValue tagged with its AMQP type.

Parameters:
value - An instance of the type.
Returns:
An equivalent Java native representation, tagged with its AMQP type.

writeToBuffer

public void writeToBuffer(Object value,
                          org.apache.mina.common.ByteBuffer buffer)
Writes an instance of the type to a specified byte buffer, preceded by its one byte identifier. As the type and value are both written, this provides a fully encoded description of a parameters type and value.

Parameters:
value - An instance of the type.
buffer - The byte buffer to write it to.

writeValueImpl

abstract void writeValueImpl(Object value,
                             org.apache.mina.common.ByteBuffer buffer)
Writes an instance of the type to a specified byte buffer.

Parameters:
value - An instance of the type.
buffer - The byte buffer to write it to.

readValueFromBuffer

abstract Object readValueFromBuffer(org.apache.mina.common.ByteBuffer buffer)
Reads an instance of the type from a specified byte buffer.

Parameters:
buffer - The byte buffer to write it to.
Returns:
An instance of the type.


Licensed to the Apache Software Foundation