• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

HashMap bean with generic type parameters

 
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I would like to use a HashMap bean with generic type parameters. In a normal java program, this would be simple:



However, when declaring it as a bean, the following code gives me an error:



The error is:


Anyone know if it is even possible to declare such a bean with generic type parameters? I am asking because when I put keys and values into the HashMap, it is giving me unchecked errors such as:



Thanks
[ December 08, 2004: Message edited by: Tobie Henderson ]
 
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
For a Class to be a valid JavaBean, it must have a public no arg constructor and appropriate getter and setter methods.
HashMap does have a no arg constructor, but does not have the appropriate getter and setters.
Why not create a new Class that is your JavaBean, and make it so that it has a HashMap along with the appropriate getter and setter methods?
 
Bart Allen
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Also...
In order to use standard actions, the property needs to be either a String or a primitive. If it is not, you will need to use scripting.
 
reply
    Bookmark Topic Watch Topic
  • New Topic