🚚 Begin migrating from javax annotations to checker-qual
This commit is contained in:
parent
e914d04450
commit
9f0c846050
43 changed files with 273 additions and 549 deletions
|
|
@ -35,9 +35,9 @@ import cloud.commandframework.permission.Permission;
|
|||
import cloud.commandframework.types.tuples.Pair;
|
||||
import cloud.commandframework.types.tuples.Triplet;
|
||||
import com.google.common.reflect.TypeToken;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.LinkedHashMap;
|
||||
|
|
@ -55,11 +55,11 @@ import java.util.function.Function;
|
|||
*/
|
||||
public class Command<C> {
|
||||
|
||||
@Nonnull private final Map<CommandArgument<C, ?>, Description> arguments;
|
||||
@Nonnull private final CommandExecutionHandler<C> commandExecutionHandler;
|
||||
@Nullable private final Class<? extends C> senderType;
|
||||
@Nonnull private final CommandPermission commandPermission;
|
||||
@Nonnull private final CommandMeta commandMeta;
|
||||
private final Map<@NonNull CommandArgument<C, ?>, @NonNull Description> arguments;
|
||||
private final CommandExecutionHandler<C> commandExecutionHandler;
|
||||
private final Class<? extends C> senderType;
|
||||
private final CommandPermission commandPermission;
|
||||
private final CommandMeta commandMeta;
|
||||
|
||||
/**
|
||||
* Construct a new command
|
||||
|
|
@ -70,11 +70,11 @@ public class Command<C> {
|
|||
* @param commandPermission Command permission
|
||||
* @param commandMeta Command meta instance
|
||||
*/
|
||||
public Command(@Nonnull final Map<CommandArgument<C, ?>, Description> commandArguments,
|
||||
@Nonnull final CommandExecutionHandler<C> commandExecutionHandler,
|
||||
public Command(@NonNull final Map<@NonNull CommandArgument<C, ?>, @NonNull Description> commandArguments,
|
||||
@NonNull final CommandExecutionHandler<@NonNull C> commandExecutionHandler,
|
||||
@Nullable final Class<? extends C> senderType,
|
||||
@Nonnull final CommandPermission commandPermission,
|
||||
@Nonnull final CommandMeta commandMeta) {
|
||||
@NonNull final CommandPermission commandPermission,
|
||||
@NonNull final CommandMeta commandMeta) {
|
||||
this.arguments = Objects.requireNonNull(commandArguments, "Command arguments may not be null");
|
||||
if (this.arguments.size() == 0) {
|
||||
throw new IllegalArgumentException("At least one command argument is required");
|
||||
|
|
@ -107,10 +107,10 @@ public class Command<C> {
|
|||
* @param senderType Required sender type. May be {@code null}
|
||||
* @param commandMeta Command meta instance
|
||||
*/
|
||||
public Command(@Nonnull final Map<CommandArgument<C, ?>, Description> commandArguments,
|
||||
@Nonnull final CommandExecutionHandler<C> commandExecutionHandler,
|
||||
public Command(@NonNull final Map<@NonNull CommandArgument<C, ?>, @NonNull Description> commandArguments,
|
||||
@NonNull final CommandExecutionHandler<@NonNull C> commandExecutionHandler,
|
||||
@Nullable final Class<? extends C> senderType,
|
||||
@Nonnull final CommandMeta commandMeta) {
|
||||
@NonNull final CommandMeta commandMeta) {
|
||||
this(commandArguments, commandExecutionHandler, senderType, Permission.empty(), commandMeta);
|
||||
}
|
||||
|
||||
|
|
@ -122,10 +122,10 @@ public class Command<C> {
|
|||
* @param commandPermission Command permission
|
||||
* @param commandMeta Command meta instance
|
||||
*/
|
||||
public Command(@Nonnull final Map<CommandArgument<C, ?>, Description> commandArguments,
|
||||
@Nonnull final CommandExecutionHandler<C> commandExecutionHandler,
|
||||
@Nonnull final CommandPermission commandPermission,
|
||||
@Nonnull final CommandMeta commandMeta) {
|
||||
public Command(@NonNull final Map<@NonNull CommandArgument<C, ?>, @NonNull Description> commandArguments,
|
||||
@NonNull final CommandExecutionHandler<@NonNull C> commandExecutionHandler,
|
||||
@NonNull final CommandPermission commandPermission,
|
||||
@NonNull final CommandMeta commandMeta) {
|
||||
this(commandArguments, commandExecutionHandler, null, commandPermission, commandMeta);
|
||||
}
|
||||
|
||||
|
|
@ -140,12 +140,11 @@ public class Command<C> {
|
|||
* @param <C> Command sender type
|
||||
* @return Command builder
|
||||
*/
|
||||
@Nonnull
|
||||
public static <C> Builder<C> newBuilder(@Nonnull final String commandName,
|
||||
@Nonnull final CommandMeta commandMeta,
|
||||
@Nonnull final Description description,
|
||||
@Nonnull final String... aliases) {
|
||||
final Map<CommandArgument<C, ?>, Description> map = new LinkedHashMap<>();
|
||||
public static <C> @NonNull Builder<C> newBuilder(@NonNull final String commandName,
|
||||
@NonNull final CommandMeta commandMeta,
|
||||
@NonNull final Description description,
|
||||
@NonNull final String... aliases) {
|
||||
final Map<@NonNull CommandArgument<C, ?>, @NonNull Description> map = new LinkedHashMap<>();
|
||||
map.put(StaticArgument.required(commandName, aliases), description);
|
||||
return new Builder<>(null, commandMeta, null, map,
|
||||
new CommandExecutionHandler.NullCommandExecutionHandler<>(), Permission.empty());
|
||||
|
|
@ -161,10 +160,9 @@ public class Command<C> {
|
|||
* @param <C> Command sender type
|
||||
* @return Command builder
|
||||
*/
|
||||
@Nonnull
|
||||
public static <C> Builder<C> newBuilder(@Nonnull final String commandName,
|
||||
@Nonnull final CommandMeta commandMeta,
|
||||
@Nonnull final String... aliases) {
|
||||
public static <C> @NonNull Builder<C> newBuilder(@NonNull final String commandName,
|
||||
@NonNull final CommandMeta commandMeta,
|
||||
@NonNull final String... aliases) {
|
||||
final Map<CommandArgument<C, ?>, Description> map = new LinkedHashMap<>();
|
||||
map.put(StaticArgument.required(commandName, aliases), Description.empty());
|
||||
return new Builder<>(null, commandMeta, null, map,
|
||||
|
|
@ -176,8 +174,7 @@ public class Command<C> {
|
|||
*
|
||||
* @return Copy of the command argument array
|
||||
*/
|
||||
@Nonnull
|
||||
public List<CommandArgument<C, ?>> getArguments() {
|
||||
public @NonNull List<CommandArgument<@NonNull C, @NonNull ?>> getArguments() {
|
||||
return new ArrayList<>(this.arguments.keySet());
|
||||
}
|
||||
|
||||
|
|
@ -186,8 +183,7 @@ public class Command<C> {
|
|||
*
|
||||
* @return Command execution handler
|
||||
*/
|
||||
@Nonnull
|
||||
public CommandExecutionHandler<C> getCommandExecutionHandler() {
|
||||
public CommandExecutionHandler<@NonNull C> getCommandExecutionHandler() {
|
||||
return this.commandExecutionHandler;
|
||||
}
|
||||
|
||||
|
|
@ -196,8 +192,7 @@ public class Command<C> {
|
|||
*
|
||||
* @return Required sender type
|
||||
*/
|
||||
@Nonnull
|
||||
public Optional<Class<? extends C>> getSenderType() {
|
||||
public @NonNull Optional<Class<? extends C>> getSenderType() {
|
||||
return Optional.ofNullable(this.senderType);
|
||||
}
|
||||
|
||||
|
|
@ -206,8 +201,7 @@ public class Command<C> {
|
|||
*
|
||||
* @return Command permission
|
||||
*/
|
||||
@Nonnull
|
||||
public CommandPermission getCommandPermission() {
|
||||
public @NonNull CommandPermission getCommandPermission() {
|
||||
return this.commandPermission;
|
||||
}
|
||||
|
||||
|
|
@ -216,8 +210,7 @@ public class Command<C> {
|
|||
*
|
||||
* @return Command meta
|
||||
*/
|
||||
@Nonnull
|
||||
public CommandMeta getCommandMeta() {
|
||||
public @NonNull CommandMeta getCommandMeta() {
|
||||
return this.commandMeta;
|
||||
}
|
||||
|
||||
|
|
@ -227,8 +220,7 @@ public class Command<C> {
|
|||
* @param argument Argument
|
||||
* @return Argument description
|
||||
*/
|
||||
@Nonnull
|
||||
public String getArgumentDescription(@Nonnull final CommandArgument<C, ?> argument) {
|
||||
public @NonNull String getArgumentDescription(@NonNull final CommandArgument<C, ?> argument) {
|
||||
return this.arguments.get(argument).getDescription();
|
||||
}
|
||||
|
||||
|
|
@ -260,19 +252,19 @@ public class Command<C> {
|
|||
*/
|
||||
public static final class Builder<C> {
|
||||
|
||||
@Nonnull private final CommandMeta commandMeta;
|
||||
@Nonnull private final Map<CommandArgument<C, ?>, Description> commandArguments;
|
||||
@Nonnull private final CommandExecutionHandler<C> commandExecutionHandler;
|
||||
@Nullable private final Class<? extends C> senderType;
|
||||
@Nonnull private final CommandPermission commandPermission;
|
||||
@Nullable private final CommandManager<C> commandManager;
|
||||
private final CommandMeta commandMeta;
|
||||
private final Map<CommandArgument<C, ?>, Description> commandArguments;
|
||||
private final CommandExecutionHandler<C> commandExecutionHandler;
|
||||
private final Class<? extends C> senderType;
|
||||
private final CommandPermission commandPermission;
|
||||
private final CommandManager<C> commandManager;
|
||||
|
||||
private Builder(@Nullable final CommandManager<C> commandManager,
|
||||
@Nonnull final CommandMeta commandMeta,
|
||||
@NonNull final CommandMeta commandMeta,
|
||||
@Nullable final Class<? extends C> senderType,
|
||||
@Nonnull final Map<CommandArgument<C, ?>, Description> commandArguments,
|
||||
@Nonnull final CommandExecutionHandler<C> commandExecutionHandler,
|
||||
@Nonnull final CommandPermission commandPermission) {
|
||||
@NonNull final Map<@NonNull CommandArgument<C, ?>, @NonNull Description> commandArguments,
|
||||
@NonNull final CommandExecutionHandler<@NonNull C> commandExecutionHandler,
|
||||
@NonNull final CommandPermission commandPermission) {
|
||||
this.commandManager = commandManager;
|
||||
this.senderType = senderType;
|
||||
this.commandArguments = Objects.requireNonNull(commandArguments, "Arguments may not be null");
|
||||
|
|
@ -288,8 +280,7 @@ public class Command<C> {
|
|||
* @param value Meta value
|
||||
* @return New builder instance using the inserted meta key-value pair
|
||||
*/
|
||||
@Nonnull
|
||||
public Builder<C> meta(@Nonnull final String key, @Nonnull final String value) {
|
||||
public @NonNull Builder<C> meta(@NonNull final String key, @NonNull final String value) {
|
||||
final CommandMeta commandMeta = SimpleCommandMeta.builder().with(this.commandMeta).with(key, value).build();
|
||||
return new Builder<>(this.commandManager, commandMeta, this.senderType, this.commandArguments,
|
||||
this.commandExecutionHandler, this.commandPermission);
|
||||
|
|
@ -303,8 +294,7 @@ public class Command<C> {
|
|||
* @param commandManager Command manager
|
||||
* @return New builder instance using the provided command manager
|
||||
*/
|
||||
@Nonnull
|
||||
public Builder<C> manager(@Nullable final CommandManager<C> commandManager) {
|
||||
public @NonNull Builder<C> manager(@Nullable final CommandManager<C> commandManager) {
|
||||
return new Builder<>(commandManager, this.commandMeta, this.senderType, this.commandArguments,
|
||||
this.commandExecutionHandler, this.commandPermission);
|
||||
}
|
||||
|
|
@ -316,8 +306,8 @@ public class Command<C> {
|
|||
* @param aliases Argument aliases
|
||||
* @return New builder instance with the modified command chain
|
||||
*/
|
||||
@Nonnull
|
||||
public Builder<C> literal(@Nonnull final String main, @Nonnull final String... aliases) {
|
||||
public @NonNull Builder<C> literal(@NonNull final String main,
|
||||
@NonNull final String... aliases) {
|
||||
return this.argument(StaticArgument.required(main, aliases));
|
||||
}
|
||||
|
||||
|
|
@ -329,10 +319,9 @@ public class Command<C> {
|
|||
* @param aliases Argument aliases
|
||||
* @return New builder instance with the modified command chain
|
||||
*/
|
||||
@Nonnull
|
||||
public Builder<C> literal(@Nonnull final String main,
|
||||
@Nonnull final Description description,
|
||||
@Nonnull final String... aliases) {
|
||||
public @NonNull Builder<C> literal(@NonNull final String main,
|
||||
@NonNull final Description description,
|
||||
@NonNull final String... aliases) {
|
||||
return this.argument(StaticArgument.required(main, aliases), description);
|
||||
}
|
||||
|
||||
|
|
@ -343,8 +332,7 @@ public class Command<C> {
|
|||
* @param <T> Argument type
|
||||
* @return New builder instance with the command argument inserted into the argument list
|
||||
*/
|
||||
@Nonnull
|
||||
public <T> Builder<C> argument(@Nonnull final CommandArgument<C, T> argument) {
|
||||
public <T> @NonNull Builder<C> argument(@NonNull final CommandArgument<C, T> argument) {
|
||||
return this.argument(argument, Description.empty());
|
||||
}
|
||||
|
||||
|
|
@ -356,9 +344,8 @@ public class Command<C> {
|
|||
* @param <T> Argument type
|
||||
* @return New builder instance with the command argument inserted into the argument list
|
||||
*/
|
||||
@Nonnull
|
||||
public <T> Builder<C> argument(@Nonnull final CommandArgument<C, T> argument,
|
||||
@Nonnull final Description description) {
|
||||
public <T> @NonNull Builder<C> argument(@NonNull final CommandArgument<C, T> argument,
|
||||
@NonNull final Description description) {
|
||||
final Map<CommandArgument<C, ?>, Description> commandArgumentMap = new LinkedHashMap<>(this.commandArguments);
|
||||
commandArgumentMap.put(argument, description);
|
||||
return new Builder<>(this.commandManager, this.commandMeta, this.senderType, commandArgumentMap,
|
||||
|
|
@ -374,10 +361,9 @@ public class Command<C> {
|
|||
* @param <T> Argument type
|
||||
* @return New builder instance with the command argument inserted into the argument list
|
||||
*/
|
||||
@Nonnull
|
||||
public <T> Builder<C> argument(@Nonnull final Class<T> clazz,
|
||||
@Nonnull final String name,
|
||||
@Nonnull final Consumer<CommandArgument.Builder<C, T>> builderConsumer) {
|
||||
public <T> @NonNull Builder<C> argument(@NonNull final Class<T> clazz,
|
||||
@NonNull final String name,
|
||||
@NonNull final Consumer<CommandArgument.Builder<C, T>> builderConsumer) {
|
||||
final CommandArgument.Builder<C, T> builder = CommandArgument.ofType(clazz, name);
|
||||
if (this.commandManager != null) {
|
||||
builder.manager(this.commandManager);
|
||||
|
|
@ -524,8 +510,7 @@ public class Command<C> {
|
|||
* @param commandExecutionHandler New execution handler
|
||||
* @return New builder instance using the command execution handler
|
||||
*/
|
||||
@Nonnull
|
||||
public Builder<C> handler(@Nonnull final CommandExecutionHandler<C> commandExecutionHandler) {
|
||||
public @NonNull Builder<C> handler(@NonNull final CommandExecutionHandler<C> commandExecutionHandler) {
|
||||
return new Builder<>(this.commandManager, this.commandMeta, this.senderType, this.commandArguments,
|
||||
commandExecutionHandler, this.commandPermission);
|
||||
}
|
||||
|
|
@ -536,8 +521,7 @@ public class Command<C> {
|
|||
* @param senderType Required sender type
|
||||
* @return New builder instance using the command execution handler
|
||||
*/
|
||||
@Nonnull
|
||||
public Builder<C> withSenderType(@Nonnull final Class<? extends C> senderType) {
|
||||
public @NonNull Builder<C> withSenderType(@NonNull final Class<? extends C> senderType) {
|
||||
return new Builder<>(this.commandManager, this.commandMeta, senderType, this.commandArguments,
|
||||
this.commandExecutionHandler, this.commandPermission);
|
||||
}
|
||||
|
|
@ -548,8 +532,7 @@ public class Command<C> {
|
|||
* @param permission Command permission
|
||||
* @return New builder instance using the command permission
|
||||
*/
|
||||
@Nonnull
|
||||
public Builder<C> withPermission(@Nonnull final CommandPermission permission) {
|
||||
public @NonNull Builder<C> withPermission(@NonNull final CommandPermission permission) {
|
||||
return new Builder<>(this.commandManager, this.commandMeta, this.senderType, this.commandArguments,
|
||||
this.commandExecutionHandler, permission);
|
||||
}
|
||||
|
|
@ -560,8 +543,7 @@ public class Command<C> {
|
|||
* @param permission Command permission
|
||||
* @return New builder instance using the command permission
|
||||
*/
|
||||
@Nonnull
|
||||
public Builder<C> withPermission(@Nonnull final String permission) {
|
||||
public @NonNull Builder<C> withPermission(@NonNull final String permission) {
|
||||
return new Builder<>(this.commandManager, this.commandMeta, this.senderType, this.commandArguments,
|
||||
this.commandExecutionHandler, Permission.of(permission));
|
||||
}
|
||||
|
|
@ -577,8 +559,7 @@ public class Command<C> {
|
|||
* @param command Command to proxy
|
||||
* @return New builder that proxies the given command
|
||||
*/
|
||||
@Nonnull
|
||||
public Builder<C> proxies(@Nonnull final Command<C> command) {
|
||||
public @NonNull Builder<C> proxies(@NonNull final Command<C> command) {
|
||||
Builder<C> builder = this;
|
||||
for (final CommandArgument<C, ?> argument : command.getArguments()) {
|
||||
if (argument instanceof StaticArgument) {
|
||||
|
|
@ -599,8 +580,7 @@ public class Command<C> {
|
|||
*
|
||||
* @return New builder instance that indicates that the constructed command should be hidden
|
||||
*/
|
||||
@Nonnull
|
||||
public Builder<C> hidden() {
|
||||
public @NonNull Builder<C> hidden() {
|
||||
return this.meta("hidden", "true");
|
||||
}
|
||||
|
||||
|
|
@ -609,8 +589,7 @@ public class Command<C> {
|
|||
*
|
||||
* @return Built command
|
||||
*/
|
||||
@Nonnull
|
||||
public Command<C> build() {
|
||||
public @NonNull Command<C> build() {
|
||||
return new Command<>(Collections.unmodifiableMap(this.commandArguments),
|
||||
this.commandExecutionHandler,
|
||||
this.senderType,
|
||||
|
|
|
|||
|
|
@ -31,8 +31,6 @@ import cloud.commandframework.arguments.parser.ArgumentParseResult;
|
|||
import cloud.commandframework.arguments.parser.ParserParameters;
|
||||
import cloud.commandframework.context.CommandContext;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.function.BiFunction;
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@
|
|||
//
|
||||
package cloud.commandframework.execution.postprocessor;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
/**
|
||||
* {@link CommandPostprocessor} that does nothing besides indicating that the context
|
||||
|
|
@ -39,7 +39,7 @@ public final class AcceptingCommandPostprocessor<C> implements CommandPostproces
|
|||
public static final String PROCESSED_INDICATOR_KEY = "__COMMAND_POST_PROCESSED__";
|
||||
|
||||
@Override
|
||||
public void accept(@Nonnull final CommandPostprocessingContext<C> context) {
|
||||
public void accept(@NonNull final CommandPostprocessingContext<C> context) {
|
||||
context.getCommandContext().store(PROCESSED_INDICATOR_KEY, "true");
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -25,8 +25,8 @@ package cloud.commandframework.execution.postprocessor;
|
|||
|
||||
import cloud.commandframework.Command;
|
||||
import cloud.commandframework.context.CommandContext;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
|
|
@ -36,8 +36,8 @@ import java.util.Objects;
|
|||
*/
|
||||
public final class CommandPostprocessingContext<C> {
|
||||
|
||||
private final CommandContext<C> commandContext;
|
||||
private final Command<C> command;
|
||||
private final CommandContext<@NonNull C> commandContext;
|
||||
private final Command<@NonNull C> command;
|
||||
|
||||
/**
|
||||
* Construct a new command postprocessing context
|
||||
|
|
@ -45,8 +45,8 @@ public final class CommandPostprocessingContext<C> {
|
|||
* @param commandContext Command context
|
||||
* @param command Command instance
|
||||
*/
|
||||
public CommandPostprocessingContext(@Nonnull final CommandContext<C> commandContext,
|
||||
@Nonnull final Command<C> command) {
|
||||
public CommandPostprocessingContext(@NonNull final CommandContext<@NonNull C> commandContext,
|
||||
@NonNull final Command<@NonNull C> command) {
|
||||
this.commandContext = commandContext;
|
||||
this.command = command;
|
||||
}
|
||||
|
|
@ -56,8 +56,7 @@ public final class CommandPostprocessingContext<C> {
|
|||
*
|
||||
* @return Command context
|
||||
*/
|
||||
@Nonnull
|
||||
public CommandContext<C> getCommandContext() {
|
||||
public @NonNull CommandContext<@NonNull C> getCommandContext() {
|
||||
return this.commandContext;
|
||||
}
|
||||
|
||||
|
|
@ -66,8 +65,7 @@ public final class CommandPostprocessingContext<C> {
|
|||
*
|
||||
* @return Command instance
|
||||
*/
|
||||
@Nonnull
|
||||
public Command<C> getCommand() {
|
||||
public @NonNull Command<@NonNull C> getCommand() {
|
||||
return this.command;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -24,8 +24,7 @@
|
|||
package cloud.commandframework.internal;
|
||||
|
||||
import cloud.commandframework.Command;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
/**
|
||||
* Utility that registers commands natively for whatever
|
||||
|
|
@ -40,8 +39,7 @@ public interface CommandRegistrationHandler {
|
|||
*
|
||||
* @return Constructed registration
|
||||
*/
|
||||
@Nonnull
|
||||
static CommandRegistrationHandler nullCommandRegistrationHandler() {
|
||||
static @NonNull CommandRegistrationHandler nullCommandRegistrationHandler() {
|
||||
return new NullCommandRegistrationHandler();
|
||||
}
|
||||
|
||||
|
|
@ -52,7 +50,7 @@ public interface CommandRegistrationHandler {
|
|||
* @return {@code true} if the command was registered successfully,
|
||||
* else {@code false}
|
||||
*/
|
||||
boolean registerCommand(@Nonnull Command<?> command);
|
||||
boolean registerCommand(@NonNull Command<?> command);
|
||||
|
||||
final class NullCommandRegistrationHandler implements CommandRegistrationHandler {
|
||||
|
||||
|
|
@ -60,7 +58,7 @@ public interface CommandRegistrationHandler {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean registerCommand(@Nonnull final Command<?> command) {
|
||||
public boolean registerCommand(@NonNull final Command<?> command) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -23,7 +23,8 @@
|
|||
//
|
||||
package cloud.commandframework.permission;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
|
|
@ -36,8 +37,7 @@ public interface CommandPermission {
|
|||
*
|
||||
* @return Permission nodes
|
||||
*/
|
||||
@Nonnull
|
||||
Collection<CommandPermission> getPermissions();
|
||||
@NonNull Collection<@NonNull CommandPermission> getPermissions();
|
||||
|
||||
/**
|
||||
* Get a string representation of the permission
|
||||
|
|
@ -45,7 +45,6 @@ public interface CommandPermission {
|
|||
* @return String representation of the permission node
|
||||
*/
|
||||
@Override
|
||||
@Nonnull
|
||||
String toString();
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,7 +23,8 @@
|
|||
//
|
||||
package cloud.commandframework.permission;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
|
|
@ -37,7 +38,7 @@ public final class OrPermission implements CommandPermission {
|
|||
|
||||
private final Collection<CommandPermission> permissions;
|
||||
|
||||
private OrPermission(@Nonnull final Collection<CommandPermission> permissions) {
|
||||
private OrPermission(@NonNull final Collection<CommandPermission> permissions) {
|
||||
this.permissions = permissions;
|
||||
}
|
||||
|
||||
|
|
@ -47,8 +48,7 @@ public final class OrPermission implements CommandPermission {
|
|||
* @param permissions Permissions to join
|
||||
* @return Constructed permission
|
||||
*/
|
||||
@Nonnull
|
||||
public static CommandPermission of(@Nonnull final Collection<CommandPermission> permissions) {
|
||||
public static @NonNull CommandPermission of(@NonNull final Collection<CommandPermission> permissions) {
|
||||
final Set<CommandPermission> permissionSet = new HashSet<>();
|
||||
for (final CommandPermission permission : permissions) {
|
||||
permissionSet.addAll(permission.getPermissions());
|
||||
|
|
@ -56,9 +56,8 @@ public final class OrPermission implements CommandPermission {
|
|||
return new OrPermission(permissionSet);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public Collection<CommandPermission> getPermissions() {
|
||||
public @NonNull Collection<@NonNull CommandPermission> getPermissions() {
|
||||
return this.permissions;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -23,7 +23,8 @@
|
|||
//
|
||||
package cloud.commandframework.permission;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.Objects;
|
||||
|
|
@ -40,7 +41,7 @@ public final class Permission implements CommandPermission {
|
|||
|
||||
private final String permission;
|
||||
|
||||
private Permission(@Nonnull final String permission) {
|
||||
private Permission(@NonNull final String permission) {
|
||||
this.permission = permission;
|
||||
}
|
||||
|
||||
|
|
@ -49,8 +50,7 @@ public final class Permission implements CommandPermission {
|
|||
*
|
||||
* @return Command permission
|
||||
*/
|
||||
@Nonnull
|
||||
public static Permission empty() {
|
||||
public static @NonNull Permission empty() {
|
||||
return EMPTY;
|
||||
}
|
||||
|
||||
|
|
@ -60,8 +60,7 @@ public final class Permission implements CommandPermission {
|
|||
* @param string Command permission
|
||||
* @return Created command permission
|
||||
*/
|
||||
@Nonnull
|
||||
public static Permission of(@Nonnull final String string) {
|
||||
public static @NonNull Permission of(@NonNull final String string) {
|
||||
return new Permission(string);
|
||||
}
|
||||
|
||||
|
|
@ -70,14 +69,12 @@ public final class Permission implements CommandPermission {
|
|||
*
|
||||
* @return Command permission
|
||||
*/
|
||||
@Nonnull
|
||||
public String getPermission() {
|
||||
return this.permission;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public Collection<CommandPermission> getPermissions() {
|
||||
public @NonNull Collection<@NonNull CommandPermission> getPermissions() {
|
||||
return Collections.singleton(this);
|
||||
}
|
||||
|
||||
|
|
@ -86,7 +83,6 @@ public final class Permission implements CommandPermission {
|
|||
*
|
||||
* @return Command permission
|
||||
*/
|
||||
@Nonnull
|
||||
@Override
|
||||
public String toString() {
|
||||
return this.permission;
|
||||
|
|
|
|||
|
|
@ -23,7 +23,8 @@
|
|||
//
|
||||
package cloud.commandframework.types.tuples;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
|
|
@ -34,13 +35,11 @@ import java.util.Objects;
|
|||
*/
|
||||
public class Pair<U, V> implements Tuple {
|
||||
|
||||
@Nonnull
|
||||
private final U first;
|
||||
@Nonnull
|
||||
private final V second;
|
||||
|
||||
protected Pair(@Nonnull final U first,
|
||||
@Nonnull final V second) {
|
||||
protected Pair(@NonNull final U first,
|
||||
@NonNull final V second) {
|
||||
this.first = first;
|
||||
this.second = second;
|
||||
}
|
||||
|
|
@ -54,9 +53,8 @@ public class Pair<U, V> implements Tuple {
|
|||
* @param <V> Second type
|
||||
* @return Created pair
|
||||
*/
|
||||
@Nonnull
|
||||
public static <U, V> Pair<U, V> of(@Nonnull final U first,
|
||||
@Nonnull final V second) {
|
||||
public static <U, V> @NonNull Pair<@NonNull U, @NonNull V> of(@NonNull final U first,
|
||||
@NonNull final V second) {
|
||||
return new Pair<>(first, second);
|
||||
}
|
||||
|
||||
|
|
@ -65,8 +63,7 @@ public class Pair<U, V> implements Tuple {
|
|||
*
|
||||
* @return First value
|
||||
*/
|
||||
@Nonnull
|
||||
public final U getFirst() {
|
||||
public final @NonNull U getFirst() {
|
||||
return this.first;
|
||||
}
|
||||
|
||||
|
|
@ -75,8 +72,7 @@ public class Pair<U, V> implements Tuple {
|
|||
*
|
||||
* @return Second value
|
||||
*/
|
||||
@Nonnull
|
||||
public final V getSecond() {
|
||||
public final @NonNull V getSecond() {
|
||||
return this.second;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -23,7 +23,8 @@
|
|||
//
|
||||
package cloud.commandframework.types.tuples;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
|
|
@ -36,19 +37,15 @@ import java.util.Objects;
|
|||
*/
|
||||
public class Quartet<U, V, W, X> implements Tuple {
|
||||
|
||||
@Nonnull
|
||||
private final U first;
|
||||
@Nonnull
|
||||
private final V second;
|
||||
@Nonnull
|
||||
private final W third;
|
||||
@Nonnull
|
||||
private final X fourth;
|
||||
|
||||
protected Quartet(@Nonnull final U first,
|
||||
@Nonnull final V second,
|
||||
@Nonnull final W third,
|
||||
@Nonnull final X fourth) {
|
||||
protected Quartet(@NonNull final U first,
|
||||
@NonNull final V second,
|
||||
@NonNull final W third,
|
||||
@NonNull final X fourth) {
|
||||
this.first = first;
|
||||
this.second = second;
|
||||
this.third = third;
|
||||
|
|
@ -68,11 +65,10 @@ public class Quartet<U, V, W, X> implements Tuple {
|
|||
* @param <X> Fourth type
|
||||
* @return Created quartet
|
||||
*/
|
||||
@Nonnull
|
||||
public static <U, V, W, X> Quartet<U, V, W, X> of(@Nonnull final U first,
|
||||
@Nonnull final V second,
|
||||
@Nonnull final W third,
|
||||
@Nonnull final X fourth) {
|
||||
public static <U, V, W, X> @NonNull Quartet<@NonNull U, @NonNull V, @NonNull W, @NonNull X> of(@NonNull final U first,
|
||||
@NonNull final V second,
|
||||
@NonNull final W third,
|
||||
@NonNull final X fourth) {
|
||||
return new Quartet<>(first, second, third, fourth);
|
||||
}
|
||||
|
||||
|
|
@ -81,8 +77,7 @@ public class Quartet<U, V, W, X> implements Tuple {
|
|||
*
|
||||
* @return First value
|
||||
*/
|
||||
@Nonnull
|
||||
public final U getFirst() {
|
||||
public final @NonNull U getFirst() {
|
||||
return this.first;
|
||||
}
|
||||
|
||||
|
|
@ -91,8 +86,7 @@ public class Quartet<U, V, W, X> implements Tuple {
|
|||
*
|
||||
* @return Second value
|
||||
*/
|
||||
@Nonnull
|
||||
public final V getSecond() {
|
||||
public final @NonNull V getSecond() {
|
||||
return this.second;
|
||||
}
|
||||
|
||||
|
|
@ -101,8 +95,7 @@ public class Quartet<U, V, W, X> implements Tuple {
|
|||
*
|
||||
* @return Third value
|
||||
*/
|
||||
@Nonnull
|
||||
public final W getThird() {
|
||||
public final @NonNull W getThird() {
|
||||
return this.third;
|
||||
}
|
||||
|
||||
|
|
@ -111,8 +104,7 @@ public class Quartet<U, V, W, X> implements Tuple {
|
|||
*
|
||||
* @return Fourth value
|
||||
*/
|
||||
@Nonnull
|
||||
public final X getFourth() {
|
||||
public final @NonNull X getFourth() {
|
||||
return this.fourth;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -23,7 +23,8 @@
|
|||
//
|
||||
package cloud.commandframework.types.tuples;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
|
|
@ -37,22 +38,17 @@ import java.util.Objects;
|
|||
*/
|
||||
public class Quintet<U, V, W, X, Y> implements Tuple {
|
||||
|
||||
@Nonnull
|
||||
private final U first;
|
||||
@Nonnull
|
||||
private final V second;
|
||||
@Nonnull
|
||||
private final W third;
|
||||
@Nonnull
|
||||
private final X fourth;
|
||||
@Nonnull
|
||||
private final Y fifth;
|
||||
|
||||
protected Quintet(@Nonnull final U first,
|
||||
@Nonnull final V second,
|
||||
@Nonnull final W third,
|
||||
@Nonnull final X fourth,
|
||||
@Nonnull final Y fifth) {
|
||||
protected Quintet(@NonNull final U first,
|
||||
@NonNull final V second,
|
||||
@NonNull final W third,
|
||||
@NonNull final X fourth,
|
||||
@NonNull final Y fifth) {
|
||||
this.first = first;
|
||||
this.second = second;
|
||||
this.third = third;
|
||||
|
|
@ -75,12 +71,12 @@ public class Quintet<U, V, W, X, Y> implements Tuple {
|
|||
* @param <Y> Fifth type
|
||||
* @return Created quintet
|
||||
*/
|
||||
@Nonnull
|
||||
public static <U, V, W, X, Y> Quintet<U, V, W, X, Y> of(@Nonnull final U first,
|
||||
@Nonnull final V second,
|
||||
@Nonnull final W third,
|
||||
@Nonnull final X fourth,
|
||||
@Nonnull final Y fifth) {
|
||||
public static <U, V, W, X, Y> @NonNull Quintet<@NonNull U, @NonNull V, @NonNull W, @NonNull X, @NonNull Y> of(
|
||||
@NonNull final U first,
|
||||
@NonNull final V second,
|
||||
@NonNull final W third,
|
||||
@NonNull final X fourth,
|
||||
@NonNull final Y fifth) {
|
||||
return new Quintet<>(first, second, third, fourth, fifth);
|
||||
}
|
||||
|
||||
|
|
@ -89,8 +85,7 @@ public class Quintet<U, V, W, X, Y> implements Tuple {
|
|||
*
|
||||
* @return First value
|
||||
*/
|
||||
@Nonnull
|
||||
public final U getFirst() {
|
||||
public final @NonNull U getFirst() {
|
||||
return this.first;
|
||||
}
|
||||
|
||||
|
|
@ -99,8 +94,7 @@ public class Quintet<U, V, W, X, Y> implements Tuple {
|
|||
*
|
||||
* @return Second value
|
||||
*/
|
||||
@Nonnull
|
||||
public final V getSecond() {
|
||||
public final @NonNull V getSecond() {
|
||||
return this.second;
|
||||
}
|
||||
|
||||
|
|
@ -109,8 +103,7 @@ public class Quintet<U, V, W, X, Y> implements Tuple {
|
|||
*
|
||||
* @return Third value
|
||||
*/
|
||||
@Nonnull
|
||||
public final W getThird() {
|
||||
public final @NonNull W getThird() {
|
||||
return this.third;
|
||||
}
|
||||
|
||||
|
|
@ -119,8 +112,7 @@ public class Quintet<U, V, W, X, Y> implements Tuple {
|
|||
*
|
||||
* @return Fourth value
|
||||
*/
|
||||
@Nonnull
|
||||
public final X getFourth() {
|
||||
public final @NonNull X getFourth() {
|
||||
return this.fourth;
|
||||
}
|
||||
|
||||
|
|
@ -129,8 +121,7 @@ public class Quintet<U, V, W, X, Y> implements Tuple {
|
|||
*
|
||||
* @return Fifth value
|
||||
*/
|
||||
@Nonnull
|
||||
public final Y getFifth() {
|
||||
public final @NonNull Y getFifth() {
|
||||
return this.fifth;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -23,7 +23,8 @@
|
|||
//
|
||||
package cloud.commandframework.types.tuples;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
|
|
@ -38,25 +39,19 @@ import java.util.Objects;
|
|||
*/
|
||||
public class Sextet<U, V, W, X, Y, Z> implements Tuple {
|
||||
|
||||
@Nonnull
|
||||
private final U first;
|
||||
@Nonnull
|
||||
private final V second;
|
||||
@Nonnull
|
||||
private final W third;
|
||||
@Nonnull
|
||||
private final X fourth;
|
||||
@Nonnull
|
||||
private final Y fifth;
|
||||
@Nonnull
|
||||
private final Z sixth;
|
||||
|
||||
protected Sextet(@Nonnull final U first,
|
||||
@Nonnull final V second,
|
||||
@Nonnull final W third,
|
||||
@Nonnull final X fourth,
|
||||
@Nonnull final Y fifth,
|
||||
@Nonnull final Z sixth) {
|
||||
protected Sextet(@NonNull final U first,
|
||||
@NonNull final V second,
|
||||
@NonNull final W third,
|
||||
@NonNull final X fourth,
|
||||
@NonNull final Y fifth,
|
||||
@NonNull final Z sixth) {
|
||||
this.first = first;
|
||||
this.second = second;
|
||||
this.third = third;
|
||||
|
|
@ -82,13 +77,13 @@ public class Sextet<U, V, W, X, Y, Z> implements Tuple {
|
|||
* @param <Z> Sixth type
|
||||
* @return Created sextet
|
||||
*/
|
||||
@Nonnull
|
||||
public static <U, V, W, X, Y, Z> Sextet<U, V, W, X, Y, Z> of(@Nonnull final U first,
|
||||
@Nonnull final V second,
|
||||
@Nonnull final W third,
|
||||
@Nonnull final X fourth,
|
||||
@Nonnull final Y fifth,
|
||||
@Nonnull final Z sixth) {
|
||||
public static <U, V, W, X, Y, Z> @NonNull Sextet<@NonNull U, @NonNull V, @NonNull W, @NonNull X, @NonNull Y, @NonNull Z> of(
|
||||
@NonNull final U first,
|
||||
@NonNull final V second,
|
||||
@NonNull final W third,
|
||||
@NonNull final X fourth,
|
||||
@NonNull final Y fifth,
|
||||
@NonNull final Z sixth) {
|
||||
return new Sextet<>(first, second, third, fourth, fifth, sixth);
|
||||
}
|
||||
|
||||
|
|
@ -97,8 +92,7 @@ public class Sextet<U, V, W, X, Y, Z> implements Tuple {
|
|||
*
|
||||
* @return First value
|
||||
*/
|
||||
@Nonnull
|
||||
public final U getFirst() {
|
||||
public final @NonNull U getFirst() {
|
||||
return this.first;
|
||||
}
|
||||
|
||||
|
|
@ -107,8 +101,7 @@ public class Sextet<U, V, W, X, Y, Z> implements Tuple {
|
|||
*
|
||||
* @return Second value
|
||||
*/
|
||||
@Nonnull
|
||||
public final V getSecond() {
|
||||
public final @NonNull V getSecond() {
|
||||
return this.second;
|
||||
}
|
||||
|
||||
|
|
@ -117,8 +110,7 @@ public class Sextet<U, V, W, X, Y, Z> implements Tuple {
|
|||
*
|
||||
* @return Third value
|
||||
*/
|
||||
@Nonnull
|
||||
public final W getThird() {
|
||||
public final @NonNull W getThird() {
|
||||
return this.third;
|
||||
}
|
||||
|
||||
|
|
@ -127,8 +119,7 @@ public class Sextet<U, V, W, X, Y, Z> implements Tuple {
|
|||
*
|
||||
* @return Fourth value
|
||||
*/
|
||||
@Nonnull
|
||||
public final X getFourth() {
|
||||
public final @NonNull X getFourth() {
|
||||
return this.fourth;
|
||||
}
|
||||
|
||||
|
|
@ -137,8 +128,7 @@ public class Sextet<U, V, W, X, Y, Z> implements Tuple {
|
|||
*
|
||||
* @return Fifth value
|
||||
*/
|
||||
@Nonnull
|
||||
public final Y getFifth() {
|
||||
public final @NonNull Y getFifth() {
|
||||
return this.fifth;
|
||||
}
|
||||
|
||||
|
|
@ -147,8 +137,7 @@ public class Sextet<U, V, W, X, Y, Z> implements Tuple {
|
|||
*
|
||||
* @return Sixth value
|
||||
*/
|
||||
@Nonnull
|
||||
public final Z getSixth() {
|
||||
public final @NonNull Z getSixth() {
|
||||
return this.sixth;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -23,7 +23,8 @@
|
|||
//
|
||||
package cloud.commandframework.types.tuples;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
|
|
@ -35,16 +36,13 @@ import java.util.Objects;
|
|||
*/
|
||||
public class Triplet<U, V, W> implements Tuple {
|
||||
|
||||
@Nonnull
|
||||
private final U first;
|
||||
@Nonnull
|
||||
private final V second;
|
||||
@Nonnull
|
||||
private final W third;
|
||||
|
||||
protected Triplet(@Nonnull final U first,
|
||||
@Nonnull final V second,
|
||||
@Nonnull final W third) {
|
||||
protected Triplet(@NonNull final U first,
|
||||
@NonNull final V second,
|
||||
@NonNull final W third) {
|
||||
this.first = first;
|
||||
this.second = second;
|
||||
this.third = third;
|
||||
|
|
@ -61,10 +59,9 @@ public class Triplet<U, V, W> implements Tuple {
|
|||
* @param <W> Third type
|
||||
* @return Created triplet
|
||||
*/
|
||||
@Nonnull
|
||||
public static <U, V, W> Triplet<U, V, W> of(@Nonnull final U first,
|
||||
@Nonnull final V second,
|
||||
@Nonnull final W third) {
|
||||
public static <U, V, W> @NonNull Triplet<@NonNull U, @NonNull V, @NonNull W> of(@NonNull final U first,
|
||||
@NonNull final V second,
|
||||
@NonNull final W third) {
|
||||
return new Triplet<>(first, second, third);
|
||||
}
|
||||
|
||||
|
|
@ -73,8 +70,7 @@ public class Triplet<U, V, W> implements Tuple {
|
|||
*
|
||||
* @return First value
|
||||
*/
|
||||
@Nonnull
|
||||
public final U getFirst() {
|
||||
public final @NonNull U getFirst() {
|
||||
return this.first;
|
||||
}
|
||||
|
||||
|
|
@ -83,8 +79,7 @@ public class Triplet<U, V, W> implements Tuple {
|
|||
*
|
||||
* @return Second value
|
||||
*/
|
||||
@Nonnull
|
||||
public final V getSecond() {
|
||||
public final @NonNull V getSecond() {
|
||||
return this.second;
|
||||
}
|
||||
|
||||
|
|
@ -93,8 +88,7 @@ public class Triplet<U, V, W> implements Tuple {
|
|||
*
|
||||
* @return Third value
|
||||
*/
|
||||
@Nonnull
|
||||
public final W getThird() {
|
||||
public final @NonNull W getThird() {
|
||||
return this.third;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,147 +0,0 @@
|
|||
//
|
||||
// MIT License
|
||||
//
|
||||
// Copyright (c) 2020 Alexander Söderberg & Contributors
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
//
|
||||
package cloud.commandframework.types.tuples;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
/**
|
||||
* Utility class for dealing with tuples
|
||||
*/
|
||||
public final class Tuples {
|
||||
|
||||
static final int SIZE_PAIR = 2;
|
||||
static final int SIZE_TRIPLET = 3;
|
||||
static final int SIZE_QUARTET = 4;
|
||||
static final int SIZE_QUINTET = 5;
|
||||
static final int SIZE_SEXTET = 6;
|
||||
|
||||
private Tuples() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new pair
|
||||
*
|
||||
* @param first First value
|
||||
* @param second Second value
|
||||
* @param <U> First type
|
||||
* @param <V> Second type
|
||||
* @return Created pair
|
||||
*/
|
||||
@Nonnull
|
||||
public static <U, V> Pair<U, V> of(@Nonnull final U first,
|
||||
@Nonnull final V second) {
|
||||
return Pair.of(first, second);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new triplet
|
||||
*
|
||||
* @param first First value
|
||||
* @param second Second value
|
||||
* @param third Third value
|
||||
* @param <U> First type
|
||||
* @param <V> Second type
|
||||
* @param <W> Third type
|
||||
* @return Created triplet
|
||||
*/
|
||||
@Nonnull
|
||||
public static <U, V, W> Triplet<U, V, W> of(@Nonnull final U first,
|
||||
@Nonnull final V second,
|
||||
@Nonnull final W third) {
|
||||
return Triplet.of(first, second, third);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new quartet
|
||||
*
|
||||
* @param first First value
|
||||
* @param second Second value
|
||||
* @param third Third value
|
||||
* @param fourth Fourth value
|
||||
* @param <U> First type
|
||||
* @param <V> Second type
|
||||
* @param <W> Third type
|
||||
* @param <X> Fourth type
|
||||
* @return Created quartet
|
||||
*/
|
||||
@Nonnull
|
||||
public static <U, V, W, X> Quartet<U, V, W, X> of(@Nonnull final U first,
|
||||
@Nonnull final V second,
|
||||
@Nonnull final W third,
|
||||
@Nonnull final X fourth) {
|
||||
return Quartet.of(first, second, third, fourth);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new quintet
|
||||
*
|
||||
* @param first First value
|
||||
* @param second Second value
|
||||
* @param third Third value
|
||||
* @param fourth Fourth value
|
||||
* @param fifth Fifth value
|
||||
* @param <U> First type
|
||||
* @param <V> Second type
|
||||
* @param <W> Third type
|
||||
* @param <X> Fourth type
|
||||
* @param <Y> Fifth type
|
||||
* @return Created quintet
|
||||
*/
|
||||
@Nonnull
|
||||
public static <U, V, W, X, Y> Quintet<U, V, W, X, Y> of(@Nonnull final U first,
|
||||
@Nonnull final V second,
|
||||
@Nonnull final W third,
|
||||
@Nonnull final X fourth,
|
||||
@Nonnull final Y fifth) {
|
||||
return Quintet.of(first, second, third, fourth, fifth);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new sextet
|
||||
*
|
||||
* @param first First value
|
||||
* @param second Second value
|
||||
* @param third Third value
|
||||
* @param fourth Fourth value
|
||||
* @param fifth Fifth value
|
||||
* @param sixth Sixth value
|
||||
* @param <U> First type
|
||||
* @param <V> Second type
|
||||
* @param <W> Third type
|
||||
* @param <X> Fourth type
|
||||
* @param <Y> Fifth type
|
||||
* @param <Z> Sixth type
|
||||
* @return Created sextet
|
||||
*/
|
||||
@Nonnull
|
||||
public static <U, V, W, X, Y, Z> Sextet<U, V, W, X, Y, Z> of(@Nonnull final U first,
|
||||
@Nonnull final V second,
|
||||
@Nonnull final W third,
|
||||
@Nonnull final X fourth,
|
||||
@Nonnull final Y fifth,
|
||||
@Nonnull final Z sixth) {
|
||||
return Sextet.of(first, second, third, fourth, fifth, sixth);
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue