Book a Demo

Author Topic: extending java.lang.Object  (Read 3014 times)

dsilveira28

  • EA Novice
  • *
  • Posts: 3
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
extending java.lang.Object
« on: April 21, 2005, 08:55:00 am »
Hi,

I am starting to design classes in EA and got stranded with this situation.

Want to created a new class that extends java.lang.Object.

How do I extend java.lang.Object (or another java.lang*).

Do I have to create the java.lang?
It would take ages!!!

IS there a kind of importa that I don't know?

HELP!!! :'(

Daniel Silveira

mikewhit

  • EA User
  • **
  • Posts: 608
  • Karma: +0/-0
  • Accessing ....
    • View Profile
Re: extending java.lang.Object
« Reply #1 on: April 21, 2005, 09:03:59 am »
Why do you need to - Object is an implicit superclass of all Java classes anyhow.

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: extending java.lang.Object
« Reply #2 on: April 21, 2005, 03:19:14 pm »
The simplest way to do it would be to set a parent (Ctrl+I) and type the class name as java.lang.Object (Make sure that "Accept classifier even if not in model" is ticked.)

The other alternative is to import these core java classes either from source code or jar files into another part of your model. (Use Import Source Directory for either of these.  Select either .java or .jar in the file extensions.)  Package per Namespace is generally the best way to import.

Of course, be aware that if you import all of java into your model, it is going to be quite big.
So I'd generally recommend just importing what you need.

Simon

dsilveira28

  • EA Novice
  • *
  • Posts: 3
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
Re: extending java.lang.Object
« Reply #3 on: April 22, 2005, 02:35:15 am »
Hi again,

I am not able to import jar files. Altough it is ok with java files?

Any special option i must take attention?

Answering the other reply, I need to extend the java.lang.Object (and other java libraries) in several classes to save me time to defined in each of these classes the related operations/attributes (e.g finalize, getClass, notify...). These operations/attributes will be referenced  in sequence diagrams and other things.

Daniel

Still crying  :'(

dsilveira28

  • EA Novice
  • *
  • Posts: 3
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
Re: extending java.lang.Object
« Reply #4 on: April 22, 2005, 03:17:42 am »
Ops,

I know what is wrong with my import.

I only have version 4.0 :P

I am gonna fix this.

Thanks everybody.

Daniel