Class ConfigValidationResult
java.lang.Object
io.github.ttno1.configvalidation.ConfigValidationResult
Represents the result of a config validation operation.
Specifies whether it passed or failed and a fail message if it failed.
Specifies whether it passed or failed and a fail message if it failed.
-
Method Summary
Modifier and TypeMethodDescriptionhandle
(Consumer<ConfigValidationResult> consumer) Convenience method that runs the provided consumer withthis
as the argument.
Allows for easy handling of this ConfigValidationResult through method chaining.<E extends Throwable>
ConfigValidationResulthandleChecked
(CheckedConsumer<ConfigValidationResult, E> consumer) Convenience method that runs the provided checked consumer withthis
as the argument.
Allows for easy handling of this ConfigValidationResult through method chaining.boolean
passed()
-
Method Details
-
passed
public boolean passed()- Returns:
- whether this validation passed
-
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 withthis
as the argument.
Allows for easy handling of this ConfigValidationResult through method chaining.- Parameters:
consumer
- the consumer to run onthis
- Returns:
this
-
handleChecked
public <E extends Throwable> ConfigValidationResult handleChecked(CheckedConsumer<ConfigValidationResult, E> consumer) throws E Convenience method that runs the provided checked consumer withthis
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 onthis
- Returns:
this
- Throws:
E
- if the checked consumer throws E
-