1 package jalview.ws2.api;
4 import java.util.ArrayList;
5 import java.util.Collection;
7 import jalview.ws.params.ParamDatastoreI;
8 import jalview.ws2.actions.api.ActionI;
10 import static java.util.Objects.requireNonNull;
12 public class WebService<A extends ActionI<?>>
14 public static class Builder<A extends ActionI<?>>
18 private String clientName;
20 private String category;
24 private String description = "";
26 private boolean interactive = false;
28 private ParamDatastoreI paramDatastore;
30 private Class<A> actionClass;
32 public Builder<A> url(URL val)
38 public Builder<A> clientName(String val)
44 public Builder<A> category(String val)
50 public Builder<A> name(String val)
56 public Builder<A> description(String val)
62 public Builder<A> interactive(boolean val)
68 public Builder<A> paramDatastore(ParamDatastoreI val)
74 public Builder<A> actionClass(Class<A> val)
80 public WebService<A> build()
82 return new WebService<A>(this);
86 private final URL url;
88 private final String clientName;
90 private final String category;
92 private final String name;
94 private final String description;
96 private final boolean interactive;
98 private final ParamDatastoreI paramDatastore;
100 private final List<A> actions;
102 private final Class<A> actionClass;
104 protected WebService(Builder<A> builder)
106 requireNonNull(builder.url);
107 requireNonNull(builder.clientName);
108 requireNonNull(builder.category);
109 requireNonNull(builder.name);
110 requireNonNull(builder.paramDatastore);
111 requireNonNull(builder.actionClass);
112 this.url = builder.url;
113 this.clientName = builder.clientName;
114 this.category = builder.category;
115 this.name = builder.name;
116 this.description = builder.description;
117 this.interactive = builder.interactive;
118 this.paramDatastore = builder.paramDatastore;
119 this.actions = new ArrayList<>();
120 this.actionClass = builder.actionClass;
123 public static <A extends ActionI<?>> Builder<A> newBuilder()
125 return new Builder<A>();
128 public void addAction(A action)
130 this.actions.add(action);
133 public void addActions(Collection<? extends A> actions)
135 this.actions.addAll(actions);
143 public String getClientName()
148 public String getCategory()
153 public String getName()
158 public String getDescription()
163 public boolean isInteractive()
168 public ParamDatastoreI getParamDatastore()
170 return paramDatastore;
173 public List<A> getActions()
178 public Class<A> getActionClass()