Class RangedProperty<T extends Number>
java.lang.Object
net.darkhax.pricklemc.common.api.config.property.ObjectProperty<T>
net.darkhax.pricklemc.common.api.config.property.RangedProperty<T>
- Type Parameters:
T- The type of number.
- All Implemented Interfaces:
IConfigProperty<T>
Represents a number property that can only fall within the specified range.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final IPropertyAdapter<?> The adapter for ranged number properties.Fields inherited from class net.darkhax.pricklemc.common.api.config.property.ObjectProperty
FALLBACK_ADAPTER -
Method Summary
Modifier and TypeMethodDescriptionmax()booleanValidates if a value is valid for the property.voidwriteAdditionalComments(com.google.gson.stream.JsonWriter writer, PropertyResolver resolver, org.slf4j.Logger logger) Writes additional decorators to the JSON writer.Methods inherited from class net.darkhax.pricklemc.common.api.config.property.ObjectProperty
comment, defaultValue, read, readValue, value, write, writeDefaultValue, writeDefaultValue, writeValue
-
Field Details
-
ADAPTER
The adapter for ranged number properties.
-
-
Method Details
-
max
-
writeAdditionalComments
public void writeAdditionalComments(com.google.gson.stream.JsonWriter writer, PropertyResolver resolver, org.slf4j.Logger logger) throws IOException Description copied from class:ObjectPropertyWrites additional decorators to the JSON writer.- Overrides:
writeAdditionalCommentsin classObjectProperty<T extends Number>- Parameters:
writer- A writer to write JSON data to.resolver- Resolves properties with GSON or config properties.logger- A log instance used to log warnings and errors encountered when saving the value.- Throws:
IOException- A fatal exception may be thrown if the decorators could not be written.
-
validate
Description copied from interface:IConfigPropertyValidates if a value is valid for the property.- Specified by:
validatein interfaceIConfigProperty<T extends Number>- Overrides:
validatein classObjectProperty<T extends Number>- Parameters:
value- The value to validate.- Returns:
- If the value is true or not. Invalid properties will not be applied when reading the value from JSON.
- Throws:
IllegalArgumentException- Generally a fatal exception should be raised when the value is invalid.
-