Search in sources :

Example 1 with Role

use of com.swiftmq.amqp.v100.generated.transport.definitions.Role in project swiftmq-client by iitsoftware.

the class DispositionFrame method decode.

private void decode() throws Exception {
    List l = body.getValue();
    AMQPType t = null;
    int idx = 0;
    // Factory  : ./.
    if (idx >= l.size())
        return;
    t = (AMQPType) l.get(idx++);
    if (t.getCode() == AMQPTypeDecoder.NULL)
        throw new Exception("Mandatory field 'role' in 'Disposition' frame is NULL");
    try {
        role = new Role(((AMQPBoolean) t).getValue());
    } catch (ClassCastException e) {
        throw new Exception("Invalid type of field 'role' in 'Disposition' frame: " + e);
    }
    // Factory  : ./.
    if (idx >= l.size())
        return;
    t = (AMQPType) l.get(idx++);
    if (t.getCode() == AMQPTypeDecoder.NULL)
        throw new Exception("Mandatory field 'first' in 'Disposition' frame is NULL");
    try {
        first = new DeliveryNumber(((AMQPUnsignedInt) t).getValue());
    } catch (ClassCastException e) {
        throw new Exception("Invalid type of field 'first' in 'Disposition' frame: " + e);
    }
    // Factory  : ./.
    if (idx >= l.size())
        return;
    t = (AMQPType) l.get(idx++);
    try {
        if (t.getCode() != AMQPTypeDecoder.NULL)
            last = new DeliveryNumber(((AMQPUnsignedInt) t).getValue());
    } catch (ClassCastException e) {
        throw new Exception("Invalid type of field 'last' in 'Disposition' frame: " + e);
    }
    // Factory  : ./.
    if (idx >= l.size())
        return;
    t = (AMQPType) l.get(idx++);
    try {
        if (t.getCode() != AMQPTypeDecoder.NULL)
            settled = (AMQPBoolean) t;
    } catch (ClassCastException e) {
        throw new Exception("Invalid type of field 'settled' in 'Disposition' frame: " + e);
    }
    // Factory  : DeliveryStateFactory
    if (idx >= l.size())
        return;
    t = (AMQPType) l.get(idx++);
    if (t.getCode() != AMQPTypeDecoder.NULL)
        state = DeliveryStateFactory.create(t);
    // Factory  : ./.
    if (idx >= l.size())
        return;
    t = (AMQPType) l.get(idx++);
    try {
        if (t.getCode() != AMQPTypeDecoder.NULL)
            batchable = (AMQPBoolean) t;
    } catch (ClassCastException e) {
        throw new Exception("Invalid type of field 'batchable' in 'Disposition' frame: " + e);
    }
}
Also used : Role(com.swiftmq.amqp.v100.generated.transport.definitions.Role) DeliveryNumber(com.swiftmq.amqp.v100.generated.transport.definitions.DeliveryNumber) List(java.util.List) ArrayList(java.util.ArrayList) IOException(java.io.IOException)

Aggregations

DeliveryNumber (com.swiftmq.amqp.v100.generated.transport.definitions.DeliveryNumber)1 Role (com.swiftmq.amqp.v100.generated.transport.definitions.Role)1 IOException (java.io.IOException)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1