46 lines
896 B
Java
46 lines
896 B
Java
package pm.j4.kerosene.util.module.option;
|
|
|
|
import com.google.gson.JsonElement;
|
|
import com.google.gson.JsonPrimitive;
|
|
import pm.j4.kerosene.util.module.ModuleBase;
|
|
|
|
/**
|
|
* The type Boolean value.
|
|
*/
|
|
public class BooleanOption extends ConfigurationOption {
|
|
/**
|
|
* The Value.
|
|
*/
|
|
private boolean value;
|
|
|
|
/**
|
|
* Instantiates a new Configuration option.
|
|
*
|
|
* @param key
|
|
* @param description the description
|
|
*/
|
|
public BooleanOption(String key, String description, ModuleBase parent) {
|
|
super(key, description, parent);
|
|
}
|
|
|
|
public boolean getValue() {
|
|
return value;
|
|
}
|
|
public void setValue(boolean value) { this.value = value; }
|
|
|
|
@Override
|
|
public String getStringValue() {
|
|
return Boolean.toString(value);
|
|
}
|
|
|
|
@Override
|
|
public void fromJson(JsonElement e) {
|
|
this.value = e.getAsBoolean();
|
|
}
|
|
|
|
@Override
|
|
public JsonElement toJson() {
|
|
return new JsonPrimitive(value);
|
|
}
|
|
}
|