/** * Create an {@link Argument} with the specified value. * * @param arg the value of the {@link Argument} * @param options the {@link Option}s for this {@link Argument} * * @return an {@link Argument} with the specified value */ public static Argument of(Object arg, Option... options) { return new Argument(arg, options); }
/** * Create an {@link Argument} with the specified value. * * @param arg the value of the {@link Argument} * @param options the {@link Option}s for this {@link Argument} * * @return an {@link Argument} with the specified value */ public static Argument of(Object arg, Option... options) { return new Argument(arg, options); }
/** * Create an {@link Argument} with the specified value. * * @param name the name of the argument * @param arg the value of the {@link Argument} * @param options the {@link Option}s for this {@link Argument} * * @return an {@link Argument} with the specified value */ public static Argument of(String name, Object arg, Option... options) { return new Argument(name, arg, options); }
/** * Create an {@link Argument} with the specified value. * * @param name the name of the argument * @param arg the value of the {@link Argument} * @param options the {@link Option}s for this {@link Argument} * * @return an {@link Argument} with the specified value */ public static Argument of(String name, Object arg, Option... options) { return new Argument(name, arg, options); }
/** * Create an {@link Argument} with the specified name, * value and separator. * * @param name the name of the argument * @param separator the separator to use between the name * and value when resolving this argument * @param arg the value of the {@link Argument} * @param options the {@link Option}s for this {@link Argument} * * @return an {@link Argument} with the specified value */ public static Argument of(String name, char separator, Object arg, Option... options) { return new Argument(name, separator, arg, options); }
/** * Create an {@link Argument} with the specified name, * value and separator. * * @param name the name of the argument * @param separator the separator to use between the name * and value when resolving this argument * @param arg the value of the {@link Argument} * @param options the {@link Option}s for this {@link Argument} * * @return an {@link Argument} with the specified value */ public static Argument of(String name, char separator, Object arg, Option... options) { return new Argument(name, separator, arg, options); }
/** * Set the separator to use between the name and value when * realizing the arguments for an application. * <p> * <strong>Note</strong> {@link Argument}s are immutable so calling * this method will return a copy of this {@link Argument} with * the specified separator. * * @param separator the separator to use * * @return this {@link Argument} */ public Argument withSeparator(char separator) { if (separator == this.separator) { return this; } return new Argument(this.name, separator, this.value); }
/** * Set the separator to use between the name and value when * realizing the arguments for an application. * <p> * <strong>Note</strong> {@link Argument}s are immutable so calling * this method will return a copy of this {@link Argument} with * the specified separator. * * @param separator the separator to use * * @return this {@link Argument} */ public Argument withSeparator(char separator) { if (separator == this.separator) { return this; } return new Argument(this.name, separator, this.value); }
/** * Obtain a new {@link Arguments} that is the same as this * {@link Arguments} instance with the first occurrence of * the specified argument removed. * * @param argument the argument to remove * * @return a new {@link Arguments} that is the same as this * {@link Arguments} instance with the first occurrence * of the specified argument removed */ public Arguments without(Object argument) { Argument arg = (argument instanceof Argument) ? (Argument) argument : new Argument(argument); return without(arg); }
/** * Obtain a new {@link Arguments} that is the same as this * {@link Arguments} instance with the first occurrence of * the specified argument removed. * * @param argument the argument to remove * * @return a new {@link Arguments} that is the same as this * {@link Arguments} instance with the first occurrence * of the specified argument removed */ public Arguments without(Object argument) { Argument arg = (argument instanceof Argument) ? (Argument) argument : new Argument(argument); return without(arg); }
/** * Obtain a new {@link Arguments} that is the same as this * {@link Arguments} instance with the specified arguments * appended. * * @param arguments the arguments to add * * @return a new {@link Arguments} that is the same as this * {@link Arguments} instance with the specified arguments * appended */ public Arguments with(List<?> arguments) { Arguments newArguments = new Arguments(); newArguments.arguments.addAll(this.arguments); for (Object argument : arguments) { if (argument instanceof Argument) { newArguments.arguments.add((Argument) argument); } else { newArguments.arguments.add(new Argument(argument)); } } return newArguments; }
/** * Obtain a new {@link Arguments} that is the same as this * {@link Arguments} instance with the specified arguments * appended. * * @param arguments the arguments to add * * @return a new {@link Arguments} that is the same as this * {@link Arguments} instance with the specified arguments * appended */ public Arguments with(List<?> arguments) { Arguments newArguments = new Arguments(); newArguments.arguments.addAll(this.arguments); for (Object argument : arguments) { if (argument instanceof Argument) { newArguments.arguments.add((Argument) argument); } else { newArguments.arguments.add(new Argument(argument)); } } return newArguments; }