io.vertx.rxjava3.core.cli.CommandLine Maven / Gradle / Ivy
/*
* Copyright 2014 Red Hat, Inc.
*
* Red Hat licenses this file to you under the Apache License, version 2.0
* (the "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*/
package io.vertx.rxjava3.core.cli;
import io.vertx.rxjava3.RxHelper;
import io.vertx.rxjava3.ObservableHelper;
import io.vertx.rxjava3.FlowableHelper;
import io.vertx.rxjava3.impl.AsyncResultMaybe;
import io.vertx.rxjava3.impl.AsyncResultSingle;
import io.vertx.rxjava3.impl.AsyncResultCompletable;
import io.vertx.rxjava3.WriteStreamObserver;
import io.vertx.rxjava3.WriteStreamSubscriber;
import java.util.Map;
import java.util.Set;
import java.util.List;
import java.util.Iterator;
import java.util.function.Function;
import java.util.stream.Collectors;
import io.vertx.core.Handler;
import io.vertx.core.AsyncResult;
import io.vertx.core.json.JsonObject;
import io.vertx.core.json.JsonArray;
import io.vertx.lang.rx.RxGen;
import io.vertx.lang.rx.TypeArg;
import io.vertx.lang.rx.MappingIterator;
/**
* The parser transforms a CLI (a model) into an {@link io.vertx.rxjava3.core.cli.CommandLine}. This {@link io.vertx.rxjava3.core.cli.CommandLine}
* has stored the argument and option values. Only instance of parser should create
* objects of this type.
*
*
* NOTE: This class has been automatically generated from the {@link io.vertx.core.cli.CommandLine original} non RX-ified interface using Vert.x codegen.
*/
@RxGen(io.vertx.core.cli.CommandLine.class)
public class CommandLine {
@Override
public String toString() {
return delegate.toString();
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
CommandLine that = (CommandLine) o;
return delegate.equals(that.delegate);
}
@Override
public int hashCode() {
return delegate.hashCode();
}
public static final TypeArg __TYPE_ARG = new TypeArg<>( obj -> new CommandLine((io.vertx.core.cli.CommandLine) obj),
CommandLine::getDelegate
);
private final io.vertx.core.cli.CommandLine delegate;
public CommandLine(io.vertx.core.cli.CommandLine delegate) {
this.delegate = delegate;
}
public CommandLine(Object delegate) {
this.delegate = (io.vertx.core.cli.CommandLine)delegate;
}
public io.vertx.core.cli.CommandLine getDelegate() {
return delegate;
}
/**
* Creates a command line object from the {@link io.vertx.rxjava3.core.cli.CLI}. This object is intended to be used by
* the parser to set the argument and option values.
* @param cli the CLI definition
* @return the command line object
*/
public static io.vertx.rxjava3.core.cli.CommandLine create(io.vertx.rxjava3.core.cli.CLI cli) {
io.vertx.rxjava3.core.cli.CommandLine ret = io.vertx.rxjava3.core.cli.CommandLine.newInstance((io.vertx.core.cli.CommandLine)io.vertx.core.cli.CommandLine.create(cli.getDelegate()));
return ret;
}
/**
* @return the model of this command line object.
*/
public io.vertx.rxjava3.core.cli.CLI cli() {
io.vertx.rxjava3.core.cli.CLI ret = io.vertx.rxjava3.core.cli.CLI.newInstance((io.vertx.core.cli.CLI)delegate.cli());
return ret;
}
/**
* @return the ordered list of arguments. Arguments are command line arguments not matching an option.
*/
public java.util.List allArguments() {
java.util.List ret = delegate.allArguments();
return ret;
}
/**
* Gets the value of an option with the matching name (can be the long name, short name or arg name).
* @param name the name
* @return the value, null
if not set
*/
public T getOptionValue(java.lang.String name) {
T ret = (T) delegate.getOptionValue(name);
return ret;
}
/**
* Gets the value of an argument with the matching name (arg name).
* @param name the name
* @return the value, null
if not set
*/
public T getArgumentValue(java.lang.String name) {
T ret = (T) delegate.getArgumentValue(name);
return ret;
}
/**
* Gets the value of an argument with the given index.
* @param index the index
* @return the value, null
if not set
*/
public T getArgumentValue(int index) {
T ret = (T) delegate.getArgumentValue(index);
return ret;
}
/**
* Gets the value of an option marked as a flag.
*
* Calling this method an a non-flag option throws an {@link java.lang.IllegalStateException}.
* @param name the option name
* @return true
if the flag has been set in the command line, false
otherwise.
*/
public boolean isFlagEnabled(java.lang.String name) {
boolean ret = delegate.isFlagEnabled(name);
return ret;
}
/**
* Checks whether or not the given option has been assigned in the command line.
* @param option the option
* @return true
if the option has received a value, otherwise.
*/
public boolean isOptionAssigned(io.vertx.core.cli.Option option) {
boolean ret = delegate.isOptionAssigned(option);
return ret;
}
/**
* Gets the raw values of the given option. Raw values are simple "String", not converted to the option type.
* @param option the option
* @return the list of values, empty if none
*/
@Deprecated()
public java.util.List getRawValues(io.vertx.core.cli.Option option) {
java.util.List ret = delegate.getRawValues(option);
return ret;
}
/**
* Gets the raw values of the given option. Raw values are simple "String", not converted to the option type.
* @param option the option
* @return the list of values, empty if none
*/
public java.util.List getRawValuesForOption(io.vertx.core.cli.Option option) {
java.util.List ret = delegate.getRawValuesForOption(option);
return ret;
}
/**
* Gets the raw values of the given argument. Raw values are simple "String", not converted to the argument type.
* @param argument the argument
* @return the list of values, empty if none
*/
public java.util.List getRawValuesForArgument(io.vertx.core.cli.Argument argument) {
java.util.List ret = delegate.getRawValuesForArgument(argument);
return ret;
}
/**
* Gets the raw value of the given option. Raw values are the values as given in the user command line.
* @param option the option
* @return the value, null
if none.
*/
public java.lang.String getRawValueForOption(io.vertx.core.cli.Option option) {
java.lang.String ret = delegate.getRawValueForOption(option);
return ret;
}
/**
* Checks whether or not the given option accept more values.
* @param option the option
* @return if the option accepts more values, otherwise.
*/
public boolean acceptMoreValues(io.vertx.core.cli.Option option) {
boolean ret = delegate.acceptMoreValues(option);
return ret;
}
/**
* Gets the raw value of the given argument. Raw values are the values as given in the user command line.
* @param arg the argument
* @return the value, null
if none.
*/
public java.lang.String getRawValueForArgument(io.vertx.core.cli.Argument arg) {
java.lang.String ret = delegate.getRawValueForArgument(arg);
return ret;
}
/**
* Checks whether or not the given argument has been assigned in the command line.
* @param arg the argument
* @return true
if the argument has received a value, otherwise.
*/
public boolean isArgumentAssigned(io.vertx.core.cli.Argument arg) {
boolean ret = delegate.isArgumentAssigned(arg);
return ret;
}
/**
* Checks whether or not the given option has been seen in the user command line.
* @param option the option
* @return true
if the user command line has used the option
*/
public boolean isSeenInCommandLine(io.vertx.core.cli.Option option) {
boolean ret = delegate.isSeenInCommandLine(option);
return ret;
}
/**
* Checks whether or not the command line is valid, i.e. all constraints from arguments and options have been
* satisfied. This method is used when the parser validation is disabled.
* @return true
if the current {@link io.vertx.rxjava3.core.cli.CommandLine} object is valid. otherwise.
*/
public boolean isValid() {
boolean ret = delegate.isValid();
return ret;
}
/**
* Checks whether or not the user has passed a "help" option and is asking for help.
* @return true
if the user command line has enabled a "Help" option, otherwise.
*/
public boolean isAskingForHelp() {
boolean ret = delegate.isAskingForHelp();
return ret;
}
public static CommandLine newInstance(io.vertx.core.cli.CommandLine arg) {
return arg != null ? new CommandLine(arg) : null;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy