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

Re: nameForObject()?



Thanks.  I learned something today.:)

Falko Braeutigam wrote:

> On Mon, 29 Jan 2001, Tim Brown wrote:
> > FYI:  I use the name which I call the DBName for quicker object equality comparisons.
> >
> > ....
> > ppublic Boolean equals(DBObject obj) {
> >     return new Boolean(obj.getDBName().equals(DBName));
> > }
>
> Hmmm... but each equals call generates one other RMI call in your approach. If
> you implement equality via identity, which your code does, then it is better to
> rely on the default proxy implementation of equals(), which directly compares
> the object IDs. This does not need another RMI call.
>
> Falko
>
> >
> > Falko Braeutigam wrote:
> >
> > > On Mon, 29 Jan 2001, Tim Brown wrote:
> > > > I store the name in all of my ozone objects but I would be interested to
> > > > know if there is a way to get from the ozone object itslf.
> > >
> > > No "official" way yet. But you may get the name of the object from inside the
> > > object via "container().name()".
> > >
> > > Falko
> > >
> > > >
> > > > Andreas Monitzer wrote:
> > > >
> > > > > hi
> > > > >
> > > > > I need the opposite of org.ozoneDB.ExternalDatabase.objectForName(), is there something available? I could just store the string inside the database object, but that wouldn't be very efficient.
> > > > >
> > > > > Background story:
> > > > >
> > > > > I got one database object which points to another database object.
> > > > > One object stores the proxy of the other by using the following:
> > > > >
> > > > > class FirstObjectImpl extends OzoneRemote implements FirstObject {
> > > > >         private transient SecondObject obj=null;
> > > > >         private String objId;
> > > > >
> > > > >         public FirstObjectImpl(SecondObject in_obj) {
> > > > >                 obj=in_obj;
> > > > >                 objId=in_obj.getId(); // how?
> > > > >         }
> > > > >
> > > > >         public getSecondObject() {
> > > > >                 if(obj==null)
> > > > >                         obj=db.objectForName(objId); // db is static
> > > > >                 return obj;
> > > > >         }
> > > > > }
> > > > >
> > > > > Or maybe somebody has a better idea?
> > > > >
> > > > > andy
> > > > >
> > > > > --
> > > > > Description forthcoming.
> > > --
> > > ______________________________________________________________________
> > > Falko Braeutigam                              mailto:falko@smb-tec.com
> > > SMB GmbH                                        http://www.smb-tec.com
> --
> ______________________________________________________________________
> Falko Braeutigam                              mailto:falko@smb-tec.com
> SMB GmbH                                        http://www.smb-tec.com