Skip to content

Commit

Permalink
WritableConfigEntry#getValueToWrite can throw a ValidationException
Browse files Browse the repository at this point in the history
  • Loading branch information
Almighty-Satan committed Oct 26, 2023
1 parent 4c919d5 commit f5773a8
Showing 1 changed file with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,23 @@ public interface WritableConfigEntry<T> extends ConfigEntry<T> {
*
* @param keyPreprocessor a {@link Function} that will be invoked on all map keys
* @return a value that can be written to a config
* @throws InvalidTypeException if the type of this ConfigEntry's value is incorrect. This shouldn't happen under normal circumstances.
* @throws InvalidTypeException if the type of this ConfigEntry's value is incorrect. This shouldn't happen under
* normal circumstances.
* @throws ValidationException if the value fails validation. This could for example happen when using an
* {@link io.github.almightysatan.jaskl.annotation.AnnotationManager}.
*/
@NotNull Object getValueToWrite(@NotNull Function<@NotNull Object, @NotNull Object> keyPreprocessor) throws InvalidTypeException;
@NotNull Object getValueToWrite(@NotNull Function<@NotNull Object, @NotNull Object> keyPreprocessor) throws InvalidTypeException, ValidationException;

/**
* Returns the value that should be written to a persistent config. This also sets modified to false.
*
* @return a value that can be written to a config
* @throws InvalidTypeException if the type of this ConfigEntry's value is incorrect. This shouldn't happen under normal circumstances.
* @throws InvalidTypeException if the type of this ConfigEntry's value is incorrect. This shouldn't happen under
* normal circumstances.
* @throws ValidationException if the value fails validation. This could for example happen when using an
* {@link io.github.almightysatan.jaskl.annotation.AnnotationManager}.
*/
default @NotNull Object getValueToWrite() throws InvalidTypeException {
default @NotNull Object getValueToWrite() throws InvalidTypeException, ValidationException {
return this.getValueToWrite(Function.identity());
}

Expand Down

0 comments on commit f5773a8

Please sign in to comment.