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

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

/* Generated SBE (Simple Binary Encoding) message codec. */
package b3.entrypoint.fixp.sbe;

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


/**
 * PositionMaintenanceReport message is sent by the holder of a position in response to a PositionMaintenanceRequest message and is used to confirm that a request has been successfully processed or rejected.
 */
@SuppressWarnings("all")
public final class PositionMaintenanceReportEncoder implements MessageEncoderFlyweight
{
    public static final int BLOCK_LENGTH = 72;
    public static final int TEMPLATE_ID = 503;
    public static final int SCHEMA_ID = 1;
    public static final int SCHEMA_VERSION = 5;
    public static final java.nio.ByteOrder BYTE_ORDER = java.nio.ByteOrder.LITTLE_ENDIAN;

    private final PositionMaintenanceReportEncoder parentMessage = this;
    private MutableDirectBuffer buffer;
    private int initialOffset;
    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 initialOffset()
    {
        return initialOffset;
    }

    public int offset()
    {
        return offset;
    }

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

        return this;
    }

    public PositionMaintenanceReportEncoder 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 posMaintRptIDId()
    {
        return 721;
    }

    public static int posMaintRptIDSinceVersion()
    {
        return 0;
    }

    public static int posMaintRptIDEncodingOffset()
    {
        return 0;
    }

    public static int posMaintRptIDEncodingLength()
    {
        return 8;
    }

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

        return "";
    }

    public static long posMaintRptIDNullValue()
    {
        return 0xffffffffffffffffL;
    }

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

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

    public PositionMaintenanceReportEncoder posMaintRptID(final long value)
    {
        buffer.putLong(offset + 0, value, java.nio.ByteOrder.LITTLE_ENDIAN);
        return this;
    }


    public static int posReqIDId()
    {
        return 710;
    }

    public static int posReqIDSinceVersion()
    {
        return 0;
    }

    public static int posReqIDEncodingOffset()
    {
        return 8;
    }

    public static int posReqIDEncodingLength()
    {
        return 8;
    }

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

        return "";
    }

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

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

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

    public PositionMaintenanceReportEncoder posReqID(final long value)
    {
        buffer.putLong(offset + 8, value, java.nio.ByteOrder.LITTLE_ENDIAN);
        return this;
    }


    public static int origPosReqRefIDId()
    {
        return 713;
    }

    public static int origPosReqRefIDSinceVersion()
    {
        return 0;
    }

    public static int origPosReqRefIDEncodingOffset()
    {
        return 16;
    }

    public static int origPosReqRefIDEncodingLength()
    {
        return 8;
    }

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

        return "";
    }

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

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

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

    public PositionMaintenanceReportEncoder origPosReqRefID(final long value)
    {
        buffer.putLong(offset + 16, value, java.nio.ByteOrder.LITTLE_ENDIAN);
        return this;
    }


    public static int securityIDId()
    {
        return 48;
    }

    public static int securityIDSinceVersion()
    {
        return 0;
    }

    public static int securityIDEncodingOffset()
    {
        return 24;
    }

    public static int securityIDEncodingLength()
    {
        return 8;
    }

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

        return "";
    }

    public static long securityIDNullValue()
    {
        return 0xffffffffffffffffL;
    }

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

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

    public PositionMaintenanceReportEncoder securityID(final long value)
    {
        buffer.putLong(offset + 24, value, java.nio.ByteOrder.LITTLE_ENDIAN);
        return this;
    }


    public static int securityIDSourceId()
    {
        return 22;
    }

    public static int securityIDSourceSinceVersion()
    {
        return 0;
    }

    public static int securityIDSourceEncodingOffset()
    {
        return 32;
    }

    public static int securityIDSourceEncodingLength()
    {
        return 0;
    }

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

        return "";
    }

    public static byte securityIDSourceNullValue()
    {
        return (byte)0;
    }

    public static byte securityIDSourceMinValue()
    {
        return (byte)32;
    }

    public static byte securityIDSourceMaxValue()
    {
        return (byte)126;
    }


    private static final byte[] SECURITYIDSOURCE_VALUE = { 56 };

    public static int securityIDSourceLength()
    {
        return 1;
    }


    public byte securityIDSource(final int index)
    {
        return SECURITYIDSOURCE_VALUE[index];
    }

    public int getSecurityIDSource(final byte[] dst, final int offset, final int length)
    {
        final int bytesCopied = Math.min(length, 1);
        System.arraycopy(SECURITYIDSOURCE_VALUE, 0, dst, offset, bytesCopied);

        return bytesCopied;
    }

    public byte securityIDSource()
    {
        return (byte)56;
    }


    public static int securityExchangeId()
    {
        return 207;
    }

    public static int securityExchangeSinceVersion()
    {
        return 0;
    }

    public static int securityExchangeEncodingOffset()
    {
        return 32;
    }

    public static int securityExchangeEncodingLength()
    {
        return 0;
    }

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

        return "";
    }

    public static byte securityExchangeNullValue()
    {
        return (byte)0;
    }

    public static byte securityExchangeMinValue()
    {
        return (byte)32;
    }

    public static byte securityExchangeMaxValue()
    {
        return (byte)126;
    }


    private static final byte[] SECURITYEXCHANGE_VALUE = { 66, 86, 77, 70 };

    public static int securityExchangeLength()
    {
        return 4;
    }


    public byte securityExchange(final int index)
    {
        return SECURITYEXCHANGE_VALUE[index];
    }

    public int getSecurityExchange(final byte[] dst, final int offset, final int length)
    {
        final int bytesCopied = Math.min(length, 4);
        System.arraycopy(SECURITYEXCHANGE_VALUE, 0, dst, offset, bytesCopied);

        return bytesCopied;
    }

    public String securityExchange()
    {
        return "BVMF";
    }


    public static int posMaintResultId()
    {
        return 723;
    }

    public static int posMaintResultSinceVersion()
    {
        return 0;
    }

    public static int posMaintResultEncodingOffset()
    {
        return 32;
    }

    public static int posMaintResultEncodingLength()
    {
        return 4;
    }

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

        return "";
    }

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

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

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

    public PositionMaintenanceReportEncoder posMaintResult(final long value)
    {
        buffer.putInt(offset + 32, (int)value, java.nio.ByteOrder.LITTLE_ENDIAN);
        return this;
    }


    public static int tradeIDId()
    {
        return 1003;
    }

    public static int tradeIDSinceVersion()
    {
        return 0;
    }

    public static int tradeIDEncodingOffset()
    {
        return 36;
    }

    public static int tradeIDEncodingLength()
    {
        return 4;
    }

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

        return "";
    }

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

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

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

    public PositionMaintenanceReportEncoder tradeID(final long value)
    {
        buffer.putInt(offset + 36, (int)value, java.nio.ByteOrder.LITTLE_ENDIAN);
        return this;
    }


    public static int accountId()
    {
        return 1;
    }

    public static int accountSinceVersion()
    {
        return 0;
    }

    public static int accountEncodingOffset()
    {
        return 40;
    }

    public static int accountEncodingLength()
    {
        return 4;
    }

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

        return "";
    }

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

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

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

    public PositionMaintenanceReportEncoder account(final long value)
    {
        buffer.putInt(offset + 40, (int)value, java.nio.ByteOrder.LITTLE_ENDIAN);
        return this;
    }


    public static int clearingBusinessDateId()
    {
        return 715;
    }

    public static int clearingBusinessDateSinceVersion()
    {
        return 0;
    }

    public static int clearingBusinessDateEncodingOffset()
    {
        return 44;
    }

    public static int clearingBusinessDateEncodingLength()
    {
        return 2;
    }

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

        return "";
    }

    public static int clearingBusinessDateNullValue()
    {
        return 0;
    }

    public static int clearingBusinessDateMinValue()
    {
        return 0;
    }

    public static int clearingBusinessDateMaxValue()
    {
        return 65534;
    }

    public PositionMaintenanceReportEncoder clearingBusinessDate(final int value)
    {
        buffer.putShort(offset + 44, (short)value, java.nio.ByteOrder.LITTLE_ENDIAN);
        return this;
    }


    public static int posTransTypeId()
    {
        return 709;
    }

    public static int posTransTypeSinceVersion()
    {
        return 0;
    }

    public static int posTransTypeEncodingOffset()
    {
        return 46;
    }

    public static int posTransTypeEncodingLength()
    {
        return 1;
    }

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

        return "";
    }

    public PositionMaintenanceReportEncoder posTransType(final PosTransType value)
    {
        buffer.putByte(offset + 46, (byte)value.value());
        return this;
    }

    public static int posMaintActionId()
    {
        return 712;
    }

    public static int posMaintActionSinceVersion()
    {
        return 0;
    }

    public static int posMaintActionEncodingOffset()
    {
        return 47;
    }

    public static int posMaintActionEncodingLength()
    {
        return 1;
    }

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

        return "";
    }

    public PositionMaintenanceReportEncoder posMaintAction(final PosMaintAction value)
    {
        buffer.putByte(offset + 47, value.value());
        return this;
    }

    public static int posMaintStatusId()
    {
        return 722;
    }

    public static int posMaintStatusSinceVersion()
    {
        return 0;
    }

    public static int posMaintStatusEncodingOffset()
    {
        return 48;
    }

    public static int posMaintStatusEncodingLength()
    {
        return 1;
    }

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

        return "";
    }

    public PositionMaintenanceReportEncoder posMaintStatus(final PosMaintStatus value)
    {
        buffer.putByte(offset + 48, value.value());
        return this;
    }

    public static int accountTypeId()
    {
        return 581;
    }

    public static int accountTypeSinceVersion()
    {
        return 0;
    }

    public static int accountTypeEncodingOffset()
    {
        return 49;
    }

    public static int accountTypeEncodingLength()
    {
        return 1;
    }

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

        return "";
    }

    public PositionMaintenanceReportEncoder accountType(final AccountType value)
    {
        buffer.putByte(offset + 49, (byte)value.value());
        return this;
    }

    public static int contraryInstructionIndicatorId()
    {
        return 719;
    }

    public static int contraryInstructionIndicatorSinceVersion()
    {
        return 0;
    }

    public static int contraryInstructionIndicatorEncodingOffset()
    {
        return 50;
    }

    public static int contraryInstructionIndicatorEncodingLength()
    {
        return 1;
    }

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

        return "";
    }

    public PositionMaintenanceReportEncoder contraryInstructionIndicator(final Boolean value)
    {
        buffer.putByte(offset + 50, (byte)value.value());
        return this;
    }

    public static int possResendId()
    {
        return 97;
    }

    public static int possResendSinceVersion()
    {
        return 0;
    }

    public static int possResendEncodingOffset()
    {
        return 51;
    }

    public static int possResendEncodingLength()
    {
        return 1;
    }

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

        return "";
    }

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

    public static int thresholdAmountId()
    {
        return 834;
    }

    public static int thresholdAmountSinceVersion()
    {
        return 0;
    }

    public static int thresholdAmountEncodingOffset()
    {
        return 56;
    }

    public static int thresholdAmountEncodingLength()
    {
        return 8;
    }

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

        return "";
    }

    private final PriceOffsetOptionalEncoder thresholdAmount = new PriceOffsetOptionalEncoder();

    /**
     * Used to indicate the minimum acceptable offset between the Strike Price and the Market Price.
     *
     * @return PriceOffsetOptionalEncoder : Used to indicate the minimum acceptable offset between the Strike Price and the Market Price.
     */
    public PriceOffsetOptionalEncoder thresholdAmount()
    {
        thresholdAmount.wrap(buffer, offset + 56);
        return thresholdAmount;
    }

    public static int transactTimeId()
    {
        return 60;
    }

    public static int transactTimeSinceVersion()
    {
        return 0;
    }

    public static int transactTimeEncodingOffset()
    {
        return 64;
    }

    public static int transactTimeEncodingLength()
    {
        return 8;
    }

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

        return "";
    }

    private final UTCTimestampNanosEncoder transactTime = new UTCTimestampNanosEncoder();

    /**
     * Time of execution/order creation; expressed in UTC.
     *
     * @return UTCTimestampNanosEncoder : Time of execution/order creation; expressed in UTC.
     */
    public UTCTimestampNanosEncoder transactTime()
    {
        transactTime.wrap(buffer, offset + 64);
        return transactTime;
    }

    private final NoPositionsEncoder noPositions = new NoPositionsEncoder(this);

    public static long noPositionsId()
    {
        return 702;
    }

    public NoPositionsEncoder noPositionsCount(final int count)
    {
        noPositions.wrap(buffer, count);
        return noPositions;
    }

    public static final class NoPositionsEncoder
    {
        public static final int HEADER_SIZE = 3;
        private final PositionMaintenanceReportEncoder parentMessage;
        private MutableDirectBuffer buffer;
        private int count;
        private int index;
        private int offset;
        private int initialLimit;

        NoPositionsEncoder(final PositionMaintenanceReportEncoder parentMessage)
        {
            this.parentMessage = parentMessage;
        }

        public void wrap(final MutableDirectBuffer buffer, final int count)
        {
            if (count < 0 || count > 254)
            {
                throw new IllegalArgumentException("count outside allowed range: count=" + count);
            }

            if (buffer != this.buffer)
            {
                this.buffer = buffer;
            }

            index = 0;
            this.count = count;
            final int limit = parentMessage.limit();
            initialLimit = limit;
            parentMessage.limit(limit + HEADER_SIZE);
            buffer.putShort(limit + 0, (short)18, java.nio.ByteOrder.LITTLE_ENDIAN);
            buffer.putByte(limit + 2, (byte)count);
        }

        public NoPositionsEncoder next()
        {
            if (index >= count)
            {
                throw new java.util.NoSuchElementException();
            }

            offset = parentMessage.limit();
            parentMessage.limit(offset + sbeBlockLength());
            ++index;

            return this;
        }

        public int resetCountToIndex()
        {
            count = index;
            buffer.putByte(initialLimit + 2, (byte)count);

            return count;
        }

        public static short countMinValue()
        {
            return (short)0;
        }

        public static short countMaxValue()
        {
            return (short)254;
        }

        public static int sbeHeaderSize()
        {
            return HEADER_SIZE;
        }

        public static int sbeBlockLength()
        {
            return 18;
        }

        public static int posTypeId()
        {
            return 703;
        }

        public static int posTypeSinceVersion()
        {
            return 0;
        }

        public static int posTypeEncodingOffset()
        {
            return 0;
        }

        public static int posTypeEncodingLength()
        {
            return 1;
        }

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

            return "";
        }

        public NoPositionsEncoder posType(final PosType value)
        {
            buffer.putByte(offset + 0, value.value());
            return this;
        }

        public static int longQtyId()
        {
            return 704;
        }

        public static int longQtySinceVersion()
        {
            return 0;
        }

        public static int longQtyEncodingOffset()
        {
            return 2;
        }

        public static int longQtyEncodingLength()
        {
            return 8;
        }

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

            return "";
        }

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

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

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

        public NoPositionsEncoder longQty(final long value)
        {
            buffer.putLong(offset + 2, value, java.nio.ByteOrder.LITTLE_ENDIAN);
            return this;
        }


        public static int shortQtyId()
        {
            return 705;
        }

        public static int shortQtySinceVersion()
        {
            return 0;
        }

        public static int shortQtyEncodingOffset()
        {
            return 10;
        }

        public static int shortQtyEncodingLength()
        {
            return 8;
        }

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

            return "";
        }

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

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

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

        public NoPositionsEncoder shortQty(final long value)
        {
            buffer.putLong(offset + 10, value, java.nio.ByteOrder.LITTLE_ENDIAN);
            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 PositionMaintenanceReportEncoder 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 PositionMaintenanceReportEncoder 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 PositionMaintenanceReportEncoder 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 PositionMaintenanceReportEncoder 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 deskIDId()
    {
        return 35510;
    }

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

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

        return "";
    }

    public static int deskIDHeaderLength()
    {
        return 1;
    }

    public PositionMaintenanceReportEncoder putDeskID(final DirectBuffer src, final int srcOffset, final int length)
    {
        if (length > 20)
        {
            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 PositionMaintenanceReportEncoder putDeskID(final byte[] src, final int srcOffset, final int length)
    {
        if (length > 20)
        {
            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 PositionMaintenanceReportEncoder deskID(final String value)
    {
        final int length = null == value ? 0 : value.length();
        if (length > 20)
        {
            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 PositionMaintenanceReportEncoder deskID(final CharSequence value)
    {
        final int length = null == value ? 0 : value.length();
        if (length > 20)
        {
            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 PositionMaintenanceReportEncoder 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 PositionMaintenanceReportEncoder 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 PositionMaintenanceReportEncoder 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 PositionMaintenanceReportDecoder decoder = new PositionMaintenanceReportDecoder();
        decoder.wrap(buffer, initialOffset, BLOCK_LENGTH, SCHEMA_VERSION);

        return decoder.appendTo(builder);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy