All Downloads are FREE. Search and download functionalities are using the official Maven repository.

b3.entrypoint.fixp.sbe.BusinessMessageRejectEncoder Maven / Gradle / Ivy

There is a newer version: 0.157
Show newest version
/* Generated SBE (Simple Binary Encoding) message codec. */
package b3.entrypoint.fixp.sbe;

import org.agrona.MutableDirectBuffer;
import org.agrona.DirectBuffer;
import org.agrona.sbe.*;


/**
 * BusinessMessageReject message can reject an application-level message which fulfills session level rules but fails the business rules.
 */
@SuppressWarnings("all")
public final class BusinessMessageRejectEncoder implements MessageEncoderFlyweight
{
    public static final int BLOCK_LENGTH = 18;
    public static final int TEMPLATE_ID = 206;
    public static final int SCHEMA_ID = 1;
    public static final int SCHEMA_VERSION = 5;
    public static final String SEMANTIC_VERSION = "5.6";
    public static final java.nio.ByteOrder BYTE_ORDER = java.nio.ByteOrder.LITTLE_ENDIAN;

    private final BusinessMessageRejectEncoder parentMessage = this;
    private MutableDirectBuffer buffer;
    private int offset;
    private int limit;

    public int sbeBlockLength()
    {
        return BLOCK_LENGTH;
    }

    public int sbeTemplateId()
    {
        return TEMPLATE_ID;
    }

    public int sbeSchemaId()
    {
        return SCHEMA_ID;
    }

    public int sbeSchemaVersion()
    {
        return SCHEMA_VERSION;
    }

    public String sbeSemanticType()
    {
        return "";
    }

    public MutableDirectBuffer buffer()
    {
        return buffer;
    }

    public int offset()
    {
        return offset;
    }

    public BusinessMessageRejectEncoder wrap(final MutableDirectBuffer buffer, final int offset)
    {
        if (buffer != this.buffer)
        {
            this.buffer = buffer;
        }
        this.offset = offset;
        limit(offset + BLOCK_LENGTH);

        return this;
    }

    public BusinessMessageRejectEncoder wrapAndApplyHeader(
        final MutableDirectBuffer buffer, final int offset, final MessageHeaderEncoder headerEncoder)
    {
        headerEncoder
            .wrap(buffer, offset)
            .blockLength(BLOCK_LENGTH)
            .templateId(TEMPLATE_ID)
            .schemaId(SCHEMA_ID)
            .version(SCHEMA_VERSION);

        return wrap(buffer, offset + MessageHeaderEncoder.ENCODED_LENGTH);
    }

    public int encodedLength()
    {
        return limit - offset;
    }

    public int limit()
    {
        return limit;
    }

    public void limit(final int limit)
    {
        this.limit = limit;
    }

    public static int messageTypeId()
    {
        return 35;
    }

    public static int messageTypeSinceVersion()
    {
        return 0;
    }

    public static int messageTypeEncodingOffset()
    {
        return 0;
    }

    public static int messageTypeEncodingLength()
    {
        return 1;
    }

    public static String messageTypeMetaAttribute(final MetaAttribute metaAttribute)
    {
        if (MetaAttribute.PRESENCE == metaAttribute)
        {
            return "constant";
        }

        return "";
    }

    public static int refSeqNumId()
    {
        return 45;
    }

    public static int refSeqNumSinceVersion()
    {
        return 0;
    }

    public static int refSeqNumEncodingOffset()
    {
        return 0;
    }

    public static int refSeqNumEncodingLength()
    {
        return 4;
    }

    public static String refSeqNumMetaAttribute(final MetaAttribute metaAttribute)
    {
        if (MetaAttribute.PRESENCE == metaAttribute)
        {
            return "required";
        }

        return "";
    }

    public static long refSeqNumNullValue()
    {
        return 4294967295L;
    }

    public static long refSeqNumMinValue()
    {
        return 0L;
    }

    public static long refSeqNumMaxValue()
    {
        return 4294967294L;
    }

    public BusinessMessageRejectEncoder refSeqNum(final long value)
    {
        buffer.putInt(offset + 0, (int)value, BYTE_ORDER);
        return this;
    }


    public static int refMsgTypeId()
    {
        return 372;
    }

    public static int refMsgTypeSinceVersion()
    {
        return 0;
    }

    public static int refMsgTypeEncodingOffset()
    {
        return 4;
    }

    public static int refMsgTypeEncodingLength()
    {
        return 1;
    }

    public static String refMsgTypeMetaAttribute(final MetaAttribute metaAttribute)
    {
        if (MetaAttribute.PRESENCE == metaAttribute)
        {
            return "required";
        }

        return "";
    }

    public BusinessMessageRejectEncoder refMsgType(final MessageType value)
    {
        buffer.putByte(offset + 4, (byte)value.value());
        return this;
    }

    public static int businessRejectRefIDId()
    {
        return 379;
    }

    public static int businessRejectRefIDSinceVersion()
    {
        return 0;
    }

    public static int businessRejectRefIDEncodingOffset()
    {
        return 5;
    }

    public static int businessRejectRefIDEncodingLength()
    {
        return 8;
    }

    public static String businessRejectRefIDMetaAttribute(final MetaAttribute metaAttribute)
    {
        if (MetaAttribute.PRESENCE == metaAttribute)
        {
            return "optional";
        }

        return "";
    }

    public static long businessRejectRefIDNullValue()
    {
        return 0x0L;
    }

    public static long businessRejectRefIDMinValue()
    {
        return 0x0L;
    }

    public static long businessRejectRefIDMaxValue()
    {
        return 0xfffffffffffffffeL;
    }

    public BusinessMessageRejectEncoder businessRejectRefID(final long value)
    {
        buffer.putLong(offset + 5, value, BYTE_ORDER);
        return this;
    }


    public static int businessRejectReasonId()
    {
        return 380;
    }

    public static int businessRejectReasonSinceVersion()
    {
        return 0;
    }

    public static int businessRejectReasonEncodingOffset()
    {
        return 13;
    }

    public static int businessRejectReasonEncodingLength()
    {
        return 4;
    }

    public static String businessRejectReasonMetaAttribute(final MetaAttribute metaAttribute)
    {
        if (MetaAttribute.PRESENCE == metaAttribute)
        {
            return "optional";
        }

        return "";
    }

    public static long businessRejectReasonNullValue()
    {
        return 0L;
    }

    public static long businessRejectReasonMinValue()
    {
        return 0L;
    }

    public static long businessRejectReasonMaxValue()
    {
        return 4294967294L;
    }

    public BusinessMessageRejectEncoder businessRejectReason(final long value)
    {
        buffer.putInt(offset + 13, (int)value, BYTE_ORDER);
        return this;
    }


    public static int possResendId()
    {
        return 97;
    }

    public static int possResendSinceVersion()
    {
        return 0;
    }

    public static int possResendEncodingOffset()
    {
        return 17;
    }

    public static int possResendEncodingLength()
    {
        return 1;
    }

    public static String possResendMetaAttribute(final MetaAttribute metaAttribute)
    {
        if (MetaAttribute.PRESENCE == metaAttribute)
        {
            return "required";
        }

        return "";
    }

    public BusinessMessageRejectEncoder possResend(final Boolean value)
    {
        buffer.putByte(offset + 17, (byte)value.value());
        return this;
    }

    public static int textId()
    {
        return 58;
    }

    public static String textCharacterEncoding()
    {
        return java.nio.charset.StandardCharsets.US_ASCII.name();
    }

    public static String textMetaAttribute(final MetaAttribute metaAttribute)
    {
        if (MetaAttribute.PRESENCE == metaAttribute)
        {
            return "required";
        }
        if (MetaAttribute.SEMANTIC_TYPE == metaAttribute)
        {
            return "String";
        }

        return "";
    }

    public static int textHeaderLength()
    {
        return 1;
    }

    public BusinessMessageRejectEncoder putText(final DirectBuffer src, final int srcOffset, final int length)
    {
        if (length > 250)
        {
            throw new IllegalStateException("length > maxValue for type: " + length);
        }

        final int headerLength = 1;
        final int limit = parentMessage.limit();
        parentMessage.limit(limit + headerLength + length);
        buffer.putByte(limit, (byte)length);
        buffer.putBytes(limit + headerLength, src, srcOffset, length);

        return this;
    }

    public BusinessMessageRejectEncoder putText(final byte[] src, final int srcOffset, final int length)
    {
        if (length > 250)
        {
            throw new IllegalStateException("length > maxValue for type: " + length);
        }

        final int headerLength = 1;
        final int limit = parentMessage.limit();
        parentMessage.limit(limit + headerLength + length);
        buffer.putByte(limit, (byte)length);
        buffer.putBytes(limit + headerLength, src, srcOffset, length);

        return this;
    }

    public BusinessMessageRejectEncoder text(final String value)
    {
        final int length = null == value ? 0 : value.length();
        if (length > 250)
        {
            throw new IllegalStateException("length > maxValue for type: " + length);
        }

        final int headerLength = 1;
        final int limit = parentMessage.limit();
        parentMessage.limit(limit + headerLength + length);
        buffer.putByte(limit, (byte)length);
        buffer.putStringWithoutLengthAscii(limit + headerLength, value);

        return this;
    }

    public BusinessMessageRejectEncoder text(final CharSequence value)
    {
        final int length = null == value ? 0 : value.length();
        if (length > 250)
        {
            throw new IllegalStateException("length > maxValue for type: " + length);
        }

        final int headerLength = 1;
        final int limit = parentMessage.limit();
        parentMessage.limit(limit + headerLength + length);
        buffer.putByte(limit, (byte)length);
        buffer.putStringWithoutLengthAscii(limit + headerLength, value);

        return this;
    }

    public static int memoId()
    {
        return 5149;
    }

    public static String memoCharacterEncoding()
    {
        return java.nio.charset.StandardCharsets.UTF_8.name();
    }

    public static String memoMetaAttribute(final MetaAttribute metaAttribute)
    {
        if (MetaAttribute.PRESENCE == metaAttribute)
        {
            return "required";
        }
        if (MetaAttribute.SEMANTIC_TYPE == metaAttribute)
        {
            return "String";
        }

        return "";
    }

    public static int memoHeaderLength()
    {
        return 1;
    }

    public BusinessMessageRejectEncoder putMemo(final DirectBuffer src, final int srcOffset, final int length)
    {
        if (length > 40)
        {
            throw new IllegalStateException("length > maxValue for type: " + length);
        }

        final int headerLength = 1;
        final int limit = parentMessage.limit();
        parentMessage.limit(limit + headerLength + length);
        buffer.putByte(limit, (byte)length);
        buffer.putBytes(limit + headerLength, src, srcOffset, length);

        return this;
    }

    public BusinessMessageRejectEncoder putMemo(final byte[] src, final int srcOffset, final int length)
    {
        if (length > 40)
        {
            throw new IllegalStateException("length > maxValue for type: " + length);
        }

        final int headerLength = 1;
        final int limit = parentMessage.limit();
        parentMessage.limit(limit + headerLength + length);
        buffer.putByte(limit, (byte)length);
        buffer.putBytes(limit + headerLength, src, srcOffset, length);

        return this;
    }

    public BusinessMessageRejectEncoder memo(final String value)
    {
        final byte[] bytes = (null == value || value.isEmpty()) ? org.agrona.collections.ArrayUtil.EMPTY_BYTE_ARRAY : value.getBytes(java.nio.charset.StandardCharsets.UTF_8);

        final int length = bytes.length;
        if (length > 40)
        {
            throw new IllegalStateException("length > maxValue for type: " + length);
        }

        final int headerLength = 1;
        final int limit = parentMessage.limit();
        parentMessage.limit(limit + headerLength + length);
        buffer.putByte(limit, (byte)length);
        buffer.putBytes(limit + headerLength, bytes, 0, length);

        return this;
    }

    public String toString()
    {
        if (null == buffer)
        {
            return "";
        }

        return appendTo(new StringBuilder()).toString();
    }

    public StringBuilder appendTo(final StringBuilder builder)
    {
        if (null == buffer)
        {
            return builder;
        }

        final BusinessMessageRejectDecoder decoder = new BusinessMessageRejectDecoder();
        decoder.wrap(buffer, offset, BLOCK_LENGTH, SCHEMA_VERSION);

        return decoder.appendTo(builder);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy