阅读背景:

如何在java中使用带开关的类类型?

来源:互联网 

I have the following code:

我有以下代码:

Variable var;
//var is initialized to an unknown class type, stored as a public variable named type.
//var = new Variable<Integer>(Integer.class, <some integer value>);
//var.type is equal to Integer.class

switch (var.type)
{
case Integer.class:
    //do some class specific stuff 
    break;
case Float.class:
    //do some class specific stuff
    break;
etc...
}
Variable



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: