kerosene/remappedSrc/pm/j4/petroleum/util/module/option/IntegerOption.java

39 lines
670 B
Java
Raw Permalink Normal View History

2020-12-20 04:19:55 +00:00
package pm.j4.kerosene.util.module.option;
2020-12-19 23:30:50 +00:00
import com.google.gson.JsonElement;
import com.google.gson.JsonPrimitive;
/**
* The type Integer value.
*/
public class IntegerOption extends ConfigurationOption {
/**
* The Value.
*/
private int value;
/**
* Instantiates a new Integer option.
*
* @param description the description
*/
protected IntegerOption(String description) {
super(description);
}
@Override
public String getStringValue() {
return Integer.toString(value);
}
@Override
public void fromJson(JsonElement e) {
this.value = e.getAsInt();
}
@Override
public JsonElement toJson() {
return new JsonPrimitive(value);
}
}