PDA

View Full Version : What to use instead of Object?



Vasily.R
7 Jan 2010, 1:29 PM
Hi All.

I need a property in my bean to hold different types... Data, String, or some other bean. As I understood, Object is not allowed.

May you suggest any solution?

Thx!

Feltros
9 Jan 2010, 9:03 AM
Make your own datatype which allows a string/number/bean with an ENUM class to specify of which type it is? Then you can go bean.whatTypeAreYou() and it will reply Types.Bean or Types.String (Types being your enum class).
I'm assuming beans allow your own datatypes so long as you don't have anything too fancy and non-serializable in them? I'm not a bean person myself.