[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Some small Q's



Hi,

--On Thursday, March 23, 2000 10:37 PM +0100 Jon Finanger 
<Jon.Finanger@q-free.com> wrote:

> After some classpath obstacles i finally managed to create a database
> storing  Person objects. Hurray!

:)

> Some questions did come up on the way:
>
> 1: This is maybe an easy one, and i'm sure i'm overlooking something - of
> course :), but when PersonImpl.class.getName() is called i cant find any
> static class-variable called class. I assume this is a variable of Class
> type....where is it
> located?

class is a reserved word in java.  It is used to either:

 start defining a new class, as in:

  class MyClass { }

 or to get the java.lang.Class instance for a class.  For example:

  'MyClass.class' is a reference to the java.lang.Class instance 
representing MyClass.  I guess you can think of this as a typechecked 
version of java.lang.Class.forName("MyClass").

  MyClass.class.getName() will return the String "MyClass" (with package 
info if it is not in the default package).

This is standard java (1.1 or later I believe) and not Ozone specific in 
any way.

> 2: About unique keys.
> When i create an object on the server using createObject i find three
> different overloaded methods called createObject(...), one of them defines
> the className, access and the name of the object. But when I use the the
> first alternative, which just pass the className of the remoteObject to
> the server, noone asks for a unique key/name. What kind of unique key is
> assigned to that object?
> Is there any automatic generation of unique keys (like autoincrement)? (I
> see its possibly to get all objects of a class using objectsOfClass(..),
> maybe i'll find it there when i get it working :))

I don't believe there is any auto-generation of unique keys.  If you create 
an unnamed object then you must keep a reference to it (technically a 
reference to a proxy for it).  If you don't keep a proxy then you lose all 
means of accessing (or deleteing!) that object.

later,

\x/ill          :-}