From e4353e489fccb7b8592442c53445fb3eb6891bd6 Mon Sep 17 00:00:00 2001 From: Brady Date: Sat, 21 Sep 2019 17:11:15 -0500 Subject: [PATCH] Get rid of default implementation of IArgParser --- .../utils/command/argparser/ArgParser.java | 54 ------- .../command/argparser/ArgParserManager.java | 32 ++-- .../command/argparser/DefaultArgParsers.java | 49 +++--- .../utils/command/argparser/IArgParser.java | 4 +- .../command/argument/CommandArgument.java | 11 +- .../utils/command/datatypes/IDatatype.java | 4 +- .../helpers/arguments/ArgConsumer.java | 140 +++++++++--------- 7 files changed, 120 insertions(+), 174 deletions(-) delete mode 100644 src/api/java/baritone/api/utils/command/argparser/ArgParser.java diff --git a/src/api/java/baritone/api/utils/command/argparser/ArgParser.java b/src/api/java/baritone/api/utils/command/argparser/ArgParser.java deleted file mode 100644 index 6fcd5468..00000000 --- a/src/api/java/baritone/api/utils/command/argparser/ArgParser.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * This file is part of Baritone. - * - * Baritone is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Baritone is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Baritone. If not, see . - */ - -package baritone.api.utils.command.argparser; - -public abstract class ArgParser implements IArgParser { - - private final Class target; - - private ArgParser(Class target) { - this.target = target; - } - - @Override - public Class getTarget() { - return target; - } - - public static abstract class Stateless extends ArgParser implements IArgParser.Stateless { - - public Stateless(Class target) { - super(target); - } - } - - public static abstract class Stated extends ArgParser implements IArgParser.Stated { - - private final Class stateType; - - protected Stated(Class target, Class stateType) { - super(target); - this.stateType = stateType; - } - - @Override - public Class getStateType() { - return stateType; - } - } -} diff --git a/src/api/java/baritone/api/utils/command/argparser/ArgParserManager.java b/src/api/java/baritone/api/utils/command/argparser/ArgParserManager.java index 447e8f1b..24f5fec0 100644 --- a/src/api/java/baritone/api/utils/command/argparser/ArgParserManager.java +++ b/src/api/java/baritone/api/utils/command/argparser/ArgParserManager.java @@ -25,7 +25,7 @@ import baritone.api.utils.command.registry.Registry; public class ArgParserManager { - public static final Registry REGISTRY = new Registry<>(); + public static final Registry REGISTRY = new Registry<>(); static { DefaultArgParsers.ALL.forEach(REGISTRY::register); @@ -35,11 +35,11 @@ public class ArgParserManager { * @param type The type trying to be parsed * @return A parser that can parse arguments into this class, if found. */ - public static ArgParser.Stateless getParserStateless(Class type) { + public static IArgParser.Stateless getParserStateless(Class type) { //noinspection unchecked return REGISTRY.descendingStream() - .filter(ArgParser.Stateless.class::isInstance) - .map(ArgParser.Stateless.class::cast) + .filter(IArgParser.Stateless.class::isInstance) + .map(IArgParser.Stateless.class::cast) .filter(parser -> parser.getTarget().isAssignableFrom(type)) .findFirst() .orElse(null); @@ -49,20 +49,20 @@ public class ArgParserManager { * @param type The type trying to be parsed * @return A parser that can parse arguments into this class, if found. */ - public static ArgParser.Stated getParserStated(Class type, Class stateKlass) { + public static IArgParser.Stated getParserStated(Class type, Class stateKlass) { //noinspection unchecked return REGISTRY.descendingStream() - .filter(ArgParser.Stated.class::isInstance) - .map(ArgParser.Stated.class::cast) + .filter(IArgParser.Stated.class::isInstance) + .map(IArgParser.Stated.class::cast) .filter(parser -> parser.getTarget().isAssignableFrom(type)) .filter(parser -> parser.getStateType().isAssignableFrom(stateKlass)) - .map(ArgParser.Stated.class::cast) + .map(IArgParser.Stated.class::cast) .findFirst() .orElse(null); } /** - * Attempt to parse the specified argument with a stateless {@link ArgParser} that outputs the specified class. + * Attempt to parse the specified argument with a stateless {@link IArgParser} that outputs the specified class. * * @param type The type to try and parse the argument into. * @param arg The argument to parse. @@ -70,37 +70,37 @@ public class ArgParserManager { * @throws CommandInvalidTypeException If the parsing failed */ public static T parseStateless(Class type, CommandArgument arg) throws CommandInvalidTypeException { - ArgParser.Stateless parser = getParserStateless(type); + IArgParser.Stateless parser = getParserStateless(type); if (parser == null) { // TODO: Fix this scuff lol throw new CommandUnhandledException(new CommandNoParserForTypeException(type)); } try { return parser.parseArg(arg); - } catch (RuntimeException exc) { + } catch (Exception exc) { throw new CommandInvalidTypeException(arg, type.getSimpleName()); } } /** - * Attempt to parse the specified argument with a stated {@link ArgParser} that outputs the specified class. + * Attempt to parse the specified argument with a stated {@link IArgParser} that outputs the specified class. * * @param type The type to try and parse the argument into. * @param arg The argument to parse. - * @param state The state to pass to the {@link ArgParser.Stated}. + * @param state The state to pass to the {@link IArgParser.Stated}. * @return An instance of the specified class. * @throws CommandInvalidTypeException If the parsing failed - * @see ArgParser.Stated + * @see IArgParser.Stated */ public static T parseStated(Class type, Class stateKlass, CommandArgument arg, S state) throws CommandInvalidTypeException { - ArgParser.Stated parser = getParserStated(type, stateKlass); + IArgParser.Stated parser = getParserStated(type, stateKlass); if (parser == null) { // TODO: Fix this scuff lol throw new CommandUnhandledException(new CommandNoParserForTypeException(type)); } try { return parser.parseArg(arg, state); - } catch (RuntimeException exc) { + } catch (Exception exc) { throw new CommandInvalidTypeException(arg, type.getSimpleName()); } } diff --git a/src/api/java/baritone/api/utils/command/argparser/DefaultArgParsers.java b/src/api/java/baritone/api/utils/command/argparser/DefaultArgParsers.java index 35110999..c33f61fb 100644 --- a/src/api/java/baritone/api/utils/command/argparser/DefaultArgParsers.java +++ b/src/api/java/baritone/api/utils/command/argparser/DefaultArgParsers.java @@ -25,12 +25,12 @@ import java.util.Locale; public class DefaultArgParsers { - public static class IntArgumentParser extends ArgParser.Stateless { + public enum IntArgumentParser implements IArgParser.Stateless { + INSTANCE; - public static final IntArgumentParser INSTANCE = new IntArgumentParser(); - - public IntArgumentParser() { - super(Integer.class); + @Override + public Class getTarget() { + return Integer.class; } @Override @@ -39,12 +39,12 @@ public class DefaultArgParsers { } } - public static class LongArgumentParser extends ArgParser.Stateless { + public enum LongArgumentParser implements IArgParser.Stateless { + INSTANCE; - public static final LongArgumentParser INSTANCE = new LongArgumentParser(); - - public LongArgumentParser() { - super(Long.class); + @Override + public Class getTarget() { + return Long.class; } @Override @@ -53,12 +53,12 @@ public class DefaultArgParsers { } } - public static class FloatArgumentParser extends ArgParser.Stateless { + public enum FloatArgumentParser implements IArgParser.Stateless { + INSTANCE; - public static final FloatArgumentParser INSTANCE = new FloatArgumentParser(); - - public FloatArgumentParser() { - super(Float.class); + @Override + public Class getTarget() { + return Float.class; } @Override @@ -71,12 +71,12 @@ public class DefaultArgParsers { } } - public static class DoubleArgumentParser extends ArgParser.Stateless { + public enum DoubleArgumentParser implements IArgParser.Stateless { + INSTANCE; - public static final DoubleArgumentParser INSTANCE = new DoubleArgumentParser(); - - public DoubleArgumentParser() { - super(Double.class); + @Override + public Class getTarget() { + return Double.class; } @Override @@ -89,14 +89,15 @@ public class DefaultArgParsers { } } - public static class BooleanArgumentParser extends ArgParser.Stateless { + public static class BooleanArgumentParser implements IArgParser.Stateless { public static final BooleanArgumentParser INSTANCE = new BooleanArgumentParser(); public static final List TRUTHY_VALUES = Arrays.asList("1", "true", "yes", "t", "y", "on", "enable"); public static final List FALSY_VALUES = Arrays.asList("0", "false", "no", "f", "n", "off", "disable"); - public BooleanArgumentParser() { - super(Boolean.class); + @Override + public Class getTarget() { + return Boolean.class; } @Override @@ -112,7 +113,7 @@ public class DefaultArgParsers { } } - public static final List> ALL = Arrays.asList( + public static final List> ALL = Arrays.asList( IntArgumentParser.INSTANCE, LongArgumentParser.INSTANCE, FloatArgumentParser.INSTANCE, diff --git a/src/api/java/baritone/api/utils/command/argparser/IArgParser.java b/src/api/java/baritone/api/utils/command/argparser/IArgParser.java index 568955af..09e2aa2e 100644 --- a/src/api/java/baritone/api/utils/command/argparser/IArgParser.java +++ b/src/api/java/baritone/api/utils/command/argparser/IArgParser.java @@ -39,7 +39,7 @@ public interface IArgParser { * @throws RuntimeException if you want the parsing to fail. The exception will be caught and turned into an * appropriate error. */ - T parseArg(CommandArgument arg) throws RuntimeException; + T parseArg(CommandArgument arg) throws Exception; } /** @@ -59,6 +59,6 @@ public interface IArgParser { * @throws RuntimeException if you want the parsing to fail. The exception will be caught and turned into an * appropriate error. */ - T parseArg(CommandArgument arg, S state) throws RuntimeException; + T parseArg(CommandArgument arg, S state) throws Exception; } } diff --git a/src/api/java/baritone/api/utils/command/argument/CommandArgument.java b/src/api/java/baritone/api/utils/command/argument/CommandArgument.java index 2914f707..ccffadf5 100644 --- a/src/api/java/baritone/api/utils/command/argument/CommandArgument.java +++ b/src/api/java/baritone/api/utils/command/argument/CommandArgument.java @@ -17,11 +17,10 @@ package baritone.api.utils.command.argument; -import baritone.api.utils.command.argparser.ArgParser; import baritone.api.utils.command.argparser.ArgParserManager; +import baritone.api.utils.command.argparser.IArgParser; import baritone.api.utils.command.exception.CommandInvalidArgumentException; import baritone.api.utils.command.exception.CommandInvalidTypeException; -import baritone.api.utils.command.exception.CommandNoParserForTypeException; import baritone.api.utils.command.helpers.arguments.ArgConsumer; import net.minecraft.util.EnumFacing; @@ -74,7 +73,7 @@ public class CommandArgument { } /** - * Tries to use a stateless {@link ArgParser} to parse this argument into the specified class + * Tries to use a stateless {@link IArgParser} to parse this argument into the specified class * * @param type The class to parse this argument into * @return An instance of the specified type @@ -85,7 +84,7 @@ public class CommandArgument { } /** - * Tries to use a stateless {@link ArgParser} to parse this argument into the specified class + * Tries to use a stateless {@link IArgParser} to parse this argument into the specified class * * @param type The class to parse this argument into * @return If the parser succeeded @@ -100,7 +99,7 @@ public class CommandArgument { } /** - * Tries to use a stated {@link ArgParser} to parse this argument into the specified class + * Tries to use a stated {@link IArgParser} to parse this argument into the specified class * * @param type The class to parse this argument into * @return An instance of the specified type @@ -112,7 +111,7 @@ public class CommandArgument { } /** - * Tries to use a stated {@link ArgParser} to parse this argument into the specified class + * Tries to use a stated {@link IArgParser} to parse this argument into the specified class * * @param type The class to parse this argument into * @return If the parser succeeded diff --git a/src/api/java/baritone/api/utils/command/datatypes/IDatatype.java b/src/api/java/baritone/api/utils/command/datatypes/IDatatype.java index a3cf07a4..0ed74d7d 100644 --- a/src/api/java/baritone/api/utils/command/datatypes/IDatatype.java +++ b/src/api/java/baritone/api/utils/command/datatypes/IDatatype.java @@ -17,7 +17,7 @@ package baritone.api.utils.command.datatypes; -import baritone.api.utils.command.argparser.ArgParser; +import baritone.api.utils.command.argparser.IArgParser; import baritone.api.utils.command.exception.CommandException; import baritone.api.utils.command.exception.CommandInvalidArgumentException; import baritone.api.utils.command.helpers.arguments.ArgConsumer; @@ -34,7 +34,7 @@ import java.util.stream.Stream; public interface IDatatype { /** - * One benefit over datatypes over {@link ArgParser}s is that instead of each command trying to guess what values + * One benefit over datatypes over {@link IArgParser}s is that instead of each command trying to guess what values * the datatype will accept, or simply not tab completing at all, datatypes that support tab completion can provide * accurate information using the same methods used to parse arguments in the first place. *

diff --git a/src/api/java/baritone/api/utils/command/helpers/arguments/ArgConsumer.java b/src/api/java/baritone/api/utils/command/helpers/arguments/ArgConsumer.java index 55df9866..a8c55721 100644 --- a/src/api/java/baritone/api/utils/command/helpers/arguments/ArgConsumer.java +++ b/src/api/java/baritone/api/utils/command/helpers/arguments/ArgConsumer.java @@ -19,7 +19,7 @@ package baritone.api.utils.command.helpers.arguments; import baritone.api.utils.Helper; import baritone.api.utils.command.Command; -import baritone.api.utils.command.argparser.ArgParser; +import baritone.api.utils.command.argparser.IArgParser; import baritone.api.utils.command.argument.CommandArgument; import baritone.api.utils.command.datatypes.IDatatype; import baritone.api.utils.command.datatypes.IDatatypeFor; @@ -269,18 +269,18 @@ public class ArgConsumer { } /** - * Tries to use a stateless {@link ArgParser} to parse the argument at the specified index into the specified + * Tries to use a stateless {@link IArgParser} to parse the argument at the specified index into the specified * class *

- * A critical difference between {@link IDatatype}s and {@link ArgParser}s is how many arguments they can take. - * While {@link ArgParser}s always operate on a single argument's value, {@link IDatatype}s get access to the entire + * A critical difference between {@link IDatatype}s and {@link IArgParser}s is how many arguments they can take. + * While {@link IArgParser}s always operate on a single argument's value, {@link IDatatype}s get access to the entire * {@link ArgConsumer}. * * @param type The type to peek as * @param index The index to peek * @return An instance of the specified type * @throws CommandInvalidTypeException If the parsing failed - * @see ArgParser + * @see IArgParser * @see #peekAs(Class) * @see #peekAsOrDefault(Class, Object, int) * @see #peekAsOrNull(Class, int) @@ -290,16 +290,16 @@ public class ArgConsumer { } /** - * Tries to use a stateless {@link ArgParser} to parse the next argument into the specified class + * Tries to use a stateless {@link IArgParser} to parse the next argument into the specified class *

- * A critical difference between {@link IDatatype}s and {@link ArgParser}s is how many arguments they can take. - * While {@link ArgParser}s always operate on a single argument's value, {@link IDatatype}s get access to the entire + * A critical difference between {@link IDatatype}s and {@link IArgParser}s is how many arguments they can take. + * While {@link IArgParser}s always operate on a single argument's value, {@link IDatatype}s get access to the entire * {@link ArgConsumer}. * * @param type The type to peek as * @return An instance of the specified type * @throws CommandInvalidTypeException If the parsing failed - * @see ArgParser + * @see IArgParser * @see #peekAs(Class, int) * @see #peekAsOrDefault(Class, Object) * @see #peekAsOrNull(Class) @@ -309,18 +309,18 @@ public class ArgConsumer { } /** - * Tries to use a stateless {@link ArgParser} to parse the argument at the specified index into the specified + * Tries to use a stateless {@link IArgParser} to parse the argument at the specified index into the specified * class *

- * A critical difference between {@link IDatatype}s and {@link ArgParser}s is how many arguments they can take. - * While {@link ArgParser}s always operate on a single argument's value, {@link IDatatype}s get access to the entire + * A critical difference between {@link IDatatype}s and {@link IArgParser}s is how many arguments they can take. + * While {@link IArgParser}s always operate on a single argument's value, {@link IDatatype}s get access to the entire * {@link ArgConsumer}. * * @param type The type to peek as * @param def The value to return if the argument can't be parsed * @param index The index to peek * @return An instance of the specified type, or {@code def} if it couldn't be parsed - * @see ArgParser + * @see IArgParser * @see #peekAsOrDefault(Class, Object) * @see #peekAs(Class, int) * @see #peekAsOrNull(Class, int) @@ -334,16 +334,16 @@ public class ArgConsumer { } /** - * Tries to use a stateless {@link ArgParser} to parse the next argument into the specified class + * Tries to use a stateless {@link IArgParser} to parse the next argument into the specified class *

- * A critical difference between {@link IDatatype}s and {@link ArgParser}s is how many arguments they can take. - * While {@link ArgParser}s always operate on a single argument's value, {@link IDatatype}s get access to the entire + * A critical difference between {@link IDatatype}s and {@link IArgParser}s is how many arguments they can take. + * While {@link IArgParser}s always operate on a single argument's value, {@link IDatatype}s get access to the entire * {@link ArgConsumer}. * * @param type The type to peek as * @param def The value to return if the argument can't be parsed * @return An instance of the specified type, or {@code def} if it couldn't be parsed - * @see ArgParser + * @see IArgParser * @see #peekAsOrDefault(Class, Object, int) * @see #peekAs(Class) * @see #peekAsOrNull(Class) @@ -353,17 +353,17 @@ public class ArgConsumer { } /** - * Tries to use a stateless {@link ArgParser} to parse the argument at the specified index into the specified + * Tries to use a stateless {@link IArgParser} to parse the argument at the specified index into the specified * class *

- * A critical difference between {@link IDatatype}s and {@link ArgParser}s is how many arguments they can take. - * While {@link ArgParser}s always operate on a single argument's value, {@link IDatatype}s get access to the entire + * A critical difference between {@link IDatatype}s and {@link IArgParser}s is how many arguments they can take. + * While {@link IArgParser}s always operate on a single argument's value, {@link IDatatype}s get access to the entire * {@link ArgConsumer}. * * @param type The type to peek as * @param index The index to peek * @return An instance of the specified type, or {@code null} if it couldn't be parsed - * @see ArgParser + * @see IArgParser * @see #peekAsOrNull(Class) * @see #peekAs(Class, int) * @see #peekAsOrDefault(Class, Object, int) @@ -373,15 +373,15 @@ public class ArgConsumer { } /** - * Tries to use a stateless {@link ArgParser} to parse the next argument into the specified class + * Tries to use a stateless {@link IArgParser} to parse the next argument into the specified class *

- * A critical difference between {@link IDatatype}s and {@link ArgParser}s is how many arguments they can take. - * While {@link ArgParser}s always operate on a single argument's value, {@link IDatatype}s get access to the entire + * A critical difference between {@link IDatatype}s and {@link IArgParser}s is how many arguments they can take. + * While {@link IArgParser}s always operate on a single argument's value, {@link IDatatype}s get access to the entire * {@link ArgConsumer}. * * @param type The type to peek as * @return An instance of the specified type, or {@code null} if it couldn't be parsed - * @see ArgParser + * @see IArgParser * @see #peekAsOrNull(Class, int) * @see #peekAs(Class) * @see #peekAsOrDefault(Class, Object) @@ -393,8 +393,8 @@ public class ArgConsumer { /** * Attempts to get the specified datatype from this ArgConsumer *

- * A critical difference between {@link IDatatype}s and {@link ArgParser}s is how many arguments they can take. - * While {@link ArgParser}s always operate on a single argument's value, {@link IDatatype}s get access to the entire + * A critical difference between {@link IDatatype}s and {@link IArgParser}s is how many arguments they can take. + * While {@link IArgParser}s always operate on a single argument's value, {@link IDatatype}s get access to the entire * {@link ArgConsumer}. *

* Since this is a peek operation, this ArgConsumer will not be mutated by any call to this method. @@ -410,8 +410,8 @@ public class ArgConsumer { /** * Attempts to get the specified datatype from this ArgConsumer *

- * A critical difference between {@link IDatatype}s and {@link ArgParser}s is how many arguments they can take. - * While {@link ArgParser}s always operate on a single argument's value, {@link IDatatype}s get access to the entire + * A critical difference between {@link IDatatype}s and {@link IArgParser}s is how many arguments they can take. + * While {@link IArgParser}s always operate on a single argument's value, {@link IDatatype}s get access to the entire * {@link ArgConsumer}. *

* Since this is a peek operation, this ArgConsumer will not be mutated by any call to this method. @@ -427,8 +427,8 @@ public class ArgConsumer { /** * Attempts to get the specified {@link IDatatypePost} from this ArgConsumer *

- * A critical difference between {@link IDatatype}s and {@link ArgParser}s is how many arguments they can take. - * While {@link ArgParser}s always operate on a single argument's value, {@link IDatatype}s get access to the entire + * A critical difference between {@link IDatatype}s and {@link IArgParser}s is how many arguments they can take. + * While {@link IArgParser}s always operate on a single argument's value, {@link IDatatype}s get access to the entire * {@link ArgConsumer}. *

* Since this is a peek operation, this ArgConsumer will not be mutated by any call to this method. @@ -445,8 +445,8 @@ public class ArgConsumer { /** * Attempts to get the specified {@link IDatatypePost} from this ArgConsumer *

- * A critical difference between {@link IDatatype}s and {@link ArgParser}s is how many arguments they can take. - * While {@link ArgParser}s always operate on a single argument's value, {@link IDatatype}s get access to the entire + * A critical difference between {@link IDatatype}s and {@link IArgParser}s is how many arguments they can take. + * While {@link IArgParser}s always operate on a single argument's value, {@link IDatatype}s get access to the entire * {@link ArgConsumer}. *

* Since this is a peek operation, this ArgConsumer will not be mutated by any call to this method. @@ -464,8 +464,8 @@ public class ArgConsumer { /** * Attempts to get the specified {@link IDatatypePost} from this ArgConsumer *

- * A critical difference between {@link IDatatype}s and {@link ArgParser}s is how many arguments they can take. - * While {@link ArgParser}s always operate on a single argument's value, {@link IDatatype}s get access to the entire + * A critical difference between {@link IDatatype}s and {@link IArgParser}s is how many arguments they can take. + * While {@link IArgParser}s always operate on a single argument's value, {@link IDatatype}s get access to the entire * {@link ArgConsumer}. *

* Since this is a peek operation, this ArgConsumer will not be mutated by any call to this method. @@ -482,8 +482,8 @@ public class ArgConsumer { /** * Attempts to get the specified {@link IDatatypeFor} from this ArgConsumer *

- * A critical difference between {@link IDatatype}s and {@link ArgParser}s is how many arguments they can take. - * While {@link ArgParser}s always operate on a single argument's value, {@link IDatatype}s get access to the entire + * A critical difference between {@link IDatatype}s and {@link IArgParser}s is how many arguments they can take. + * While {@link IArgParser}s always operate on a single argument's value, {@link IDatatype}s get access to the entire * {@link ArgConsumer}. *

* Since this is a peek operation, this ArgConsumer will not be mutated by any call to this method. @@ -500,8 +500,8 @@ public class ArgConsumer { /** * Attempts to get the specified {@link IDatatypeFor} from this ArgConsumer *

- * A critical difference between {@link IDatatype}s and {@link ArgParser}s is how many arguments they can take. - * While {@link ArgParser}s always operate on a single argument's value, {@link IDatatype}s get access to the entire + * A critical difference between {@link IDatatype}s and {@link IArgParser}s is how many arguments they can take. + * While {@link IArgParser}s always operate on a single argument's value, {@link IDatatype}s get access to the entire * {@link ArgConsumer}. *

* Since this is a peek operation, this ArgConsumer will not be mutated by any call to this method. @@ -519,8 +519,8 @@ public class ArgConsumer { /** * Attempts to get the specified {@link IDatatypeFor} from this ArgConsumer *

- * A critical difference between {@link IDatatype}s and {@link ArgParser}s is how many arguments they can take. - * While {@link ArgParser}s always operate on a single argument's value, {@link IDatatype}s get access to the entire + * A critical difference between {@link IDatatype}s and {@link IArgParser}s is how many arguments they can take. + * While {@link IArgParser}s always operate on a single argument's value, {@link IDatatype}s get access to the entire * {@link ArgConsumer}. *

* Since this is a peek operation, this ArgConsumer will not be mutated by any call to this method. @@ -619,16 +619,16 @@ public class ArgConsumer { } /** - * Tries to use a stateless {@link ArgParser} to parse the next argument into the specified class + * Tries to use a stateless {@link IArgParser} to parse the next argument into the specified class *

- * A critical difference between {@link IDatatype}s and {@link ArgParser}s is how many arguments they can take. - * While {@link ArgParser}s always operate on a single argument's value, {@link IDatatype}s get access to the entire + * A critical difference between {@link IDatatype}s and {@link IArgParser}s is how many arguments they can take. + * While {@link IArgParser}s always operate on a single argument's value, {@link IDatatype}s get access to the entire * {@link ArgConsumer}. * * @param type The type to peek as * @return An instance of the specified type * @throws CommandInvalidTypeException If the parsing failed - * @see ArgParser + * @see IArgParser * @see #get() * @see #getAsOrDefault(Class, Object) * @see #getAsOrNull(Class) @@ -641,16 +641,16 @@ public class ArgConsumer { } /** - * Tries to use a stateless {@link ArgParser} to parse the next argument into the specified class + * Tries to use a stateless {@link IArgParser} to parse the next argument into the specified class *

- * A critical difference between {@link IDatatype}s and {@link ArgParser}s is how many arguments they can take. - * While {@link ArgParser}s always operate on a single argument's value, {@link IDatatype}s get access to the entire + * A critical difference between {@link IDatatype}s and {@link IArgParser}s is how many arguments they can take. + * While {@link IArgParser}s always operate on a single argument's value, {@link IDatatype}s get access to the entire * {@link ArgConsumer}. * * @param type The type to peek as * @param def The default value * @return An instance of the specified type, or {@code def} if it couldn't be parsed - * @see ArgParser + * @see IArgParser * @see #get() * @see #getAs(Class) * @see #getAsOrNull(Class) @@ -669,15 +669,15 @@ public class ArgConsumer { } /** - * Tries to use a stateless {@link ArgParser} to parse the next argument into the specified class + * Tries to use a stateless {@link IArgParser} to parse the next argument into the specified class *

- * A critical difference between {@link IDatatype}s and {@link ArgParser}s is how many arguments they can take. - * While {@link ArgParser}s always operate on a single argument's value, {@link IDatatype}s get access to the entire + * A critical difference between {@link IDatatype}s and {@link IArgParser}s is how many arguments they can take. + * While {@link IArgParser}s always operate on a single argument's value, {@link IDatatype}s get access to the entire * {@link ArgConsumer}. * * @param type The type to peek as * @return An instance of the specified type, or {@code null} if it couldn't be parsed - * @see ArgParser + * @see IArgParser * @see #get() * @see #getAs(Class) * @see #getAsOrDefault(Class, Object) @@ -692,8 +692,8 @@ public class ArgConsumer { /** * Attempts to get the specified datatype from this ArgConsumer *

- * A critical difference between {@link IDatatype}s and {@link ArgParser}s is how many arguments they can take. - * While {@link ArgParser}s always operate on a single argument's value, {@link IDatatype}s get access to the entire + * A critical difference between {@link IDatatype}s and {@link IArgParser}s is how many arguments they can take. + * While {@link IArgParser}s always operate on a single argument's value, {@link IDatatype}s get access to the entire * {@link ArgConsumer}. * * @param datatype The datatype to get @@ -713,8 +713,8 @@ public class ArgConsumer { /** * Attempts to get the specified datatype from this ArgConsumer *

- * A critical difference between {@link IDatatype}s and {@link ArgParser}s is how many arguments they can take. - * While {@link ArgParser}s always operate on a single argument's value, {@link IDatatype}s get access to the entire + * A critical difference between {@link IDatatype}s and {@link IArgParser}s is how many arguments they can take. + * While {@link IArgParser}s always operate on a single argument's value, {@link IDatatype}s get access to the entire * {@link ArgConsumer}. *

* The state of this {@link ArgConsumer} is restored if the datatype could not be gotten. @@ -740,8 +740,8 @@ public class ArgConsumer { /** * Attempts to get the specified {@link IDatatypePost} from this ArgConsumer *

- * A critical difference between {@link IDatatype}s and {@link ArgParser}s is how many arguments they can take. - * While {@link ArgParser}s always operate on a single argument's value, {@link IDatatype}s get access to the entire + * A critical difference between {@link IDatatype}s and {@link IArgParser}s is how many arguments they can take. + * While {@link IArgParser}s always operate on a single argument's value, {@link IDatatype}s get access to the entire * {@link ArgConsumer}. * * @param datatype The datatype to get @@ -756,8 +756,8 @@ public class ArgConsumer { /** * Attempts to get the specified {@link IDatatypePost} from this ArgConsumer *

- * A critical difference between {@link IDatatype}s and {@link ArgParser}s is how many arguments they can take. - * While {@link ArgParser}s always operate on a single argument's value, {@link IDatatype}s get access to the entire + * A critical difference between {@link IDatatype}s and {@link IArgParser}s is how many arguments they can take. + * While {@link IArgParser}s always operate on a single argument's value, {@link IDatatype}s get access to the entire * {@link ArgConsumer}. *

* The state of this {@link ArgConsumer} is restored if the datatype could not be gotten. @@ -785,8 +785,8 @@ public class ArgConsumer { /** * Attempts to get the specified {@link IDatatypePost} from this ArgConsumer *

- * A critical difference between {@link IDatatype}s and {@link ArgParser}s is how many arguments they can take. - * While {@link ArgParser}s always operate on a single argument's value, {@link IDatatype}s get access to the entire + * A critical difference between {@link IDatatype}s and {@link IArgParser}s is how many arguments they can take. + * While {@link IArgParser}s always operate on a single argument's value, {@link IDatatype}s get access to the entire * {@link ArgConsumer}. *

* The state of this {@link ArgConsumer} is restored if the datatype could not be gotten. @@ -803,8 +803,8 @@ public class ArgConsumer { /** * Attempts to get the specified {@link IDatatypeFor} from this ArgConsumer *

- * A critical difference between {@link IDatatype}s and {@link ArgParser}s is how many arguments they can take. - * While {@link ArgParser}s always operate on a single argument's value, {@link IDatatype}s get access to the entire + * A critical difference between {@link IDatatype}s and {@link IArgParser}s is how many arguments they can take. + * While {@link IArgParser}s always operate on a single argument's value, {@link IDatatype}s get access to the entire * {@link ArgConsumer}. * * @param datatype The datatype to get @@ -819,8 +819,8 @@ public class ArgConsumer { /** * Attempts to get the specified {@link IDatatypeFor} from this ArgConsumer *

- * A critical difference between {@link IDatatype}s and {@link ArgParser}s is how many arguments they can take. - * While {@link ArgParser}s always operate on a single argument's value, {@link IDatatype}s get access to the entire + * A critical difference between {@link IDatatype}s and {@link IArgParser}s is how many arguments they can take. + * While {@link IArgParser}s always operate on a single argument's value, {@link IDatatype}s get access to the entire * {@link ArgConsumer}. *

* The state of this {@link ArgConsumer} is restored if the datatype could not be gotten. @@ -848,8 +848,8 @@ public class ArgConsumer { /** * Attempts to get the specified {@link IDatatypeFor} from this ArgConsumer *

- * A critical difference between {@link IDatatype}s and {@link ArgParser}s is how many arguments they can take. - * While {@link ArgParser}s always operate on a single argument's value, {@link IDatatype}s get access to the entire + * A critical difference between {@link IDatatype}s and {@link IArgParser}s is how many arguments they can take. + * While {@link IArgParser}s always operate on a single argument's value, {@link IDatatype}s get access to the entire * {@link ArgConsumer}. *

* The state of this {@link ArgConsumer} is restored if the datatype could not be gotten. @@ -864,7 +864,7 @@ public class ArgConsumer { } /** - * One benefit over datatypes over {@link ArgParser}s is that instead of each command trying to guess what values + * One benefit over datatypes over {@link IArgParser}s is that instead of each command trying to guess what values * the datatype will accept, or simply not tab completing at all, datatypes that support tab completion can provide * accurate information using the same methods used to parse arguments in the first place. *