Book a Demo

Author Topic: Java and arrays construct  (Read 11539 times)

cable000

  • EA Novice
  • *
  • Posts: 11
  • Karma: +0/-0
    • View Profile
Java and arrays construct
« on: December 19, 2008, 07:41:22 am »
EA Version: 7.1.834

After importing the following code ( a.java and b.java ) in the model

a.java:
class A
{
   private B[] bees;
}

b.java:
class B
{
  private A a;
}

Now from the model if I generate code it changes a.java to

class A
{
  private B bees[];
}

So it moves the array operator after the member name.  Any ideas why it is doing this and how to correct?

Thanks!

Debesh

  • EA Novice
  • *
  • Posts: 1
  • Karma: +0/-0
    • View Profile
Re: Java and arrays construct
« Reply #1 on: February 03, 2009, 02:18:47 am »
When you reverse engg from source, the attribute
 private B [] bees;
is treated as a collection of type array... on fwd engg seperate attribute gets generated and thus the code becomes
  private B bees[];

Here is one example to show each attribute of type collection gets generated separately:

Import the below code for A.java, and B.java

class A {
private B [] bees, geese;
}

class B {
private A a;
}

Now fwd engg and you see smthng like...

class A {
      private B bees[];
      private B geese[];
}

class B {
      private A a;
}