1 package net.pterodactylus.sone.utils;
4 * Contains current and default value of an option.
7 * The type of the option
8 * @author <a href="mailto:bombe@pterodactylus.net">David ‘Bombe’ Roden</a>
10 public interface Option<T> {
13 * Returns the current value of the option. If the current value is not
14 * set (usually {@code null}), the default value is returned.
16 * @return The current value of the option
21 * Returns the real value of the option. This will also return an unset
22 * value (usually {@code null})!
24 * @return The real value of the option
29 * Validates the given value. Note that {@code null} is always a valid
33 * The value to validate
34 * @return {@code true} if this option does not have a validator, or the
35 * validator validates this object, {@code false} otherwise
37 public boolean validate(T value);
40 * Sets the current value of the option.
43 * The new value of the option
44 * @throws IllegalArgumentException
45 * if the value is not valid for this option
47 public void set(T value) throws IllegalArgumentException;