@Override public Object parseObject(final String source, final ParsePosition pos) { synchronized(this) { return inner.parseObject(source, pos); } } };
@Override public Object parseObject(String string) throws ParseException { return super.parseObject(getFixedInputString(string)); }
@Override public Object parseObject(String string, ParsePosition position) { return super.parseObject(getFixedInputString(string), position); }
@Override public Object convertFromString(Class<?> cls, String str) { if (str.length() != 29) { throw new IllegalArgumentException("Unable to parse date: " + str); } String str2 = str.substring(0, 26) + str.substring(27); SimpleDateFormat f = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ"); try { return f.parseObject(str2); } catch (ParseException ex) { throw new RuntimeException(ex); } } },
public Object fromJSON(Map map) { if (!_fromJSON) throw new UnsupportedOperationException(); try { synchronized(_format) { return _format.parseObject((String)map.get("value")); } } catch(Exception e) { Log.warn(e); } return null; }
@Override public Object convertFromString(Class<?> cls, String str) { if (str.length() < 31 || str.charAt(26) != ':' || str.charAt(29) != '[' || str.charAt(str.length() - 1) != ']') { throw new IllegalArgumentException("Unable to parse date: " + str); } TimeZone zone = TimeZone.getTimeZone(str.substring(30, str.length() - 1)); String str2 = str.substring(0, 26) + str.substring(27, 29); SimpleDateFormat f = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ"); GregorianCalendar cal = new GregorianCalendar(zone); cal.setTimeInMillis(0); f.setCalendar(cal); try { f.parseObject(str2); return f.getCalendar(); } catch (ParseException ex) { throw new RuntimeException(ex); } } },
/** * @see org.openmrs.Attributable#hydrate(java.lang.String) */ @Override public AttributableDate hydrate(String s) { // don't do anything to empty dates if (StringUtils.isEmpty(s)) { return null; } try { // try to parse as the current user ( return new AttributableDate(((Date) Context.getDateFormat().parseObject(s)).getTime()); } catch (ParseException e) { try { return new AttributableDate(((Date) new SimpleDateFormat(dateFormat).parseObject(s)).getTime()); } catch (ParseException e2) { // if we can't parse it as the normalized string or as the current // user's date format, bail out throw new APIException("unable.parse.string.as.date", new Object[] { s }); } } }
@Override public synchronized Object parseObject(String source) throws ParseException { return format.parseObject(source); } }
@Override public synchronized Object parseObject(String source, ParsePosition pos) { return format.parseObject(source, pos); }
/** * {@inheritDoc} * * @deprecated as it is not considered to be thread safe. */ @Deprecated @Override public Object parseObject( String source ) throws ParseException { return super.parseObject( source ); } }
/** * {@inheritDoc} * * @deprecated as it is not considered to be thread safe. */ @Deprecated @Override public Object parseObject( String source, ParsePosition pos ) { return super.parseObject( source, pos ); }
public Object parseObject(String source) throws ParseException { return localSimpleDateFormat.get().parseObject(source); }
public Object parseObject(String source, ParsePosition position) { return localSimpleDateFormat.get().parseObject(source, position); }
public Object parseObject(String source, ParsePosition position) { return localSimpleDateFormat.get().parseObject(source, position); }
public Object fromJSON(Map map) { if (!_fromJSON) throw new UnsupportedOperationException(); try { synchronized (_format) { return _format.parseObject((String) map.get("value")); } } catch (Exception e) { logger.warning(e.getMessage()); } return null; } public void toJSON(Object obj, JSON.Output out) {
public Object fromJSON(Map map) { if (!_fromJSON) throw new UnsupportedOperationException(); try { synchronized (_format) { return _format.parseObject((String) map.get("value")); } } catch (Exception e) { logger.warning(e.getMessage()); } return null; } public void toJSON(Object obj, JSON.Output out) {
public Object convertFromString(Class<?> cls, String str) { if (str.length() != 29) { throw new IllegalArgumentException("Unable to parse date: " + str); } str = str.substring(0, 26) + str.substring(27); SimpleDateFormat f = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ"); try { return f.parseObject(str); } catch (ParseException ex) { throw new RuntimeException(ex); } } },
public static void putGendate(ESIndice esIndice,SimpleDateFormat format){ int dsplit = esIndice.getIndex().lastIndexOf('-'); try { if(dsplit > 0){ String date = esIndice.getIndex().substring(dsplit+1); esIndice.setGenDate((Date)format.parseObject(date)); } } catch (Exception e) { } }
public static void putGendate(ESIndice esIndice,SimpleDateFormat format){ int dsplit = esIndice.getIndex().lastIndexOf('-'); try { if(dsplit > 0){ String date = esIndice.getIndex().substring(dsplit+1); esIndice.setGenDate((Date)format.parseObject(date)); } } catch (Exception e) { } }
public Object revert(Object o) { try { return dateFormat.get().parseObject((String) o); } catch (ParseException e) { String message = ExceptionManager.getInstance().getFullMessage("bp_DTSC_1", o); throw new BonitaRuntimeException(message, e); } }