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/3.8/webservices/Conversion methods for StockQuote service
< Scout | Tutorial | 3.8
Revision as of 01:59, 27 April 2012 by Mbk.bsiag.com (Talk | contribs) (Scout/Tutorial/Webservices with JAX-WS/Conversion methods for StockQuote service moved to Scout/Tutorial/3.8/Conversion methods for StockQuote service)
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(CompanyProcessService.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(CompanyProcessService.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(CompanyProcessService.class).error("failed to parse long value '" + number + "'", e); } return null; }