给定以下代码:
public interface DTMFKeys {
public String getKeyStr();
public static enum Sign implements TahoeDTMFKeys {
SIGN_1("*1"), SIGN_2("*2"), SING_3("*3"), SIGN_4("*4"), SIGN_5("*5"), SIGN_6(
"*6"), SIGN_7("*7"), SIGN_8("*8"), SIGN_9("*9");
private String keyStr;
private Sign(String keyStr) {
this.keyStr = keyStr;
}
@Override
public String getKeyStr() {
return keyStr;
}
}
public static enum Pound implements TahoeDTMFKeys {
POUND_1("1#"), POUND_2("2#"), POUND_3("3#"), POUND_4("4#"), POUND_5(
"5#"), POUND_6("6#"), POUND_7("7#"), POUND_8("8#"), POUND_9(
"9#");
private String keyStr;
private Pound(String keyStr) {
this.keyStr = keyStr;
}
@Override
public String getKeyStr() {
return keyStr;
}
}
}
如何删除重复的代码:
private Sign(String keyStr){
this.keyStr=keyStr;
}
@Override
public String getKeyStr() {
return keyStr;
}