db-jdo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Craig Russell <Craig.Russ...@Sun.COM>
Subject Re: SingleFieldIdentity.toString()
Date Thu, 31 Mar 2005 01:25:22 GMT
Hi Patrick,

On Mar 30, 2005, at 4:28 PM, Patrick Linskey wrote:

> Well, we already have:
>
> public ByteIdentity(Class target, String s) {
>         this (pcClass, Byte.parseByte(justTheId(str)));
> }

This was not the question. Matthew asked about:

public ByteIdentity(String s)

which doesn't make sense because you would construct an instance of a 
JDO identity class that didn't know what kind of object it was the key 
for. If all you want is a wrapper around a byte, use java.lang.Byte. 
The key piece of the ByteIdentity is that an instance unambiguously 
represents the identity of a particular instance in the datastore (and 
cache).

Craig
>
> where clearly, justTheId() can go away now.
>
> -Patrick
>
> On Mar 30, 2005, at 7:22 PM, Matthew T. Adams wrote:
>
>> If we get rid of the targetClassName in the toString() return value,
>> does that make it easier to provide overloaded String-arg constructors
>> on the SingleFieldIdentity subclasses (except StringIdentity of 
>> course,
>> which already has a String-arg constructor)?  For example,
>>
>> // in class ByteIdentity
>> public ByteIdentity(String s) {
>>     this(Byte.parseByte(s));
>> }
>>
>> ...
>>
>> This might be convenient, letting Xxx.parseXxx(String) throw whatever 
>> it
>> may.
>>
>> Thoughts?
>>
>> --matthew
>>
>>> -----Original Message-----
>>> From: Matthew T. Adams [mailto:matthew.adams@xcalia.com]
>>> Sent: Wednesday, March 30, 2005 4:17 PM
>>> To: jdo-experts-ext@sun.com; jdo-dev@db.apache.org
>>> Subject: Re: SingleFieldIdentity.toString()
>>>
>>>
>>> I agree as well.  I thought it was there for some reason that I 
>>> didn't
>>> remember or couldn't figure out.
>>>
>>> --matthew
>>>
>>> "Wes Biggs" <wes@tralfamadore.com> wrote in message
>>> news:<mailman.4645.1112226133.10966.jdo-general@jdo-experts.org>...
>>>> Abe White wrote:
>>>>
>>>>>
>>>>>> I thought it would be nice for debugging to see the target class
>>> name
>>>>>> in the toString.
>>>>>
>>>>>
>>>>> I'm against this.  It makes ids in URLs longer, makes parsing
>>> harder,
>>>>> and is unnecessary in general, IMO.  It also leads to possible
>>>>> inconsistencies with the class encoded in the string and the class
>>>>> given to the String constructor.
>>>>
>>>> I'm with Abe.
>>>>
>>>> Wes
>>>
>>>
>>>
>>
>>
>
> -- 
> Patrick Linskey
> SolarMetric Inc.
>
>
Craig Russell
Architect, Sun Java Enterprise System http://java.sun.com/products/jdo
408 276-5638 mailto:Craig.Russell@sun.com
P.S. A good JDO? O, Gasp!

Mime
View raw message