• Post Reply Bookmark Topic Watch Topic
  • New Topic

beans question(wondering)  RSS feed

 
Srivani Nallan
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I need to create a bean where in an input file is sent to the bean and return a string back from the bean. I am new to Java beans as such. Can this be done? I am totally confused.
Any help would be greatly appreciated.
Thanks a bunch in advance.
 
Billybob Marshall
Ranch Hand
Posts: 202
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It just means you have to create a class which complies with the JavaBean specification (has a public no-arg constructor and may have getter and setter methods named getXXX and setXXX for each 'property' the bean represents). And one of the methods of that bean takes an InputStream argument and returns a String.
So...
 
Srivani Nallan
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Marshall for your reply.
I still have to make the bean serializable right?
 
Billybob Marshall
Ranch Hand
Posts: 202
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Srivani Nallan:
Thanks Marshall for your reply.
I still have to make the bean serializable right?

Depends on the needs of your app. If you'll never serialize/deserialize instances of the bean class, then "No". Nothing says JavaBeans have to be serializeable.
 
Srivani Nallan
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When does one serialize/deserialize a java bean? I am planning on using my bean to create a com object and call it from VB or asp. I am not too sure if I would be serializing or deserializing here. Can you help me on this?
thanks
 
Billybob Marshall
Ranch Hand
Posts: 202
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Srivani Nallan:
I am planning on using my bean to create a com object and call it from VB or asp. I am not too sure if I would be serializing or deserializing here. Can you help me on this?
thanks

Without really knowing the more intricate details of your app, I wouldn't know if it needs to be serializeable or not. I'd say don't make it serializeable, and then try things out. If that ends up giving you "not serializeable" types of exceptions, then you'll know that you need to.
There are all kinds of ways objects get serialized, either explicitly (by your code) or implicitly (such as if your bean will be wrapped by a web service or otherwise invoked remotely).
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!