Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.
Scout/Tutorial/5.0/webservices/Conversion methods for StockQuote service
Scout |
Wiki Home |
Website |
Download • Git |
Community |
Forums • Blog • Twitter • G+ |
Bugzilla |
Bugzilla |
private Date parseDateTime(String date, String time) { try { if (date != null && !date.equals("N/A") && time != null && !time.equals("N/A")) { SimpleDateFormat format = new SimpleDateFormat("MM/dd/yyyy hh:mmaa"); return format.parse(date + " " + time); } else if (date != null && !date.equals("N/A")) { SimpleDateFormat format = new SimpleDateFormat("MM/dd/yyyy"); return format.parse(date); } else if (time != null && !time.equals("N/A")) { SimpleDateFormat format = new SimpleDateFormat("hh:mmaa"); return format.parse(time); } } catch (ParseException e) { ScoutLogManager.getLogger(CompanyService.class).error("failed to parse date/time '" + date + " " + time + "'", e); } return null; } private Double parseDouble(String number) { if (number != null && number.equals("N/A")) { return null; } try { return Double.parseDouble(number); } catch (Exception e) { ScoutLogManager.getLogger(CompanyService.class).error("failed to parse double value '" + number + "'", e); } return null; } private Long parseLong(String number) { if (number != null && number.equals("N/A")) { return null; } try { return Long.parseLong(number); } catch (Exception e) { ScoutLogManager.getLogger(CompanyService.class).error("failed to parse long value '" + number + "'", e); } return null; }