1 package jalview.ws2.api;
4 import java.util.ArrayList;
5 import java.util.Collections;
7 import jalview.ws.params.ParamDatastoreI;
8 import jalview.ws2.actions.Action;
10 import static java.util.Objects.requireNonNull;
12 public class WebService<T extends Action>
14 public static class Builder<T extends Action>
18 private String clientName;
20 private String category;
24 private String description = "";
26 private boolean interactive = false;
28 private ParamDatastoreI paramDatastore;
30 private List<T> actions = new ArrayList<>();
32 private Class<T> actionClass;
34 public Builder<T> url(URL val)
40 public Builder<T> clientName(String val)
46 public Builder<T> category(String val)
52 public Builder<T> name(String val)
58 public Builder<T> description(String val)
64 public Builder<T> interactive(boolean val)
70 public Builder<T> paramDatastore(ParamDatastoreI val)
76 public Builder<T> actions(List<T> val)
82 public Builder<T> action(T val)
88 public Builder<T> actionClass(Class<T> val)
94 public WebService<T> build()
97 requireNonNull(clientName);
98 requireNonNull(category);
100 requireNonNull(paramDatastore);
101 requireNonNull(actions);
102 if (actions.size() == 0)
103 throw new IllegalArgumentException("Empty actions list");
104 requireNonNull(actionClass);
105 return new WebService<T>(this);
109 private final URL url;
111 private final String clientName;
113 private final String category;
115 private final String name;
117 private final String description;
119 private final boolean interactive;
121 private final ParamDatastoreI paramDatastore;
123 private final List<T> actions;
125 private final Class<T> actionClass;
127 WebService(Builder<T> builder)
129 this.url = builder.url;
130 this.clientName = builder.clientName;
131 this.category = builder.category;
132 this.name = builder.name;
133 this.description = builder.description;
134 this.interactive = builder.interactive;
135 this.paramDatastore = builder.paramDatastore;
136 this.actions = Collections.unmodifiableList(builder.actions);
137 this.actionClass = builder.actionClass;
140 public static <T extends Action> Builder<T> newBuilder()
142 return new Builder<T>();
150 String getClientName()
165 String getDescription()
170 boolean isInteractive()
175 ParamDatastoreI getParamDatastore()
177 return paramDatastore;
185 Class<T> getActionClass()