1 package net.pterodactylus.sone.utils;
4 * Contains current and default value of an option.
7 * The type of the option
9 public interface Option<T> {
12 * Returns the current value of the option. If the current value is not
13 * set (usually {@code null}), the default value is returned.
15 * @return The current value of the option
20 * Returns the real value of the option. This will also return an unset
21 * value (usually {@code null})!
23 * @return The real value of the option
28 * Validates the given value. Note that {@code null} is always a valid
32 * The value to validate
33 * @return {@code true} if this option does not have a validator, or the
34 * validator validates this object, {@code false} otherwise
36 public boolean validate(T value);
39 * Sets the current value of the option.
42 * The new value of the option
43 * @throws IllegalArgumentException
44 * if the value is not valid for this option
46 public void set(T value) throws IllegalArgumentException;