Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

HashMap bean with generic type parameters

 
Tobie Henderson
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • 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 ]
 
Bart Allen
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • 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
  • 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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic