@Override public DateTime parseUpdated(Element element) { checkNotNull(element); String dateTime = element.getAttribute("title"); if (dateTime.equals("")) { dateTime = element.getTextContent(); } try { return DateTime.parseDateTime(dateTime); } catch (RuntimeException e) { return null; } } }
/** * Override {@link ValueConstruct#setValue(String)} to validate that * supplied value is valid date. * * @throws NullPointerException if argument is null. * @throws IllegalArgumentException if argument is not a valid date. */ @Override public void setValue(String value) { if (value == null) { throw new NullPointerException("value must not be null"); } try { DateTime parsedValue = DateTime.parseDateTime(value); setDateTime(parsedValue); } catch (NumberFormatException e) { throw new IllegalArgumentException("Invalid date", e); } }
/** * Override {@link ValueConstruct#setValue(String)} to validate that * supplied value is valid date. * * @throws NullPointerException if argument is null. * @throws IllegalArgumentException if argument is not a valid date. */ @Override public void setValue(String value) { if (value == null) { throw new NullPointerException("value must not be null"); } try { DateTime parsedValue = DateTime.parseDateTime(value); setDateTime(parsedValue); } catch (NumberFormatException e) { throw new IllegalArgumentException("Invalid date", e); } }
/** * Parses an XML value that's either an xs:date or xs:dateTime string. * * @throws NumberFormatException * Invalid RFC 3339 date or date/time string. */ public static DateTime parseDateTimeChoice(String value) throws NumberFormatException { NumberFormatException exception; try { return DateTime.parseDateTime(value); } catch (NumberFormatException e) { exception = e; } try { return DateTime.parseDate(value); } catch (NumberFormatException e) { exception = e; } throw exception; }
/** * Parses an XML value that's either an xs:date or xs:dateTime string. * * @throws NumberFormatException * Invalid RFC 3339 date or date/time string. */ public static DateTime parseDateTimeChoice(String value) throws NumberFormatException { NumberFormatException exception; try { return DateTime.parseDateTime(value); } catch (NumberFormatException e) { exception = e; } try { return DateTime.parseDate(value); } catch (NumberFormatException e) { exception = e; } throw exception; }
/** * Parses an XML value that's either an xs:date or xs:dateTime string. * * @throws NumberFormatException * Invalid RFC 3339 date or date/time string. */ public static DateTime parseDateTimeChoice(String value) throws NumberFormatException { NumberFormatException exception; try { return DateTime.parseDateTime(value); } catch (NumberFormatException e) { exception = e; } try { return DateTime.parseDate(value); } catch (NumberFormatException e) { exception = e; } throw exception; }
/** * Returns the maximum start time for events returned by the query. Only * events that start before this time will be returned. * * @return the maximum start time. A value of {@code null} indicates * that maximum start-time based querying is disabled. */ public DateTime getMaximumStartTime() { List<CustomParameter> maxParams = getCustomParameters(MAXIMUM_START_TIME); if (maxParams.size() == 0) return null; return DateTime.parseDateTime(maxParams.get(0).getValue()); }
/** * Returns the maximum start time for events returned by the query. Only * events that start before this time will be returned. * * @return the maximum start time. A value of {@code null} indicates * that maximum start-time based querying is disabled. */ public DateTime getMaximumStartTime() { List<CustomParameter> maxParams = getCustomParameters(MAXIMUM_START_TIME); if (maxParams.size() == 0) return null; return DateTime.parseDateTime(maxParams.get(0).getValue()); }
/** * Returns the minimum start time for events returned by the query. Only * events that start on or after this time will be returned. * * @return the minimum start time. A value of {@code null} indicates * that minimum start-time based querying is disabled. */ public DateTime getMinimumStartTime() { List<CustomParameter> minParams = getCustomParameters(MINIMUM_START_TIME); if (minParams.size() == 0) return null; return DateTime.parseDateTime(minParams.get(0).getValue()); }
/** * Returns the maximum start time for events returned by the query. Only * events that start before this time will be returned. * * @return the maximum start time. A value of {@code null} indicates * that maximum start-time based querying is disabled. */ public DateTime getMaximumStartTime() { List<CustomParameter> maxParams = getCustomParameters(MAXIMUM_START_TIME); if (maxParams.size() == 0) return null; return DateTime.parseDateTime(maxParams.get(0).getValue()); }
/** * Returns the minimum start time for events returned by the query. Only * events that start on or after this time will be returned. * * @return the minimum start time. A value of {@code null} indicates * that minimum start-time based querying is disabled. */ public DateTime getMinimumStartTime() { List<CustomParameter> minParams = getCustomParameters(MINIMUM_START_TIME); if (minParams.size() == 0) return null; return DateTime.parseDateTime(minParams.get(0).getValue()); }
/** * Returns the minimum start time for events returned by the query. Only * events that start on or after this time will be returned. * * @return the minimum start time. A value of {@code null} indicates * that minimum start-time based querying is disabled. */ public DateTime getMinimumStartTime() { List<CustomParameter> minParams = getCustomParameters(MINIMUM_START_TIME); if (minParams.size() == 0) return null; return DateTime.parseDateTime(minParams.get(0).getValue()); }
/** * Processes this element; overrides inherited method. */ @Override public void processEndElement() throws ParseException { try { dateTime = DateTime.parseDateTime(value); } catch (NumberFormatException e) { throw new ParseException( CoreErrorDomain.ERR.invalidDatetime.withInternalReason( "Invalid date/time format: '" + value + "'.")); } } }
/** * Processes this element; overrides inherited method. */ @Override public void processEndElement() throws ParseException { try { dateTime = DateTime.parseDateTime(value); } catch (NumberFormatException e) { throw new ParseException( CoreErrorDomain.ERR.invalidDatetime.withInternalReason( "Invalid date/time format: '" + value + "'.")); } } }
/** * Processes this element; overrides inherited method. */ @Override public void processEndElement() throws ParseException { try { dateTime = DateTime.parseDateTime(value); } catch (NumberFormatException e) { throw new ParseException( CoreErrorDomain.ERR.invalidDatetime.withInternalReason( "Invalid date/time format: '" + value + "'.")); } } }
time = DateTime.parseDateTime(value); } catch (NumberFormatException e) { throw new ParseException(
time = DateTime.parseDateTime(value); } catch (NumberFormatException e) { throw new ParseException(
@Override protected void consumeAttributes(AttributeHelper helper) throws ParseException { super.consumeAttributes(helper); try { dateTime = DateTime.parseDateTime(helper.consumeContent(true)); } catch (NumberFormatException e) { throw new ParseException("Invalid date time format."); } }
time = DateTime.parseDateTime(value); } catch (NumberFormatException e) { throw new ParseException(
@Override protected void consumeAttributes(AttributeHelper helper) throws ParseException { super.consumeAttributes(helper); try { dateTime = DateTime.parseDateTime(helper.consumeContent(true)); } catch (NumberFormatException e) { throw new ParseException("Invalid date time format."); } }