Interface ArgumentParser<T>

    • Method Detail

      • parse

        @Nullable
        T parse​(@NotNull
                @NotNull Argument argument)
        Parses an Argument to a specified type and returns it.
        Parameters:
        argument - the argument to be parsed
        Returns:
        the value to be parsed, or null if the parsing fails
      • parseOrDefault

        @NotNull
        default T parseOrDefault​(@NotNull
                                 @NotNull Argument argument,
                                 @NotNull
                                 T def)
        Parses an Argument to a specified type and returns it.
        Parameters:
        argument - the argument to be parsed
        def - the default value to be returned if the parsing fails
        Returns:
        the value to be parsed, or default value if the parsing fails
      • generateException

        default IllegalArgumentException generateException​(@NotNull
                                                           @NotNull Argument argument)
        Generates an exception that throws when the parsing fails.
        Parameters:
        argument - the argument that failed to be parsed
        Returns:
        the generated exception
      • generateException

        default IllegalArgumentException generateException​(@NotNull
                                                           @NotNull Argument argument,
                                                           @Nullable
                                                           @Nullable Throwable exception)
        Generates an exception that throws when the parsing fails.
        Parameters:
        argument - the argument that failed to be parsed
        exception - the exception that caused the parsing to fail
        Returns:
        the generated exception