@Override protected Reader createReader(URL url) throws FileNotFoundException, IOException { if (exceptionType != null) { if (exceptionType.equals(FileNotFoundException.class)) throw new FileNotFoundException(url.toExternalForm()); if (exceptionType.equals(IOException.class)) throw new IOException(url.toExternalForm()); throw new NullPointerException(); } return super.createReader(url); } @Override
@Override protected Reader createReader(URL url) throws FileNotFoundException, IOException { if (exceptionType != null) { if (exceptionType.equals(FileNotFoundException.class)) throw new FileNotFoundException(url.toExternalForm()); if (exceptionType.equals(IOException.class)) throw new IOException(url.toExternalForm()); throw new NullPointerException(); } return super.createReader(url); } @Override
@Override public List<MenuOptionDescription> listOptions() throws MenuServiceException { Gson gson = new Gson(); List<MenuOptionDescription> retval = new ArrayList<MenuOptionDescription>(); try { URL url = asURL("/menuOptions.json"); retval = gson.fromJson(createReader(url), new TypeToken<List<MenuOptionDescription>>(){}.getType()); } catch (URISyntaxException e) { throw new MenuServiceException("Problem finding menu options json file", e); } catch (FileNotFoundException e) { throw new MenuServiceException("No menu options json file found", e); } catch (Exception e) { throw new MenuServiceException("Unexpected error", e); } return retval; }
@Override public List<MenuOptionDescription> listOptions() throws MenuServiceException { Gson gson = new Gson(); List<MenuOptionDescription> retval = new ArrayList<MenuOptionDescription>(); try { URL url = asURL("/menuOptions.json"); retval = gson.fromJson(createReader(url), new TypeToken<List<MenuOptionDescription>>(){}.getType()); } catch (URISyntaxException e) { throw new MenuServiceException("Problem finding menu options json file", e); } catch (FileNotFoundException e) { throw new MenuServiceException("No menu options json file found", e); } catch (Exception e) { throw new MenuServiceException("Unexpected error", e); } return retval; }
@Override public List<ValidationDescription> listValidations() throws MenuServiceException { Gson gson = new Gson(); List<ValidationDescription> retval = null; try { URL url = asURL("/validations.json"); retval = gson.fromJson(createReader(url), new TypeToken<List<ValidationDescription>>(){}.getType()); } catch (URISyntaxException e) { throw new MenuServiceException("Problem finding validations json file", e); } catch (FileNotFoundException e) { throw new MenuServiceException("No validations json file found", e); } catch (Exception e) { throw new MenuServiceException("Unexpected error", e); } return retval; }
@Override public List<ValidationDescription> listValidations() throws MenuServiceException { Gson gson = new Gson(); List<ValidationDescription> retval = null; try { URL url = asURL("/validations.json"); retval = gson.fromJson(createReader(url), new TypeToken<List<ValidationDescription>>(){}.getType()); } catch (URISyntaxException e) { throw new MenuServiceException("Problem finding validations json file", e); } catch (FileNotFoundException e) { throw new MenuServiceException("No validations json file found", e); } catch (Exception e) { throw new MenuServiceException("Unexpected error", e); } return retval; }