Skip to content

Commit

Permalink
update javadocs
Browse files Browse the repository at this point in the history
Signed-off-by: breadmoirai <[email protected]>
  • Loading branch information
BreadMoirai committed Feb 20, 2018
1 parent 21c0bd4 commit 8ef3907
Show file tree
Hide file tree
Showing 13 changed files with 382 additions and 328 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@

/**
* Type of content.
* <ulist>
* <ul>
* <li>{@link Content.Type#RAW}</li>
* <li>{@link Content.Type#STRIPPED}</li>
* <li>{@link Content.Type#DISPLAY}</li>
* <li>{@link Content.Type#RAW_TRIMMED}</li>
* </ulist>
* </ul>
*
* @return the content type.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -576,15 +576,6 @@ public BreadBotBuilder addPreProcessPredicate(Predicate<Message> predicate) {
return this;
}

/**
* Not much use for this at the moment.
*/
public BreadBotBuilder setEventFactory(CommandEventFactory commandEventFactory) {
this.commandEventFactory = commandEventFactory;
return this;
}


/**
* This will allow messages to be re-evaluated on message edit.
* This will also evaluate commands that are unpinned.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ public interface CommandParameterBuilder {
* By default this is set to -1.
*
* @param limit An int determining the maximum amount of arguments to contain.
* @return this
* @return this.
*/
CommandParameterBuilder setLimit(int limit);

Expand All @@ -132,9 +132,10 @@ default CommandParameterBuilder configure(Consumer<CommandParameterBuilder> conf
CommandParameter build();

/**
* Sets the default mapping for a parameter in case none is found
* Sets the default mapping for a parameter in case none is found.
*
* @param defaultValue a function that produces a value
* @param defaultValue a function that produces a value.
* @return this.
*/
CommandParameterBuilder setDefaultValue(Function<CommandEvent, ?> defaultValue);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,14 @@ public interface CommandPluginBuilder {
* Finds and returns the first Module that is assignable to the provided {@code moduleClass}
*
* @param moduleClass The class of the Module to find
* @param <M> the plugin type
* @return The module if found. Else {@code null}.
*/
<M extends CommandPlugin> M getPlugin(Class<M> moduleClass);

/**
* This adds a module that implements {@link PrefixPlugin} to provide a static prefix that cannot be changed. If a {@link PrefixPlugin} is not added, one will be provided with a static prefix of {@code "!"}
* <p>
*
* <p>This method's implementation is:
* <pre><code> {@link CommandPluginBuilder#addPlugin(CommandPlugin) addModule}(new {@link UnmodifiablePrefixPlugin DefaultPrefixModule}(prefix)) </code></pre>
*
Expand All @@ -84,13 +85,13 @@ default CommandPluginBuilder addStaticPrefix(String prefix) {
* This ensures that Commands marked with {@link com.github.breadmoirai.breadbot.plugins.admin.Admin @Admin} are only usable by Administrators.
* <p>It is <b>important</b> to include an implementation of {@link AdminPlugin AdminModule} through either this method, {@link BreadBotBuilder#addAdminPlugin(Predicate)}, or your own implementation.
* Otherwise, all users will have access to Administrative Commands
* <p>
*
* <p>The default criteria for defining an Administrator is as follows:
* <ul>
* <li>Has Kick Members Permission</li>
* <li>Is higher than the bot on the role hierarchy</li>
* </ul>
* <p>
*
* <p>Different criteria to determine which member has administrative status with {@link BreadBotBuilder#addAdminPlugin(Predicate)}
* or your own implementation of {@link AdminPlugin}
*
Expand All @@ -102,7 +103,7 @@ default CommandPluginBuilder addAdminPlugin() {

/**
* Define custom behavior to determine which members can use Commands marked with {@link com.github.breadmoirai.breadbot.plugins.admin.Admin @Admin}
* <p>
*
* <p>This method's implementation is:
* <pre><code> {@link #addPlugin(CommandPlugin) addModule}(new {@link AdminPluginImpl DefaultAdminModule}(isAdmin)) </code></pre>
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,22 +39,25 @@ public interface CommandPropertiesManager {
/**
* The provided {@code configurator} is used to modify commands that possess the specified property.
* This behavior is added onto any existing behavior.
* When a command is registered with that property (usually an annotation), the provided {@code configurator} is applied.
* When a command is registered with that property (usually an annotation), the provided {@code configurator} is
* applied.
* If there are already commands registered, the {@code configurator} is applied to those as well.
*
* @param propertyType the class of the property
* @param configurator a {@link BiConsumer BiConsumer}.
* The first argument is the property.
* The second argument is the {@link CommandHandleBuilder CommandHandleBuilder} the property is attached to.
* @param <T> the propertyType
* The first argument is the property.
* The second argument is the {@link CommandHandleBuilder CommandHandleBuilder} the property is attached to.
* @param <T> the propertyType
* @return this, for chaining.
*/
<T> CommandPropertiesManager bindCommandModifier(Class<T> propertyType, BiConsumer<T, CommandHandleBuilder> configurator);
<T> CommandPropertiesManager bindCommandModifier(Class<T> propertyType,
BiConsumer<T, CommandHandleBuilder> configurator);

/**
* Removes any existing behavior attached to this parameter.
*
* @param parameterType the class of the parameter.
* @return this.
* @return this, for chaining.
*/
CommandPropertiesManager clearParameterModifiers(Class<?> parameterType);

Expand All @@ -66,11 +69,13 @@ public interface CommandPropertiesManager {
*
* @param propertyType the class of the property
* @param configurator a {@link BiConsumer BiConsumer}.
* The first argument is the property.
* The second argument is the {@link CommandHandleBuilder CommandHandleBuilder} the property is attached to.
* @param <T> the propertyType
* The first argument is the property.
* The second argument is the {@link CommandHandleBuilder CommandHandleBuilder} the property is attached to.
* @param <T> the propertyType
* @return this, for chaining.
*/
<T> CommandPropertiesManager bindParameterModifier(Class<T> propertyType, BiConsumer<T, CommandParameterBuilder> configurator);
<T> CommandPropertiesManager bindParameterModifier(Class<T> propertyType,
BiConsumer<T, CommandParameterBuilder> configurator);

/**
* Applies modifiers to a CommandHandleBuilder based on whether the handle contains a property.
Expand All @@ -83,7 +88,7 @@ public interface CommandPropertiesManager {
* Retrieves a BiConsumer that is used to modify a CommandHandleBuilder.
*
* @param propertyType the class of the Property.
* @param <T> the property type.
* @param <T> the property type.
* @return a BiConsumer if present, otherwise {@code null}.
* @see #clearCommandModifiers(Class)
* @see #bindCommandModifier(Class, BiConsumer)
Expand All @@ -95,10 +100,9 @@ public interface CommandPropertiesManager {
* Applies a modifier that is associated with a certain {@code propertyType} to the passed {@code builder}.
* If a modifier is not found the {@code builder} is not modified.
*
*
* @param propertyType the property class
* @param builder the CommandHandleBuilder to be modified
* @param <T> the property type
* @param builder the CommandHandleBuilder to be modified
* @param <T> the property type
* @see #clearCommandModifiers(Class) (Class)
* @see #bindCommandModifier(Class, BiConsumer)
* @see #getCommandModifier(Class)
Expand All @@ -116,7 +120,7 @@ public interface CommandPropertiesManager {
* Retrieves a BiConsumer that is used to modify a CommandParameterBuilder.
*
* @param propertyType the class of the Property.
* @param <T> the property type.
* @param <T> the property type.
* @return a BiConsumer if present, otherwise {@code null}.
* @see #clearParameterModifiers(Class)
* @see #bindParameterModifier(Class, BiConsumer)
Expand All @@ -129,68 +133,94 @@ public interface CommandPropertiesManager {
* If a modifier is not found the {@code builder} is not modified.
*
* @param propertyType the property class
* @param builder the CommandHandleBuilder to be modified
* @param <T> the property type
* @param builder the CommandHandleBuilder to be modified
* @param <T> the property type
* @see #clearParameterModifiers(Class) (Class, BiConsumer)
* @see #bindParameterModifier(Class, BiConsumer)
* @see #getParameterModifier(Class)
*/
<T> void applyParameterModifier(Class<T> propertyType, CommandParameterBuilder builder);

/**
* Associates a preprocessor with a property. This does not replace any existing preprocessors associated with the property.
* Associates a preprocessor with a property. This does not replace any existing preprocessors associated with the
* property.
*
* @param identifier a name for the preprocessor
* @param identifier a name for the preprocessor
* @param propertyType the property class
* @param function a {@link CommandPreprocessorFunction#process CommandPreprocessorFunction}
* @param function a {@link CommandPreprocessorFunction#process CommandPreprocessorFunction}
* @return this, for chaining.
*/
default CommandPropertiesManager bindPreprocessor(String identifier, Class<?> propertyType, CommandPreprocessorFunction function) {
bindCommandModifier(propertyType, (t, commandHandleBuilder) -> commandHandleBuilder.addPreprocessor(new CommandPreprocessor(identifier, function)));
default CommandPropertiesManager bindPreprocessor(String identifier, Class<?> propertyType,
CommandPreprocessorFunction function) {
bindCommandModifier(propertyType, (t, commandHandleBuilder) -> commandHandleBuilder.addPreprocessor(
new CommandPreprocessor(identifier, function)));
return this;
}

/**
* Associates a preprocessor with a property. This does not replace any existing preprocessors associated with the property.
* Associates a preprocessor with a property. This does not replace any existing preprocessors associated with the
* property.
*
* @param identifier a name for the preprocessor
* @param identifier a name for the preprocessor
* @param propertyType the property class
* @param factory a function that generates a preprocessor based upon the value of the property
* @param <T> the property type
* @param factory a function that generates a preprocessor based upon the value of the property
* @param <T> the property type
* @return this, for chaining.
*/
default <T> CommandPropertiesManager bindPreprocessorFactory(String identifier, Class<T> propertyType, Function<T, CommandPreprocessorFunction> factory) {
bindCommandModifier(propertyType, (t, commandHandleBuilder) -> commandHandleBuilder.addPreprocessor(new CommandPreprocessor(identifier, factory.apply(t))));
default <T> CommandPropertiesManager bindPreprocessorFactory(String identifier, Class<T> propertyType,
Function<T, CommandPreprocessorFunction> factory) {
bindCommandModifier(propertyType, (t, commandHandleBuilder) -> commandHandleBuilder.addPreprocessor(
new CommandPreprocessor(identifier, factory.apply(t))));
return this;
}

/**
* Associates a preprocessor with a property. This does not replace any existing preprocessors associated with the property.
* Associates a preprocessor with a property. This does not replace any existing preprocessors associated with the
* property.
*
* @param identifier a name for the preprocessor
* @param identifier a name for the preprocessor
* @param propertyType the property class
* @param predicate a {@link java.util.function.Predicate Predicate}{@literal <}{@link CommandEvent CommandEvent}{@literal >} that returns {@code true} when the command should continue to execute, {@code false} otherwise
* @param predicate a {@link java.util.function.Predicate Predicate}{@literal <}{@link CommandEvent
* CommandEvent}{@literal >} that returns {@code true} when the command should continue to execute, {@code false}
* otherwise
* @return this, for chaining.
*/
default CommandPropertiesManager bindPreprocessorPredicate(String identifier, Class<?> propertyType, CommandPreprocessorPredicate predicate) {
bindCommandModifier(propertyType, (t, commandHandleBuilder) -> commandHandleBuilder.addPreprocessor(new CommandPreprocessor(identifier, predicate)));
default CommandPropertiesManager bindPreprocessorPredicate(String identifier, Class<?> propertyType,
CommandPreprocessorPredicate predicate) {
bindCommandModifier(propertyType, (t, commandHandleBuilder) -> commandHandleBuilder.addPreprocessor(
new CommandPreprocessor(identifier, predicate)));
return this;
}

/**
* Associates a preprocessor with a property. This does not replace any existing preprocessors associated with the property.
* Associates a preprocessor with a property. This does not replace any existing preprocessors associated with the
* property.
*
* @param identifier a name for the preprocessor
* @param identifier a name for the preprocessor
* @param propertyType the property class
* @param factory a function that generates a preprocessor predicate based upon the value of the property
* @param <T> the property type
* @param factory a function that generates a preprocessor predicate based upon the value of the property
* @param <T> the property type
* @return this.
*/
default <T> CommandPropertiesManager bindPreprocessorPredicateFactory(String identifier, Class<T> propertyType, Function<T, CommandPreprocessorPredicate> factory) {
bindCommandModifier(propertyType, (t, commandHandleBuilder) -> commandHandleBuilder.addPreprocessor(new CommandPreprocessor(identifier, factory.apply(t))));
default <T> CommandPropertiesManager bindPreprocessorPredicateFactory(String identifier, Class<T> propertyType,
Function<T, CommandPreprocessorPredicate>
factory) {
bindCommandModifier(propertyType, (t, commandHandleBuilder) -> commandHandleBuilder.addPreprocessor(
new CommandPreprocessor(identifier, factory.apply(t))));
return this;
}

List<String> getPreprocessorPriorityList();

CommandPropertiesManager setPreprocessorPriority(String... identifiers);

/**
* Sets the order in which preprocessors are evaluated
*
* @param identifierList a list of strings that contain the names of each preprocessor. If there is a null value in
* the list, all unmatched preprocessors will be put in that spot.
* @return this.
*/
CommandPropertiesManager setPreprocessorPriority(List<String> identifierList);

Comparator<CommandPreprocessor> getPriorityComparator();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
/**
* This handles the result of a command, in other terms the returned value from invoking a command method
*
* @param <T>
* @param <T> the result type
*/
@FunctionalInterface
public interface CommandResultHandler<T> {
Expand Down
Loading

0 comments on commit 8ef3907

Please sign in to comment.