Class TransactionStateTypeEncoder
java.lang.Object
org.apache.qpid.protonj2.codec.encoders.AbstractDescribedTypeEncoder<V>
org.apache.qpid.protonj2.codec.encoders.AbstractDescribedListTypeEncoder<TransactionalState>
org.apache.qpid.protonj2.codec.encoders.transactions.TransactionStateTypeEncoder
- All Implemented Interfaces:
DescribedTypeEncoder<TransactionalState>,TypeEncoder<TransactionalState>
public final class TransactionStateTypeEncoder
extends AbstractDescribedListTypeEncoder<TransactionalState>
Encoder of AMQP TransactionState type values to a byte stream.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintgetElementCount(TransactionalState txState) Gets the number of elements that will result when this type is encoded into an AMQP List type.byteDetermine the list type the given value can be encoded to based on the number of bytes that would be needed to hold the encoded form of the resulting list entries.intReturn the minimum number of elements that this AMQP type must provide in order to be considered a valid type.voidwriteElement(TransactionalState txState, int index, ProtonBuffer buffer, Encoder encoder, EncoderState state) Instructs the encoder to write the element identified with the given indexMethods inherited from class org.apache.qpid.protonj2.codec.encoders.AbstractDescribedListTypeEncoder
writeArray, writeRawArray, writeTypeMethods inherited from class org.apache.qpid.protonj2.codec.encoders.AbstractDescribedTypeEncoder
isArrayTypeMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.qpid.protonj2.codec.DescribedTypeEncoder
encoderRegistered
-
Constructor Details
-
TransactionStateTypeEncoder
public TransactionStateTypeEncoder()
-
-
Method Details
-
getDescriptorCode
- Returns:
- the UnsignedLong value to use as the Descriptor for this type.
-
getDescriptorSymbol
- Returns:
- the Symbol value to use as the Descriptor for this type.
-
getTypeClass
- Returns:
- the Class type that this encoder handles.
-
writeElement
public void writeElement(TransactionalState txState, int index, ProtonBuffer buffer, Encoder encoder, EncoderState state) Description copied from class:AbstractDescribedListTypeEncoderInstructs the encoder to write the element identified with the given index- Specified by:
writeElementin classAbstractDescribedListTypeEncoder<TransactionalState>- Parameters:
txState- the source of the list elements to writeindex- the element index that needs to be writtenbuffer- the buffer to write the element toencoder- the current Encoder value to use.state- the current EncoderState value to use.
-
getListEncoding
Description copied from class:AbstractDescribedListTypeEncoderDetermine the list type the given value can be encoded to based on the number of bytes that would be needed to hold the encoded form of the resulting list entries.Most encoders will return LIST32 but for cases where the type is known to be encoded to LIST8 or always encodes an empty list (LIST0) the encoder can optimize the encode step and not compute sizes.
- Overrides:
getListEncodingin classAbstractDescribedListTypeEncoder<TransactionalState>- Parameters:
value- The value that is to be encoded.- Returns:
- the encoding code of the list type encoding needed for this object.
-
getElementCount
Description copied from class:AbstractDescribedListTypeEncoderGets the number of elements that will result when this type is encoded into an AMQP List type.- Specified by:
getElementCountin classAbstractDescribedListTypeEncoder<TransactionalState>- Parameters:
txState- the value which will be encoded as a list type.- Returns:
- the number of elements that should comprise the encoded list.
-
getMinElementCount
public int getMinElementCount()Description copied from class:AbstractDescribedListTypeEncoderReturn the minimum number of elements that this AMQP type must provide in order to be considered a valid type.- Overrides:
getMinElementCountin classAbstractDescribedListTypeEncoder<TransactionalState>- Returns:
- the minimum number of elements this type must provide.
-