SRecords and Maps

[email protected] Tue, 04 Aug 2009 19:47:59 +1000
Newsgroups gmane.comp.java.orm.simpleorm
Message-ID <[email protected]>
Hello Franck,

Your backing set fix is not quite right.  It only backs the entries, not the Set.  So if an !isValid entry is put it will not appear.  I have reworked it to create the set at iterator(), like HashMap.  Horrible code, please review.  Same for EntrySet and Values.

I also have updated containsKey() to not use the entry set by calling isValid directly.  Likwise for size.  

BUT THERE ARE ZERO TEST CASES.  Need test cases as we write the code before we can ship.

Why does get() have parameter Object and put() parameter String?  Because there is a bug in Map that get has a parameter of type Object instead of K.  So either we loosen the definition in SRecordGeneric, or we only allow Strings.  I have taken the latter approach -- cleans up the code, no reason to use Map with SField Instances.  Done this everywhere.

I have also updated README.  Have a look to see if I have missed anything in 3.11.  Please always update this as you go -- difficult to remember afterward.

Thanks,

Anthony


At 09:54 PM 2/08/2009, you wrote:
>  
>
>Fixed
>
>Le dimanche 02 août 2009 à  15:56 +1000, <mailto:anthony%40berglas.org>[email protected] a écrit :
>> 
>> [Attachment(s) from <mailto:anthony%40berglas.org>[email protected] included below] 
>> 
>> 
>> 
>> 
>> >
>> >One issue is that the sets etc. are not properly backed by the
>> getFieldNames(). So after putting an invalid value they do not get
>> updated. (They never get updated otherwise, so no problem.) Invalid
>> values are also rare, and I'm not sure whether they are worth the
>> effort. 
>> 
>> One more thought, what happens if someone does a get("xxx") where xxx
>> is not a field in an SRecord, or is a field but is not valid? Probably
>> should throw an exception in first case and return null in second.
>> Currently would throw null pointer, not good.
>> 
>> Anthony
>> 
>> Dr Anthony Berglas, <mailto:anthony%40berglas.org>[email protected] Mobile: +61 4 4838 8874
>> Just because it is possible to push twigs along the ground with ones
>> nose
>> does not necessarily mean that is the best way to collect firewood.
>> 
>> 
>> 
>> 
>
>


Spreadsheet Detective,
Southern Cross Software Queensland Pty Limited
54 Gerler Street
Bardon, Queensland 4065, Australia.

Email: [email protected]
www.SpreadsheetDetective.com
Ph: +61 427 830248 (Australian Eastern Standard Time)

"If the model seems correct only because the numbers look right, 
then why build the model in the first place?"


------------------------------------

Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/SimpleORM/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/SimpleORM/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:[email protected] 
    mailto:[email protected]

<*> To unsubscribe from this group, send an email to:
    [email protected]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
11323108.jpg (image/jpeg, 3.3 KB) - not displayed