Mr.Brownstone
Mr.Brownstone

Reputation: 724

What is the Java equivalent of .NET TypeCode?

please could you tell me what the equivalent of the .NET System.TypeCode enum is in Java and how to obtain it? I can find nothing on the Class class in the docs that appears to be the same. I also had a look at CORBA.TypeCode but it is not what I am after. Thank you.

Upvotes: 3

Views: 232

Answers (2)

Steve Atkinson
Steve Atkinson

Reputation: 1239

The closest thing in java would be the instanceof keyword but that won't work for primitive types unless they are autoboxed into their equivalent Object types. That's OK though as the compiler is always aware of the types of primitives and will warn if you try to do an operation that would lose precision (e.g. assigning an int to a short - so Java doesn't really need this enumeration.

Upvotes: 1

Stephen C
Stephen C

Reputation: 719239

There is no direct equivalent in the standard Java libraries. Sorry.

(And you are right: CORBA.TypeCode is NOT equivalent. It describes CORBA IDL types not Java types ... and it gives a more-or-less complete type description, not an enum of the different kinds of type.)

Upvotes: 2

Related Questions