Interface ArgumentParser<T>
- 
- Type Parameters:
- T- the value type
 - All Known Implementing Classes:
- MaterialParser,- MaterialParser,- OfflinePlayerParser,- OfflinePlayerParser,- PlayerExactParser,- PlayerExactParser,- PlayerParser,- PlayerParser,- ProxiedPlayerParser,- SoundParser,- SoundParser,- UUIDParser
 - Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
 
 @FunctionalInterface public interface ArgumentParser<T> Parses an argument from a String
- 
- 
Method SummaryAll Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default IllegalArgumentExceptiongenerateException(@NotNull Argument argument)Generates an exception that throws when the parsing fails.default IllegalArgumentExceptiongenerateException(@NotNull Argument argument, @Nullable Throwable exception)Generates an exception that throws when the parsing fails.static <R> ArgumentParser<R>of(@NotNull Function<Argument,R> function)Creates an instance of the parser fromFunction.Tparse(@NotNull Argument argument)Parses anArgumentto a specified type and returns it.default Optional<T>parseOptional(@NotNull Argument argument)Parses anArgumentto a specified type and returns it.default TparseOrDefault(@NotNull Argument argument, T def)Parses anArgumentto a specified type and returns it.default TparseOrThrow(@NotNull Argument argument)Parses anArgumentto a specified type and returns it.
 
- 
- 
- 
Method Detail- 
ofstatic <R> ArgumentParser<R> of(@NotNull @NotNull Function<Argument,R> function) Creates an instance of the parser fromFunction.- Type Parameters:
- R- the value type
- Parameters:
- function- the- Functionto parse- Argumentto a specific type.
- Returns:
- the ArgumentParserinstance
 
 - 
parse@Nullable T parse(@NotNull @NotNull Argument argument) Parses anArgumentto a specified type and returns it.- Parameters:
- argument- the argument to be parsed
- Returns:
- the value to be parsed, or nullif the parsing fails
 
 - 
parseOptionaldefault Optional<T> parseOptional(@NotNull @NotNull Argument argument) Parses anArgumentto a specified type and returns it.- Parameters:
- argument- the argument to be parsed
- Returns:
- the Optionalvalue
 
 - 
parseOrDefault@NotNull default T parseOrDefault(@NotNull @NotNull Argument argument, @NotNull T def) Parses anArgumentto 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
 
 - 
parseOrThrow@NotNull default T parseOrThrow(@NotNull @NotNull Argument argument) throws IllegalArgumentException Parses anArgumentto a specified type and returns it.Depending on the implementation, it is possible to use Throwable.getCause()to get the exception that caused the conversion to fail.- Parameters:
- argument- the argument to be parsed
- Returns:
- the value to be parsed, or nullif the parsing fails
- Throws:
- IllegalArgumentException- if the parsing fails
 
 - 
generateExceptiondefault 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
 
 - 
generateExceptiondefault 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
 
 
- 
 
-