Skip to content

Field Attributes #483

Closed
Closed
@adkapur

Description

@adkapur

Field attributes such as presence do not seem to be accessible

<field description="Account mnemonic as agreed between buy and sell sides, e.g. broker and institution or investor/intermediary and fund manager." id="1" name="Account" semanticType="String" presence="required" offset="25" type="String12"/>

sbe-rc2

//String example in rlsbe

public static int accountId()
{
return 1;
}

public static int accountSinceVersion()
{
return 0;
}

public static String accountMetaAttribute(final MetaAttribute metaAttribute)
{
switch (metaAttribute)
{
case EPOCH: return "unix";
case TIME_UNIT: return "nanosecond";
case SEMANTIC_TYPE: return "String";
}

return "";

}

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

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

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

public static int accountLength()
{
return 12;
}

public byte account(final int index)
{
if (index < 0 || index >= 12)
{
throw new IndexOutOfBoundsException("index out of range: index=" + index);
}

final int pos = this.offset + 25 + (index * 1);

return buffer.getByte(pos);

}

public static String accountCharacterEncoding()
{
return "UTF-8";
}

public int getAccount(final byte[] dst, final int dstOffset)
{
final int length = 12;
if (dstOffset < 0 || dstOffset > (dst.length - length))
{
throw new IndexOutOfBoundsException("dstOffset out of range for copy: offset=" + dstOffset);
}

buffer.getBytes(this.offset + 25, dst, dstOffset, length);

return length;

}
we’d expect in something related to presence in meta attribute function, although right now that’s not even a member of the MetaAttribute enum:

public static String accountMetaAttribute(final MetaAttribute metaAttribute)
{
switch (metaAttribute)
{
case EPOCH: return "unix";
case TIME_UNIT: return "nanosecond";
case SEMANTIC_TYPE: return "String";
case PRESENCE: return “required”;
}

return "";

}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions