Examples of toGregorianCalendar()


Examples of java.util.Calendar.toGregorianCalendar()

        if (XMLGregorianCalendar.class.isAssignableFrom(source)) {
            if (Calendar.class.isAssignableFrom(target)) {
                return new Converter() {
                    public <T> T convert(Object source, Class<T> target) throws Exception {
                        XMLGregorianCalendar calendar = (XMLGregorianCalendar) source;
                        return (T) calendar.toGregorianCalendar();
                    }
                };
            }
            if (Date.class.isAssignableFrom(target)) {
                return new Converter() {
View Full Code Here

Examples of javax.xml.datatype.XMLGregorianCalendar.toGregorianCalendar()

  @Test
  public void testXmlGregorianCalendar() {
    XMLGregorianCalendar xmlCalendar = mock(XMLGregorianCalendar.class);
    GregorianCalendar expected = new GregorianCalendar();
    when(xmlCalendar.toGregorianCalendar()).thenReturn(expected);
    Date date = new Date(expected.getTimeInMillis());

    assertEquals(date, converter.convert(Date.class, xmlCalendar));
  }
View Full Code Here

Examples of javax.xml.datatype.XMLGregorianCalendar.toGregorianCalendar()

    throws IllegalArgumentException
  {
    XMLGregorianCalendar xmlCal =
      getDatatypeFactory().newXMLGregorianCalendar(lexicalXSDDate);

    return xmlCal.toGregorianCalendar();
  }

  public Calendar parseDateTime(String lexicalXSDDateTime)
    throws IllegalArgumentException
  {
View Full Code Here

Examples of javax.xml.datatype.XMLGregorianCalendar.toGregorianCalendar()

    throws IllegalArgumentException
  {
    XMLGregorianCalendar xmlCal =
      getDatatypeFactory().newXMLGregorianCalendar(lexicalXSDDateTime);

    return xmlCal.toGregorianCalendar();
  }

  public BigDecimal parseDecimal(String lexicalXSDDecimal)
  {
    return new BigDecimal(lexicalXSDDecimal);
View Full Code Here

Examples of javax.xml.datatype.XMLGregorianCalendar.toGregorianCalendar()

    throws IllegalArgumentException
  {
    XMLGregorianCalendar xmlCal =
      getDatatypeFactory().newXMLGregorianCalendar(lexicalXSDTime);

    return xmlCal.toGregorianCalendar();
  }

  public long parseUnsignedInt(String lexicalXSDUnsignedInt)
  {
    long x = parseLong(lexicalXSDUnsignedInt);
View Full Code Here

Examples of javax.xml.datatype.XMLGregorianCalendar.toGregorianCalendar()

    assertEquals(cal.get(Calendar.MONTH) + 1, xmlCal.getMonth());
    assertEquals(cal.get(Calendar.DAY_OF_MONTH), xmlCal.getDay());
    assertEquals(cal.get(Calendar.HOUR_OF_DAY), xmlCal.getHour());
    assertEquals(cal.get(Calendar.MINUTE), xmlCal.getMinute());
    assertEquals(cal.get(Calendar.SECOND), xmlCal.getSecond());
    assertEquals(cal.getTime(), xmlCal.toGregorianCalendar().getTime());
  }
}
View Full Code Here

Examples of javax.xml.datatype.XMLGregorianCalendar.toGregorianCalendar()

         if (askedLifetime != null)
         {
            final XMLGregorianCalendar askedLifetimeCurrentTime = askedLifetime.getCurrentTime();
            long currentTime = toLongDate(askedLifetimeCurrentTime);
            long terminationTime = toLongDate(askedLifetime.getTerminationTime());
            long refreshDuration = askedLifetime.getRefreshDuration().getTimeInMillis(askedLifetimeCurrentTime.toGregorianCalendar());
            exportContext = exportManager.createExportContext(exportByValueRequired, currentTime, terminationTime, refreshDuration);
         }
         else
         {
            exportContext = exportManager.createExportContext(exportByValueRequired, -1, -1, -1);
View Full Code Here

Examples of javax.xml.datatype.XMLGregorianCalendar.toGregorianCalendar()

             }else{
                 throw XMLConversionException.incorrectTimestampDateTimeFormat(sourceString);
             }
        }

        GregorianCalendar cal = xmlGregorianCalender.toGregorianCalendar();
        cal.setTimeZone(getTimeZone());

        QName  calendarQName = xmlGregorianCalender.getXMLSchemaType();
        if(!calendarQName.equals(schemaType)){
            if (XMLConstants.DATE_QNAME.equals(schemaType)){
View Full Code Here

Examples of javax.xml.datatype.XMLGregorianCalendar.toGregorianCalendar()

        }
        // An XMLGregorianCalendar will be used to parse the date string
        XMLGregorianCalendar xgc = getXMLConversionManager().convertStringToXMLGregorianCalendar(dateString);
        Calendar cal;
        if (xgc.getTimezone() == DatatypeConstants.FIELD_UNDEFINED) {
            cal = xgc.toGregorianCalendar(getXMLConversionManager().getTimeZone(), locale, null);
            cal.clear(Calendar.ZONE_OFFSET);
        } else {
            cal = xgc.toGregorianCalendar(xgc.getTimeZone(xgc.getTimezone()), locale, null);
        }
        return cal;
View Full Code Here

Examples of javax.xml.datatype.XMLGregorianCalendar.toGregorianCalendar()

        Calendar cal;
        if (xgc.getTimezone() == DatatypeConstants.FIELD_UNDEFINED) {
            cal = xgc.toGregorianCalendar(getXMLConversionManager().getTimeZone(), locale, null);
            cal.clear(Calendar.ZONE_OFFSET);
        } else {
            cal = xgc.toGregorianCalendar(xgc.getTimeZone(xgc.getTimezone()), locale, null);
        }
        return cal;
    }

    /**
 
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.