public static class Lamp.Builder<A extends CommandActor>
extends java.lang.Object
| Constructor and Description |
|---|
Builder() |
| Modifier and Type | Method and Description |
|---|---|
@NotNull Lamp.Builder<A> |
accept(@NotNull LampBuilderVisitor<? super A> visitor)
Accepts the given visitor by calling
LampBuilderVisitor#visit(Builder) on
this Lamp.Builder instance |
<T extends java.lang.annotation.Annotation> |
annotationReplacer(@NotNull java.lang.Class<T> annotationType,
@NotNull AnnotationReplacer<T> replacer)
Registers an
AnnotationReplacer for a specified annotation type |
Lamp<A> |
build()
Constructs a
Lamp from this Lamp.Builder. |
Lamp.Builder<A> |
commandCondition(@NotNull CommandCondition<? super A> condition)
Registers a
CommandCondition that is invoked before a command is
finally executed |
Lamp.Builder<A> |
defaultErrorSender(@NotNull MessageSender<? super A,java.lang.String> messageSender)
Registers the default message sender used by
CommandActor.error(String) |
Lamp.Builder<A> |
defaultMessageSender(@NotNull MessageSender<? super A,java.lang.String> messageSender)
Registers the default message sender used by
CommandActor.reply(String) |
<T> Lamp.Builder<A> |
dependency(java.lang.Class<T> dependencyType,
@NotNull java.util.function.Supplier<T> dependency)
Registers the given dependency as a supplier that will provide
the values as needed
|
<T> Lamp.Builder<A> |
dependency(java.lang.Class<T> dependencyType,
T dependency)
Registers the given dependency as an object
|
DispatcherSettings.Builder<A> |
dispatcherSettings()
Returns the
DispatcherSettings builder |
@NotNull Lamp.Builder<A> |
dispatcherSettings(@NotNull java.util.function.Consumer<DispatcherSettings.Builder<A>> consumer)
Performs the given
consumer on the dispatcherSettings() builder. |
@NotNull Lamp.Builder<A> |
dispatcherSettings(@NotNull DispatcherSettings<A> settings)
Sets the
DispatcherSettings that is used by this Lamp
instance |
Lamp.Builder<A> |
exceptionHandler(@NotNull CommandExceptionHandler<A> handler)
Sets the registered exception handler that handles all
exceptions passed to this builder.
|
Hooks.Builder<A> |
hooks()
Returns the
Hooks builder |
@NotNull Lamp.Builder<A> |
hooks(@NotNull java.util.function.Consumer<Hooks.Builder<A>> consumer)
Performs the given
consumer on the hooks() builder. |
@NotNull Lamp.Builder<A> |
parameterNamingStrategy(ParameterNamingStrategy namingStrategy)
Sets the parameter naming strategy
|
ParameterTypes.Builder<A> |
parameterTypes()
Returns the
ParameterTypes builder |
@NotNull Lamp.Builder<A> |
parameterTypes(@NotNull java.util.function.Consumer<ParameterTypes.Builder<A>> consumer)
Performs the given
consumer on the parameterTypes() builder. |
<T> Lamp.Builder<A> |
parameterValidator(java.lang.Class<T> type,
@NotNull ParameterValidator<? super A,T> validator)
Registers a
ParameterValidator which validates certain types of parameters
that get resolved by ParameterTypes |
Lamp.Builder<A> |
permissionFactory(CommandPermission.Factory<? super A> factory)
Registers a
CommandPermission.Factory that creates CommandPermissions
for commands and parameters |
<T extends java.lang.annotation.Annotation> |
permissionForAnnotation(@NotNull java.lang.Class<T> annotationType,
@NotNull java.util.function.Function<T,CommandPermission<A>> permissionCreator)
Registers a
CommandPermission function that creates CommandPermissions
for commands and parameters that have the given |
<T> Lamp.Builder<A> |
responseHandler(java.lang.Class<T> type,
@NotNull ResponseHandler<? super A,T> responseHandler)
Registers a
ResponseHandler that accepts the objects matching a certain
type returned by command functions. |
Lamp.Builder<A> |
responseHandler(ResponseHandler.Factory<? super A> responseHandler)
Registers a
ResponseHandler.Factory that accepts returned by command functions. |
Lamp.Builder<A> |
senderResolver(@NotNull SenderResolver<? super A> resolver)
Registers a
SenderResolver which is responsible for parsing the first
parameter in the command and testing if it should be assumed the sender type |
SuggestionProviders.Builder<A> |
suggestionProviders()
Returns the
SuggestionProviders builder |
@NotNull Lamp.Builder<A> |
suggestionProviders(@NotNull java.util.function.Consumer<SuggestionProviders.Builder<A>> consumer)
Performs the given
consumer on the suggestionProviders() builder. |
@NotNull public @NotNull Lamp.Builder<A> parameterNamingStrategy(ParameterNamingStrategy namingStrategy)
namingStrategy - The parameter naming strategyParameterNamingStrategy@NotNull public ParameterTypes.Builder<A> parameterTypes()
ParameterTypes builderParameterTypes@NotNull public @NotNull Lamp.Builder<A> parameterTypes(@NotNull @NotNull java.util.function.Consumer<ParameterTypes.Builder<A>> consumer)
consumer on the parameterTypes() builder.
This allows for easier chaining of the Lamp.Builder instanceconsumer - The consumer to performParameterTypes@NotNull public SuggestionProviders.Builder<A> suggestionProviders()
SuggestionProviders builderSuggestionProviders@NotNull public @NotNull Lamp.Builder<A> suggestionProviders(@NotNull @NotNull java.util.function.Consumer<SuggestionProviders.Builder<A>> consumer)
consumer on the suggestionProviders() builder.
This allows for easier chaining of the Lamp.Builder instanceconsumer - The consumer to performSuggestionProviders@NotNull public @NotNull Lamp.Builder<A> dispatcherSettings(@NotNull @NotNull java.util.function.Consumer<DispatcherSettings.Builder<A>> consumer)
consumer on the dispatcherSettings() builder.
This allows for easier chaining of the Lamp.Builder instanceconsumer - The consumer to performDispatcherSettings@NotNull public DispatcherSettings.Builder<A> dispatcherSettings()
DispatcherSettings builderDispatcherSettings@NotNull public @NotNull Lamp.Builder<A> dispatcherSettings(@NotNull @NotNull DispatcherSettings<A> settings)
DispatcherSettings that is used by this Lamp
instancesettings - The settings to setDispatcherSettings@NotNull public Hooks.Builder<A> hooks()
Hooks builderHooks@NotNull public @NotNull Lamp.Builder<A> hooks(@NotNull @NotNull java.util.function.Consumer<Hooks.Builder<A>> consumer)
consumer on the hooks() builder.
This allows for easier chaining of the Lamp.Builder instanceconsumer - The consumer to performHookspublic <T extends java.lang.annotation.Annotation> Lamp.Builder<A> annotationReplacer(@NotNull @NotNull java.lang.Class<T> annotationType, @NotNull @NotNull AnnotationReplacer<T> replacer)
AnnotationReplacer for a specified annotation typeT - The replaced annotation typeannotationType - Annotation to replacereplacer - The annotation replacerAnnotationReplacer,
AnnotationListpublic Lamp.Builder<A> senderResolver(@NotNull @NotNull SenderResolver<? super A> resolver)
SenderResolver which is responsible for parsing the first
parameter in the command and testing if it should be assumed the sender typeresolver - The sender resolverSenderResolverpublic <T> Lamp.Builder<A> parameterValidator(java.lang.Class<T> type, @NotNull @NotNull ParameterValidator<? super A,T> validator)
ParameterValidator which validates certain types of parameters
that get resolved by ParameterTypesT - The parameter typetype - The parameter typevalidator - The validatorParameterValidatorpublic <T> Lamp.Builder<A> responseHandler(java.lang.Class<T> type, @NotNull @NotNull ResponseHandler<? super A,T> responseHandler)
ResponseHandler that accepts the objects matching a certain
type returned by command functions.T - The response typetype - The response typeresponseHandler - The response handlerResponseHandlerpublic Lamp.Builder<A> responseHandler(@NotNull ResponseHandler.Factory<? super A> responseHandler)
ResponseHandler.Factory that accepts returned by command functions.
This factory can access annotations of the typeresponseHandler - The response handlerResponseHandlerpublic Lamp.Builder<A> commandCondition(@NotNull @NotNull CommandCondition<? super A> condition)
CommandCondition that is invoked before a command is
finally executedcondition - The condition to registerCommandConditionpublic Lamp.Builder<A> permissionFactory(@NotNull CommandPermission.Factory<? super A> factory)
CommandPermission.Factory that creates CommandPermissions
for commands and parametersfactory - The permission factoryCommandPermission.Factory,
CommandPermissionpublic <T extends java.lang.annotation.Annotation> Lamp.Builder<A> permissionForAnnotation(@NotNull @NotNull java.lang.Class<T> annotationType, @NotNull @NotNull java.util.function.Function<T,CommandPermission<A>> permissionCreator)
CommandPermission function that creates CommandPermissions
for commands and parameters that have the given annotationType - The annotation typepermissionCreator - The permission creator functionCommandPermission.Factory,
CommandPermissionpublic Lamp.Builder<A> exceptionHandler(@NotNull @NotNull CommandExceptionHandler<A> handler)
handler - The exception handlerCommandExceptionHandlerpublic <T> Lamp.Builder<A> dependency(java.lang.Class<T> dependencyType, @NotNull T dependency)
T - The dependency typedependencyType - The dependency classdependency - The dependency objectDependencypublic <T> Lamp.Builder<A> dependency(java.lang.Class<T> dependencyType, @NotNull @NotNull java.util.function.Supplier<T> dependency)
T - The dependency typedependencyType - The dependency classdependency - The dependency supplierDependencypublic Lamp.Builder<A> defaultMessageSender(@NotNull @NotNull MessageSender<? super A,java.lang.String> messageSender)
CommandActor.reply(String)messageSender - The sender to usepublic Lamp.Builder<A> defaultErrorSender(@NotNull @NotNull MessageSender<? super A,java.lang.String> messageSender)
CommandActor.error(String)messageSender - The sender to use@Contract(value="_ -> this") @NotNull public @NotNull Lamp.Builder<A> accept(@NotNull @NotNull LampBuilderVisitor<? super A> visitor)
LampBuilderVisitor#visit(Builder) on
this Lamp.Builder instancevisitor - Visitor to accept@Contract(pure=true,
value="-> new")
public Lamp<A> build()
Lamp from this Lamp.Builder. All
lists are copied and turned immutable.Lamp instance.