Reputation: 169
I have imported org.jsmpp, which has enum class StringParameter. How can I change values of enum, in my class?
StringParameter class:
public enum StringParameter {
SERVICE_TYPE(StringType.C_OCTET_STRING, 0, 6, true, SMPPConstant.STAT_ESME_RINVSERTYP);
private StringType type;
private final int min;
private final int max;
private final boolean rangeMinAndMax;
private final int errCode;
StringParameter(StringType type, int min, int max, boolean rangeMinAndMax, int errCode) {
this.type = type;
this.min = min;
this.max = max;
this.rangeMinAndMax = rangeMinAndMax;
this.errCode = errCode;
}
public int getMax() {
return max;
}
public int getMin() {
return min;
}
public boolean isRangeMinAndMax() {
return rangeMinAndMax;
}
public StringType getType() {
return type;
}
public int getErrCode() {
return errCode;
}
I want to change SERVICE_TYPE max from 6 to 12.
Upvotes: 0
Views: 785
Reputation: 140417
Two cases here:
import StringParameter
somewhere in your code, and you included the corresponding class file(s) in your project setup. Then there is nothing you can do.Otherwise, your hands are tied. Consider enums to be constants, there is no changing of values at runtime.
Note: you also can't extend that existing enum with your own version, as well, there is inheritance for enums. If at all, you would have to create your very own enum here.
Update: of course, when you use some external library, you can theoretically do two things:
Upvotes: 1