我喜欢使用enum
s,它增强了代码的可读性和可用性。但是在某些情况下,我想简化“复制的”A 和 B“枚举”构造和函数……这可能吗?
public static enum KEYS {
KEYS() {};
public static enum RSA {
RSA() {};
public static enum A {
ONE (new String[]{...}),
TWO (new String[]{...}),
THREE (new String[]{...});
public final String[] keys;
A(String[] keys) {
this.keys=keys;
}
public int getVersion(){
return keys.length;
}
}
public static enum B {
ONE (new String[]{...}),
TWO (new String[]{...}),
THREE (new String[]{...});
public final String[] keys;
B(String[] keys) {
this.keys=keys;
}
public int getVersion(){
return keys.length;
}
}
}
...
}