Get rid of default implementation of IArgParser

This commit is contained in:
Brady 2019-09-21 17:11:15 -05:00
parent b88af1d682
commit e4353e489f
No known key found for this signature in database
GPG Key ID: 73A788379A197567
7 changed files with 120 additions and 174 deletions

View File

@ -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 <https://www.gnu.org/licenses/>.
*/
package baritone.api.utils.command.argparser;
public abstract class ArgParser<T> implements IArgParser<T> {
private final Class<T> target;
private ArgParser(Class<T> target) {
this.target = target;
}
@Override
public Class<T> getTarget() {
return target;
}
public static abstract class Stateless<T> extends ArgParser<T> implements IArgParser.Stateless<T> {
public Stateless(Class<T> target) {
super(target);
}
}
public static abstract class Stated<T, S> extends ArgParser<T> implements IArgParser.Stated<T, S> {
private final Class<S> stateType;
protected Stated(Class<T> target, Class<S> stateType) {
super(target);
this.stateType = stateType;
}
@Override
public Class<S> getStateType() {
return stateType;
}
}
}

View File

@ -25,7 +25,7 @@ import baritone.api.utils.command.registry.Registry;
public class ArgParserManager {
public static final Registry<ArgParser> REGISTRY = new Registry<>();
public static final Registry<IArgParser> 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 <T> ArgParser.Stateless<T> getParserStateless(Class<T> type) {
public static <T> IArgParser.Stateless<T> getParserStateless(Class<T> 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 <T, S> ArgParser.Stated<T, S> getParserStated(Class<T> type, Class<S> stateKlass) {
public static <T, S> IArgParser.Stated<T, S> getParserStated(Class<T> type, Class<S> 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> T parseStateless(Class<T> type, CommandArgument arg) throws CommandInvalidTypeException {
ArgParser.Stateless<T> parser = getParserStateless(type);
IArgParser.Stateless<T> 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, S> T parseStated(Class<T> type, Class<S> stateKlass, CommandArgument arg, S state) throws CommandInvalidTypeException {
ArgParser.Stated<T, S> parser = getParserStated(type, stateKlass);
IArgParser.Stated<T, S> 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());
}
}

View File

@ -25,12 +25,12 @@ import java.util.Locale;
public class DefaultArgParsers {
public static class IntArgumentParser extends ArgParser.Stateless<Integer> {
public enum IntArgumentParser implements IArgParser.Stateless<Integer> {
INSTANCE;
public static final IntArgumentParser INSTANCE = new IntArgumentParser();
public IntArgumentParser() {
super(Integer.class);
@Override
public Class<Integer> getTarget() {
return Integer.class;
}
@Override
@ -39,12 +39,12 @@ public class DefaultArgParsers {
}
}
public static class LongArgumentParser extends ArgParser.Stateless<Long> {
public enum LongArgumentParser implements IArgParser.Stateless<Long> {
INSTANCE;
public static final LongArgumentParser INSTANCE = new LongArgumentParser();
public LongArgumentParser() {
super(Long.class);
@Override
public Class<Long> getTarget() {
return Long.class;
}
@Override
@ -53,12 +53,12 @@ public class DefaultArgParsers {
}
}
public static class FloatArgumentParser extends ArgParser.Stateless<Float> {
public enum FloatArgumentParser implements IArgParser.Stateless<Float> {
INSTANCE;
public static final FloatArgumentParser INSTANCE = new FloatArgumentParser();
public FloatArgumentParser() {
super(Float.class);
@Override
public Class<Float> getTarget() {
return Float.class;
}
@Override
@ -71,12 +71,12 @@ public class DefaultArgParsers {
}
}
public static class DoubleArgumentParser extends ArgParser.Stateless<Double> {
public enum DoubleArgumentParser implements IArgParser.Stateless<Double> {
INSTANCE;
public static final DoubleArgumentParser INSTANCE = new DoubleArgumentParser();
public DoubleArgumentParser() {
super(Double.class);
@Override
public Class<Double> getTarget() {
return Double.class;
}
@Override
@ -89,14 +89,15 @@ public class DefaultArgParsers {
}
}
public static class BooleanArgumentParser extends ArgParser.Stateless<Boolean> {
public static class BooleanArgumentParser implements IArgParser.Stateless<Boolean> {
public static final BooleanArgumentParser INSTANCE = new BooleanArgumentParser();
public static final List<String> TRUTHY_VALUES = Arrays.asList("1", "true", "yes", "t", "y", "on", "enable");
public static final List<String> FALSY_VALUES = Arrays.asList("0", "false", "no", "f", "n", "off", "disable");
public BooleanArgumentParser() {
super(Boolean.class);
@Override
public Class<Boolean> getTarget() {
return Boolean.class;
}
@Override
@ -112,7 +113,7 @@ public class DefaultArgParsers {
}
}
public static final List<ArgParser<?>> ALL = Arrays.asList(
public static final List<IArgParser<?>> ALL = Arrays.asList(
IntArgumentParser.INSTANCE,
LongArgumentParser.INSTANCE,
FloatArgumentParser.INSTANCE,

View File

@ -39,7 +39,7 @@ public interface IArgParser<T> {
* @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<T> {
* @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;
}
}

View File

@ -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 <b>stateless</b> {@link ArgParser} to parse this argument into the specified class
* Tries to use a <b>stateless</b> {@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 <b>stateless</b> {@link ArgParser} to parse this argument into the specified class
* Tries to use a <b>stateless</b> {@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 <b>stated</b> {@link ArgParser} to parse this argument into the specified class
* Tries to use a <b>stated</b> {@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 <b>stated</b> {@link ArgParser} to parse this argument into the specified class
* Tries to use a <b>stated</b> {@link IArgParser} to parse this argument into the specified class
*
* @param type The class to parse this argument into
* @return If the parser succeeded

View File

@ -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.
* <p>

View File

@ -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 <b>stateless</b> {@link ArgParser} to parse the argument at the specified index into the specified
* Tries to use a <b>stateless</b> {@link IArgParser} to parse the argument at the specified index into the specified
* class
* <p>
* 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 <b>stateless</b> {@link ArgParser} to parse the next argument into the specified class
* Tries to use a <b>stateless</b> {@link IArgParser} to parse the next argument into the specified class
* <p>
* 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 <b>stateless</b> {@link ArgParser} to parse the argument at the specified index into the specified
* Tries to use a <b>stateless</b> {@link IArgParser} to parse the argument at the specified index into the specified
* class
* <p>
* 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 <b>stateless</b> {@link ArgParser} to parse the next argument into the specified class
* Tries to use a <b>stateless</b> {@link IArgParser} to parse the next argument into the specified class
* <p>
* 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 <b>stateless</b> {@link ArgParser} to parse the argument at the specified index into the specified
* Tries to use a <b>stateless</b> {@link IArgParser} to parse the argument at the specified index into the specified
* class
* <p>
* 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 <b>stateless</b> {@link ArgParser} to parse the next argument into the specified class
* Tries to use a <b>stateless</b> {@link IArgParser} to parse the next argument into the specified class
* <p>
* 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
* <p>
* 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}.
* <p>
* 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
* <p>
* 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}.
* <p>
* 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
* <p>
* 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}.
* <p>
* 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
* <p>
* 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}.
* <p>
* 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
* <p>
* 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}.
* <p>
* 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
* <p>
* 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}.
* <p>
* 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
* <p>
* 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}.
* <p>
* 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
* <p>
* 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}.
* <p>
* 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 <b>stateless</b> {@link ArgParser} to parse the next argument into the specified class
* Tries to use a <b>stateless</b> {@link IArgParser} to parse the next argument into the specified class
* <p>
* 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 <b>stateless</b> {@link ArgParser} to parse the next argument into the specified class
* Tries to use a <b>stateless</b> {@link IArgParser} to parse the next argument into the specified class
* <p>
* 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 <b>stateless</b> {@link ArgParser} to parse the next argument into the specified class
* Tries to use a <b>stateless</b> {@link IArgParser} to parse the next argument into the specified class
* <p>
* 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
* <p>
* 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
* <p>
* 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}.
* <p>
* 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
* <p>
* 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
* <p>
* 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}.
* <p>
* 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
* <p>
* 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}.
* <p>
* 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
* <p>
* 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
* <p>
* 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}.
* <p>
* 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
* <p>
* 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}.
* <p>
* 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.
* <p>