Class DischargeTypeEncoder
- java.lang.Object
-
- org.apache.qpid.protonj2.codec.encoders.AbstractDescribedTypeEncoder<V>
-
- org.apache.qpid.protonj2.codec.encoders.AbstractDescribedListTypeEncoder<Discharge>
-
- org.apache.qpid.protonj2.codec.encoders.transactions.DischargeTypeEncoder
-
- All Implemented Interfaces:
DescribedTypeEncoder<Discharge>,TypeEncoder<Discharge>
public final class DischargeTypeEncoder extends AbstractDescribedListTypeEncoder<Discharge>
Encoder of AMQP Discharge type values to a byte stream.
-
-
Constructor Summary
Constructors Constructor Description DischargeTypeEncoder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description UnsignedLonggetDescriptorCode()SymbolgetDescriptorSymbol()intgetElementCount(Discharge discharge)Gets the number of elements that will result when this type is encoded into an AMQP List type.bytegetListEncoding(Discharge value)Determine 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.intgetMinElementCount()Return the minimum number of elements that this AMQP type must provide in order to be considered a valid type.Class<Discharge>getTypeClass()voidwriteElement(Discharge discharge, int index, ProtonBuffer buffer, EncoderState state)Instructs the encoder to write the element identified with the given index-
Methods inherited from class org.apache.qpid.protonj2.codec.encoders.AbstractDescribedListTypeEncoder
writeArray, writeRawArray, writeType
-
Methods inherited from class org.apache.qpid.protonj2.codec.encoders.AbstractDescribedTypeEncoder
isArrayType
-
-
-
-
Method Detail
-
getDescriptorCode
public UnsignedLong getDescriptorCode()
- Returns:
- the UnsignedLong value to use as the Descriptor for this type.
-
getDescriptorSymbol
public Symbol getDescriptorSymbol()
- Returns:
- the Symbol value to use as the Descriptor for this type.
-
getTypeClass
public Class<Discharge> getTypeClass()
- Returns:
- the Class type that this encoder handles.
-
writeElement
public void writeElement(Discharge discharge, int index, ProtonBuffer buffer, EncoderState state)
Description copied from class:AbstractDescribedListTypeEncoderInstructs the encoder to write the element identified with the given index- Specified by:
writeElementin classAbstractDescribedListTypeEncoder<Discharge>- Parameters:
discharge- the source of the list elements to writeindex- the element index that needs to be writtenbuffer- the buffer to write the element tostate- the current EncoderState value to use.
-
getListEncoding
public byte getListEncoding(Discharge value)
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<Discharge>- Parameters:
value- The value that is to be encoded.- Returns:
- the encoding code of the list type encoding needed for this object.
-
getElementCount
public int getElementCount(Discharge discharge)
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<Discharge>- Parameters:
discharge- 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<Discharge>- Returns:
- the minimum number of elements this type must provide.
-
-