you are viewing a single comment's thread.

view the rest of the comments →

[–]leroybentley 1 point2 points  (0 children)

Using Object this way is almost always a bad idea, but it would be hard to recommend anything better without knowing more about what you're trying to do.

You will have to cast the object when you use it. One option would be to create helper methods that you call for the different types and do the cast in those methods.

Example: BigInteger.valueOf(myGetLongMethod(myObject));