protected Calendar _convert(XMLGregorianCalendar input) { return (input == null) ? null : input.toGregorianCalendar(); } }
protected Duration parsePeriod(String period) throws Exception { return datatypeFactory.newDuration(period); }
public XMLGregorianCalendar createXMLGregorianCalendar(Calendar calendar) { if (dateFactory == null) { try { dateFactory = DatatypeFactory.newInstance(); } catch (DatatypeConfigurationException e) { throw new IllegalStateException("Could not obtain an instance of DatatypeFactory.", e); } } return dateFactory.newXMLGregorianCalendar((GregorianCalendar) calendar); }
public Calendar parseTime(String lexicalXSDTime) { return datatypeFactory.newXMLGregorianCalendar(lexicalXSDTime).toGregorianCalendar(); }
DatatypeFactory getFactory() { try { return DatatypeFactory.newInstance(); } catch (final DatatypeConfigurationException e) { return null; } } }.getFactory());
public JAXBElement<XMLGregorianCalendar> standardClassXMLGregorianCalendar() throws DatatypeConfigurationException { XMLGregorianCalendar calendar = factory.newXMLGregorianCalendar((GregorianCalendar) Calendar.getInstance()); return new JAXBElement<>(NAME, XMLGregorianCalendar.class, calendar); }
@Override public QName getTypeName(XMLGregorianCalendar cal) { return cal.getXMLSchemaType(); } });
/** * Obtains the value of the MONTHS field as an integer value, * or 0 if not present. * * This method works just like {@link #getYears()} except * that this method works on the MONTHS field. * * @return Months of this <code>Duration</code>. */ public int getMonths() { return getFieldValueAsInt(DatatypeConstants.MONTHS); }
/** * <p>Create a new <code>DatatypeConfigurationException</code> with * the specified detail message and cause.</p> * * @param message The detail message. * @param cause The cause. A <code>null</code> value is permitted, and indicates that the cause is nonexistent or unknown. */ public DatatypeConfigurationException(String message, Throwable cause) { super(message); initCauseByReflection(cause); }
DateTime today = new DateTime(); DateTime yesterday = today.minusDays(1); Duration duration = new Duration(yesterday, today); System.out.println(duration.getStandardDays()); System.out.println(duration.getStandardHours()); System.out.println(duration.getStandardMinutes());
GregorianCalendar c = new GregorianCalendar(); c.setTime(yourDate); XMLGregorianCalendar date2 = DatatypeFactory.newInstance().newXMLGregorianCalendar(c);
public Calendar parseDate(String lexicalXSDDate) { return datatypeFactory.newXMLGregorianCalendar(lexicalXSDDate).toGregorianCalendar(); }
public StandardClasses() throws DatatypeConfigurationException { factory = DatatypeFactory.newInstance(); }
protected Calendar _convert(XMLGregorianCalendar input) { return (input == null) ? null : input.toGregorianCalendar(); } }
@Override protected Duration _deserialize(String value, DeserializationContext ctxt) throws IllegalArgumentException { return _dataTypeFactory.newDuration(value); } }
/** * Obtains the value of the DAYS field as an integer value, * or 0 if not present. * * This method works just like {@link #getYears()} except * that this method works on the DAYS field. * * @return Days of this <code>Duration</code>. */ public int getDays() { return getFieldValueAsInt(DatatypeConstants.DAYS); }
public Object fromString(String s) { return factory.newDuration(s); } }
/** * Obtains the value of the MINUTES field as an integer value, * or 0 if not present. * * This method works just like {@link #getYears()} except * that this method works on the MINUTES field. * * @return Minutes of this <code>Duration</code>. * */ public int getMinutes() { return getFieldValueAsInt(DatatypeConstants.MINUTES); }
public JAXBElement<Duration> standardClassDuration() { Duration duration = factory.newDuration(42000); return new JAXBElement<>(NAME, Duration.class, duration); }
/** * Obtains the value of the HOURS field as an integer value, * or 0 if not present. * * This method works just like {@link #getYears()} except * that this method works on the HOURS field. * * @return Hours of this <code>Duration</code>. * */ public int getHours() { return getFieldValueAsInt(DatatypeConstants.HOURS); }