It also appears to me that the setValue methods should be private - IMHO you should not be altering the value of a key once created - it should only be alterable via ctor. (and in fact really arent in ComboKey - there are LOTS of possible failures (more key elements, etc).
I would actually recommend this change for all of the Key types. Keys should be immutable. Let me know what you think and I will incorporate it into my patch. Russell On Wed, 2002-09-11 at 19:53, Stephen Haberman wrote: > Sounds good, Russell. When you're ready, submit your patch and we'll > take a look. > > - Stephen > > > -----Original Message----- > > From: Russell Smyth [mailto:[EMAIL PROTECTED]] > > Sent: Wednesday, September 11, 2002 6:36 PM > > To: Turbine Torque Developers List (E-mail) > > Subject: ComboKey > > > > I am working with some code that must take the PK from an object (as a > > ComboKey), flatten it to a string, then reconstitute the key and > re-retrieve > > the object. > > I had thought we could do something like this: > > > > String keyVal = comboKey.toString(); > > > > // do stuff > > > > ComboKey newKey = new ComboKey(keyVal); > > > > > > however this does not work for several reasons: > > a) the ComboKey(String) ctor contains an endless loop which will > eventually > > run out of memory (test case written, submit after I know all the > changes to > > make!) > > b) the ComboKey(String) and ComboKey(String[]) ctors will always throw > > TorqueExceptions due to trying to call setValue(String) or > > setValue(String[]) with the key member un-initialized, which > > currently is not allowed. > > > > I would like to modify ComboKey for the following: > > > > toString will code each key portion with the key type > > > > correct the endless loop in ComboKey(String) > > ComboKey(String) will decode the portions into the correct key types, > and > > load the keys from this, no exception > > > > I would also like to remove the exception from ComboKey(String[]), but > I am > > not quite sure the reason for this method.. > > > > If this all sounds reasonable, please let me know and I will submit > changes, > > with test code. > > > > -- > > To unsubscribe, e-mail: <mailto:turbine-torque-dev- > > [EMAIL PROTECTED]> > > For additional commands, e-mail: <mailto:turbine-torque-dev- > > [EMAIL PROTECTED]> > > > -- > To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> > For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> > -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
