Class ConfigValidationResult

java.lang.Object
io.github.ttno1.configvalidation.ConfigValidationResult

public class ConfigValidationResult extends Object
Represents the result of a config validation operation.
Specifies whether it passed or failed and a fail message if it failed.
  • Method Details

    • passed

      public boolean passed()
      Returns:
      whether this validation passed
    • getFailMessage

      public String getFailMessage()
      Returns:
      A message providing detail as to why this validation failed if it failed
      Throws:
      IllegalStateException - if this validation passed
    • handle

      Convenience method that runs the provided consumer with this as the argument.
      Allows for easy handling of this ConfigValidationResult through method chaining.
      Parameters:
      consumer - the consumer to run on this
      Returns:
      this
    • handleChecked

      public <E extends Throwable> ConfigValidationResult handleChecked(CheckedConsumer<ConfigValidationResult, E> consumer) throws E
      Convenience method that runs the provided checked consumer with this as the argument.
      Allows for easy handling of this ConfigValidationResult through method chaining.
      Type Parameters:
      E - the exception type that is thrown by the checked consumer
      Parameters:
      consumer - the consumer to run on this
      Returns:
      this
      Throws:
      E - if the checked consumer throws E