I would like to limit enum literal of particular type in parameter.
For example,
enum SomeEnum { A, B, C}
class SomeClass {
public void doSomething(SomeEnum someEnum) { <--- Here I want to only accept A and C.
}
}
so as caller is typing the code,
SomeClass someclass = new SomeClass();
someclass.doSomething(); <------- java assist would say only A and C goes in here
将一个枚举值集添加到某个类的硬编码或构造函数中。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.