facebook

[Closed] Byte array initialization

  1. MyEclipse Archived
  2.  > 
  3. UML Development
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #260845 Reply

    I am attempting to model a class called Identifier that has an attribute called name. This attribute is simply a static byte array
    initialized as such:

    private static final byte[] name = {'B', 'X', 'M', 'L', 0x00};

    In Properties|Initial Value I code:

    'B', 'X', 'M', 'L', 0x00

    The code generator does not add the braces, so what I get is:

    private static final byte[] name = 'B', 'X', 'M', 'L', 0x00;

    which is in error. If I try to include the braces in the Initial Value field, they are automatically stripped.

    How can this byte array initialization be modeled?

    Thanks
    Greg

    #260914 Reply

    Riyad Kalla
    Member

    Greg,
    Have you tried something like:
    new byte[]{ ‘B’, ‘X’, ‘M’, ‘L’, 0x00 }

    for the initial value? I’ll admit, I haven’t tried to do this before.

    #260982 Reply

    Yes that works! Thank you.

    Since Java supports the initialization as I outlined, shouldn’t the UML Initial Value support it also?

    No need to rely.

    Thanks again.

Viewing 3 posts - 1 through 3 (of 3 total)
Reply To: [Closed] Byte array initialization

You must be logged in to post in the forum log in