From f5773a8f51b4babcba7cb7f7c480a75e1be90804 Mon Sep 17 00:00:00 2001 From: Almighty-Satan <43804777+Almighty-Satan@users.noreply.github.com> Date: Thu, 26 Oct 2023 14:14:45 +0200 Subject: [PATCH] WritableConfigEntry#getValueToWrite can throw a ValidationException --- .../jaskl/impl/WritableConfigEntry.java | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/core/src/main/java/io/github/almightysatan/jaskl/impl/WritableConfigEntry.java b/core/src/main/java/io/github/almightysatan/jaskl/impl/WritableConfigEntry.java index 4d9b0f6..d9d597a 100644 --- a/core/src/main/java/io/github/almightysatan/jaskl/impl/WritableConfigEntry.java +++ b/core/src/main/java/io/github/almightysatan/jaskl/impl/WritableConfigEntry.java @@ -37,17 +37,23 @@ public interface WritableConfigEntry extends ConfigEntry { * * @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()); }