Win a copy of Learning OpenStack Networking: Build a solid foundation in virtual networking technologies for OpenStack-based clouds this week in the Cloud/Virtualization forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

HashMap bean with generic type parameters  RSS feed

 
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 ]
 
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.
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!