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>

public class RegexStringProperty extends ObjectProperty<String>
A property that holds a string that is validated using Regex.
  • Field Details

  • Method Details

    • writeAdditionalComments

      public void writeAdditionalComments(com.google.gson.stream.JsonWriter writer, PropertyResolver resolver, org.slf4j.Logger log) throws IOException
      Description copied from class: ObjectProperty
      Writes additional decorators to the JSON writer.
      Overrides:
      writeAdditionalComments in class ObjectProperty<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

      public boolean validate(String value) throws IllegalArgumentException
      Description copied from interface: IConfigProperty
      Validates if a value is valid for the property.
      Specified by:
      validate in interface IConfigProperty<String>
      Overrides:
      validate in class ObjectProperty<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.