Class RegexStringProperty
java.lang.Object
net.darkhax.pricklemc.common.api.config.property.ObjectProperty<String>
net.darkhax.pricklemc.common.api.config.property.RegexStringProperty
- All Implemented Interfaces:
IConfigProperty<String>
A property that holds a string that is validated using Regex.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic IPropertyAdapter<RegexStringProperty> A property adapter for regex validated strings.Fields inherited from class net.darkhax.pricklemc.common.api.config.property.ObjectProperty
FALLBACK_ADAPTER -
Method Summary
Modifier and TypeMethodDescriptionbooleanValidates if a value is valid for the property.voidwriteAdditionalComments(com.google.gson.stream.JsonWriter writer, PropertyResolver resolver, org.slf4j.Logger log) 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
A property adapter for regex validated strings.
-
-
Method Details
-
writeAdditionalComments
public void writeAdditionalComments(com.google.gson.stream.JsonWriter writer, PropertyResolver resolver, org.slf4j.Logger log) throws IOException Description copied from class:ObjectPropertyWrites additional decorators to the JSON writer.- Overrides:
writeAdditionalCommentsin classObjectProperty<String>- Parameters:
writer- A writer to write JSON data to.resolver- Resolves properties with GSON or config properties.log- 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<String>- Overrides:
validatein classObjectProperty<String>- 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.
-