java.lang.Object
dev.sympho.modular_commands.utils.parse.EntityUrlParser<C>
dev.sympho.modular_commands.utils.parse.ChannelUrlParser<C>
- Type Parameters:
C- The channel type.
- All Implemented Interfaces:
ParserFunction<String,,C> UrlParser<C>,BiFunction<CommandContext,String, Mono<C>>
A parser for channel URLs.
- Since:
- 1.0
- Version:
- 1.0
-
Nested Class Summary
Nested classes/interfaces inherited from interface dev.sympho.modular_commands.utils.parse.UrlParser
UrlParser.Choice<T extends @NonNull Object>, UrlParser.ChoiceBase<T extends @NonNull Object,P extends UrlParser<T>>, UrlParser.PostParser<I extends @NonNull Object, T extends @NonNull Object, P1 extends @NonNull UrlParser<I>, P2 extends @NonNull ParserFunction<I, T>> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionparsePath(GatewayDiscordClient client, String path) Parses the URL path.typeName()Gets the display name for this type.Validates that a channel is of the given type.protected booleanChecks if the given path (endpoint) is valid for the entity type of this parser.Methods inherited from class dev.sympho.modular_commands.utils.parse.EntityUrlParser
parse, supportsMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.util.function.BiFunction
andThenMethods inherited from interface dev.sympho.modular_commands.api.command.parameter.parse.ParserFunction
apply
-
Constructor Details
-
ChannelUrlParser
Creates a new instance.- Parameters:
type- The type of channel.
-
-
Method Details
-
validate
@Pure public static <C extends @NonNull Channel> C validate(Channel channel, Class<C> type) throws InvalidArgumentException Validates that a channel is of the given type.- Type Parameters:
C- The channel type.- Parameters:
channel- The channel.type- The channel type.- Returns:
- The channel.
- Throws:
InvalidArgumentException- if the channel does not match the given type.
-
typeName
Description copied from class:EntityUrlParserGets the display name for this type.- Specified by:
typeNamein classEntityUrlParser<C extends @NonNull Channel>- Returns:
- The name.
-
validPath
Description copied from class:EntityUrlParserChecks if the given path (endpoint) is valid for the entity type of this parser.- Specified by:
validPathin classEntityUrlParser<C extends @NonNull Channel>- Parameters:
path- The path.- Returns:
- If the path is valid for this parser.
-
parsePath
Description copied from class:EntityUrlParserParses the URL path.- Specified by:
parsePathin classEntityUrlParser<C extends @NonNull Channel>- Parameters:
client- The Discord client.path- The path.- Returns:
- The parsed entity, or
nullif the path is not valid.
-