Class MaterialParser
- java.lang.Object
-
- com.github.siroshun09.mccommand.paper.parser.MaterialParser
-
- All Implemented Interfaces:
ArgumentParser<Material>
public class MaterialParser extends Object implements ArgumentParser<Material>
-
-
Constructor Summary
Constructors Constructor Description MaterialParser()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description @Nullable Material
parse(@NotNull Argument argument)
Parses anArgument
to a specified type and returns it.@NotNull Material
parseOrThrow(@NotNull Argument argument)
Parses anArgument
to a specified type and returns it.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.github.siroshun09.mccommand.common.argument.parser.ArgumentParser
generateException, generateException, parseOptional, parseOrDefault
-
-
-
-
Constructor Detail
-
MaterialParser
public MaterialParser()
-
-
Method Detail
-
parse
@Nullable public @Nullable Material parse(@NotNull @NotNull Argument argument)
Parses anArgument
to a specified type and returns it.- Specified by:
parse
in interfaceArgumentParser<Material>
- Parameters:
argument
- the argument to be parsed- Returns:
- the value to be parsed, or
null
if the parsing fails
-
parseOrThrow
@NotNull public @NotNull Material parseOrThrow(@NotNull @NotNull Argument argument) throws IllegalArgumentException
Parses anArgument
to 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.- Specified by:
parseOrThrow
in interfaceArgumentParser<Material>
- Parameters:
argument
- the argument to be parsed- Returns:
- the value to be parsed, or
null
if the parsing fails - Throws:
IllegalArgumentException
- if the parsing fails
-
-