Book a Demo

Author Topic: create a class, but why not package?  (Read 2670 times)

kanxg

  • EA Novice
  • *
  • Posts: 2
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
create a class, but why not package?
« on: September 19, 2006, 01:28:21 am »
i created a new project,then in logical view ,
i create a package "com",
then created a class :a.java in package com.
add a method geta();
in project view, right key the class i created, choose "generate code". then i get the src file:

/**
* @author xingang.kan
* @version 1.0
* @created 19-九月-2006 16:29:13
*/
public class a {

public a(){

}

public void finalize() throws Throwable {

}

public void geta(){

}

}

why the head of the class. no " package  com;"?
who can help me?

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: create a class, but why not package?
« Reply #1 on: September 19, 2006, 03:07:37 pm »
It's likely because your package "com" is a namespace root.  Right click on it in the tree and select Code Engineering | Clear Namespace Root.  Then repeat for the package above except select Set Namespace Root.

See http://www.sparxsystems.com.au/EAUserGuide/index.html?namespaces.htm for more information.

kanxg

  • EA Novice
  • *
  • Posts: 2
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
Re: create a class, but why not package?
« Reply #2 on: September 19, 2006, 07:42:47 pm »
thank you very much!
but in rose, if u want to generate a class, u must associate a class to a componet.
in ea, do not need do it?only create a class,then generate it.ok?

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: create a class, but why not package?
« Reply #3 on: September 19, 2006, 09:04:09 pm »
Correct, you do not need to association a class to a component to generate it in EA.