@NotNull @Override public Calendar perform() throws RepositoryException { PropertyDelegate dlg = getPropertyOrThrow(JcrConstants.JCR_CREATED); return Conversions.convert(dlg.getDate()).toCalendar(); } });
@NotNull @Override public Calendar perform() throws RepositoryException { PropertyDelegate dlg = getPropertyOrThrow(JcrConstants.JCR_CREATED); return Conversions.convert(dlg.getDate()).toCalendar(); } });
/** * @see javax.jcr.Value#getDate() */ @Override public Calendar getDate() throws RepositoryException { try { switch (getType()) { case PropertyType.STRING: case PropertyType.BINARY: case PropertyType.DATE: String value = getValue(Type.DATE, index); return Conversions.convert(value).toCalendar(); case PropertyType.LONG: case PropertyType.DOUBLE: case PropertyType.DECIMAL: return Conversions.convert(getValue(Type.LONG, index)).toCalendar(); default: throw new ValueFormatException("Incompatible type " + PropertyType.nameFromValue(getType())); } } catch (IllegalArgumentException e) { throw new ValueFormatException("Error converting value to date", e); } }
/** * @see javax.jcr.Value#getDate() */ @Override public Calendar getDate() throws RepositoryException { try { switch (getType()) { case PropertyType.STRING: case PropertyType.BINARY: case PropertyType.DATE: String value = getValue(Type.DATE, index); return Conversions.convert(value).toCalendar(); case PropertyType.LONG: case PropertyType.DOUBLE: case PropertyType.DECIMAL: return Conversions.convert(getValue(Type.LONG, index)).toCalendar(); default: throw new ValueFormatException("Incompatible type " + PropertyType.nameFromValue(getType())); } } catch (IllegalArgumentException e) { throw new ValueFormatException("Error converting value to date", e); } }
/** * Convert to date. This default implementation delegates to {@link #toCalendar()} * and returns the {@code ISO8601.format(Calendar)} value of the calendar. * @return date representation of the converted value * @throws IllegalArgumentException if the string cannot be parsed into a date */ public String toDate() { return ISO8601.format(toCalendar()); }
/** * Convert to date. This default implementation delegates to {@link #toCalendar()} * and returns the {@code ISO8601.format(Calendar)} value of the calendar. * @return date representation of the converted value * @throws IllegalArgumentException if the string cannot be parsed into a date */ public String toDate() { return ISO8601.format(toCalendar()); }