
io.honnix.rkt.launcher.command.TrustBuilder Maven / Gradle / Ivy
package io.honnix.rkt.launcher.command;
import io.honnix.rkt.launcher.options.TrustOptions;
import io.norberg.automatter.AutoMatter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.Optional;
import javax.annotation.Generated;
@Generated("io.norberg.automatter.processor.AutoMatterProcessor")
public final class TrustBuilder {
private Optional options;
private List args;
public TrustBuilder() {
this.options = Optional.empty();
}
private TrustBuilder(Trust v) {
this.options = v.options();
List extends String> _args = v.args();
this.args = (_args == null) ? null : new ArrayList(_args);
}
private TrustBuilder(TrustBuilder v) {
this.options = v.options;
this.args = (v.args == null) ? null : new ArrayList(v.args);
}
public Optional options() {
return options;
}
public TrustBuilder options(TrustOptions options) {
return options(Optional.ofNullable(options));
}
@SuppressWarnings("unchecked")
public TrustBuilder options(Optional extends TrustOptions> options) {
if (options == null) {
throw new NullPointerException("options");
}
this.options = (Optional)options;
return this;
}
public List args() {
if (this.args == null) {
this.args = new ArrayList();
}
return args;
}
public TrustBuilder args(List extends String> args) {
return args((Collection extends String>) args);
}
public TrustBuilder args(Collection extends String> args) {
if (args == null) {
throw new NullPointerException("args");
}
for (String item : args) {
if (item == null) {
throw new NullPointerException("args: null item");
}
}
this.args = new ArrayList(args);
return this;
}
public TrustBuilder args(Iterable extends String> args) {
if (args == null) {
throw new NullPointerException("args");
}
if (args instanceof Collection) {
return args((Collection extends String>) args);
}
return args(args.iterator());
}
public TrustBuilder args(Iterator extends String> args) {
if (args == null) {
throw new NullPointerException("args");
}
this.args = new ArrayList();
while (args.hasNext()) {
String item = args.next();
if (item == null) {
throw new NullPointerException("args: null item");
}
this.args.add(item);
}
return this;
}
@SafeVarargs
public final TrustBuilder args(String... args) {
if (args == null) {
throw new NullPointerException("args");
}
return args(Arrays.asList(args));
}
public TrustBuilder addArg(String arg) {
if (arg == null) {
throw new NullPointerException("arg");
}
if (this.args == null) {
this.args = new ArrayList();
}
args.add(arg);
return this;
}
public Trust build() {
List _args = (args != null) ? Collections.unmodifiableList(new ArrayList(args)) : Collections.emptyList();
return new Value(options, _args);
}
public static TrustBuilder from(Trust v) {
return new TrustBuilder(v);
}
public static TrustBuilder from(TrustBuilder v) {
return new TrustBuilder(v);
}
private static final class Value implements Trust {
private final Optional options;
private final List args;
private Value(@AutoMatter.Field("options") Optional options, @AutoMatter.Field("args") List args) {
if (options == null) {
throw new NullPointerException("options");
}
this.options = options;
this.args = (args != null) ? args : Collections.emptyList();
}
@AutoMatter.Field
@Override
public Optional options() {
return options;
}
@AutoMatter.Field
@Override
public List args() {
return args;
}
public TrustBuilder builder() {
return new TrustBuilder(this);
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!(o instanceof Trust)) {
return false;
}
final Trust that = (Trust) o;
if (options != null ? !options.equals(that.options()) : that.options() != null) {
return false;
}
if (args != null ? !args.equals(that.args()) : that.args() != null) {
return false;
}
return true;
}
@Override
public int hashCode() {
int result = 1;
long temp;
result = 31 * result + (options != null ? options.hashCode() : 0);
result = 31 * result + (args != null ? args.hashCode() : 0);
return result;
}
@Override
public String toString() {
return "Trust{" +
"options=" + options +
", args=" + args +
'}';
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy