public List<ApiObject> requestList(int method, ApiObject[] parameters) { try { switch (method) { case LIST_OPTION_GROUPS: return ApiObject.envelopeStringList(getOptionGroups()); case LIST_OPTION_NAMES: return ApiObject.envelopeStringList( getOptionNames(((ApiObject.String) parameters[0]).Value)); case LIST_BOOK_TAGS: return ApiObject.envelopeStringList(getBookTags()); case LIST_ACTIONS: return ApiObject.envelopeStringList(listActions()); case LIST_ACTION_NAMES: { final ArrayList<String> actions = new ArrayList<String>(parameters.length); for (ApiObject o : parameters) { actions.add(((ApiObject.String) o).Value); } return ApiObject.envelopeStringList(listActionNames(actions)); } case LIST_ZONEMAPS: return ApiObject.envelopeStringList(listZoneMaps()); case GET_PARAGRAPH_WORDS: return ApiObject.envelopeStringList( getParagraphWords(((ApiObject.Integer) parameters[0]).Value)); case GET_PARAGRAPH_WORD_INDICES: return ApiObject.envelopeIntegerList( getParagraphWordIndices(((ApiObject.Integer) parameters[0]).Value)); default: return Collections.<ApiObject>singletonList(unsupportedMethodError(method)); } } catch (Throwable e) { return Collections.<ApiObject>singletonList(exceptionInMethodError(method, e)); } }