+ public static Class[] getInputTypes()
+ {
+ // TODO - find a better way of maintaining this classlist
+ return new Class[]
+ { jalview.ws.rest.params.Alignment.class,
+ jalview.ws.rest.params.AnnotationFile.class,
+ SeqGroupIndexVector.class,
+ jalview.ws.rest.params.SeqIdVector.class,
+ jalview.ws.rest.params.SeqVector.class,
+ jalview.ws.rest.params.Tree.class };
+ }
+
+ public static boolean parseTypeString(String fullstring, String tok,
+ String iprm, String iprmparams, Map<String, InputType> iparams,
+ StringBuffer warnings)
+ {
+ boolean valid = true;
+ InputType jinput;
+ for (Class type : getInputTypes())
+ {
+ try
+ {
+ jinput = (InputType) (type.getConstructor().newInstance(null));
+ if (iprm.equalsIgnoreCase(jinput.getURLtokenPrefix()))
+ {
+ ArrayList<String> al = new ArrayList<String>();
+ for (String prprm : separatorListToArray(iprmparams, ","))
+ {
+ // hack to ensure that strings like "sep=','" containing unescaped commas as values are concatenated
+ al.add(prprm.trim());
+ }
+ if (!jinput.configureFromURLtokenString(al, warnings))
+ {
+ valid = false;
+ warnings.append("Failed to parse '" + fullstring + "' as a "
+ + jinput.getURLtokenPrefix() + " input tag.\n");
+ }
+ else
+ {
+ jinput.token = tok;
+ iparams.put(tok, jinput);
+ valid = true;
+ }
+ break;
+ }
+
+ } catch (Throwable thr)
+ {
+ }
+ ;
+ }
+ return valid;
+ }
+