Menu

#73 Use collection generic type to create nested beans

open
nobody
5
2008-08-15
2008-08-15
Paul Cowan
No

The current implementation seems to be lacking in terms of support for generics. By examining the collection's generic type, you can determine the type of objects it contains. This makes setting the explicit attribute classtype in the classmap unnecessary.

I've attached a zip containing a patch to JSONObject.java to do this for Lists and Maps. It also contains 2 JUnit tests to demonstrate the problem and fix.

Discussion

  • Paul Cowan

    Paul Cowan - 2008-08-15

    Fix to

     
  • aalmiray

    aalmiray - 2008-08-19

    Logged In: YES
    user_id=1192026
    Originator: NO

    Thanks Paul, we'll review the patch.
    The reason why generics are not yet supported is that all previously submitted patches (3 so far) only cover the basic behavior, i.e, one dimensional generics, List<T> and Map<K,V> rather than Map<String,List<List<T>>>

    - Andres

     

Log in to post a comment.