public interface ResolverService
It is recommended to use plugin based namespace in your custom targets,
eg. "/flyplugin/flying" to avoid collisions with other plugins.
You can also use getResolver(String)
to check if target already has a resolver.
Modifier and Type | Interface and Description |
---|---|
static class |
ResolverService.Holder |
Modifier and Type | Method and Description |
---|---|
static ResolverService |
getInstance() |
java.util.Optional<Resolver> |
getResolver(java.lang.String target)
Obtain a
Resolver for a target. |
void |
registerResolver(java.lang.String pluginName,
java.lang.String start,
Resolver resolver)
Register a new resolver.
|
void |
registerResolverForMatches(java.lang.String pluginName,
java.util.regex.Pattern pattern,
Resolver resolver)
Register a new resolver with regex that maches start of target.
|
static ResolverService getInstance()
void registerResolver(java.lang.String pluginName, java.lang.String start, Resolver resolver)
pluginName
- Name of the plugin that is registering (For error messages)start
- Start of the target to match against, eg "/example" will send "/example/target" etc to the Resolver.resolver
- Resolver
to use for thisjava.lang.IllegalArgumentException
- If pluginName is null or empty.void registerResolverForMatches(java.lang.String pluginName, java.util.regex.Pattern pattern, Resolver resolver)
NOTICE: It is recommended to avoid too generic regex like "/.*" to not override existing resolvers.
Parameters (?param=value) are not included in the regex matching.
pluginName
- Name of the plugin that is registering (For error messages)pattern
- Regex Pattern, "/example.*" will send "/exampletarget" etc to the Resolver.resolver
- Resolver
to use for this.java.lang.IllegalArgumentException
- If pluginName is null or empty.java.util.Optional<Resolver> getResolver(java.lang.String target)
Resolver
for a target.
First matching resolver will be returned.
registerResolver(java.lang.String, java.lang.String, com.djrapitops.plan.delivery.web.resolver.Resolver)
resolvers have higher priority than registerResolverForMatches(java.lang.String, java.util.regex.Pattern, com.djrapitops.plan.delivery.web.resolver.Resolver)
.
Can be used when making Resolver middleware.
target
- "/example/target"