[530] in java-interest

home help back first fref pref prev next nref lref last post

Re: WebObjects

daemon@ATHENA.MIT.EDU (Andrew Wason)
Wed Jun 28 16:45:24 1995

To: java-interest@java.sun.com
In-Reply-To: Message from Ward Harold <0006378709@mcimail.com> 
   of "Wed, 28 Jun 95 12:23:00 -0500."   <22950628172322/0006378709PK2EM@MCIMAIL.COM> 
Date: Wed, 28 Jun 95 15:52:41 -0400
From: Andrew Wason <aw@bae.bellcore.com>

Ward Harold <0006378709@mcimail.com>  writes:
> 
> o test the type of an object at runtime
>   - one can do this in Java via 'instanceof' but Modula-3 has a 'typecode'
>     primitive that is better suited to this application

You could use Object.getClass() as a type code.

> o allocate an object given a code for its type
>   - I assume they are referring to the Modula-3 'typecode'

If you use the Class as a typecode, you can use
Class.newInstance().

> o find the code for the direct supertype given the code for the type
>   - ditto

Class.getSuperclass()

> Under 'garbage collection' they require a "hook for calling a cleanup routine
> when an object is garbage collected (or explicitly freed)".

Could java.lang.Ref be used for this?  I couldn't get this to
work, but there may be a way to use the Ref to detect when the
Ref'd object is being finalized.

If you only need to hook your own classes, you can implement a
dispose() method in them.


Andrew

_______________________________________________________________________________

Andrew Wason                                       Bell Communications Research
aw@bae.bellcore.com                                Piscataway, NJ
-
Note to Sun employees: this is an EXTERNAL mailing list!
Info: send 'help' to java-interest-request@java.sun.com

home help back first fref pref prev next nref lref last post