Java Code Examples for javax.xml.datatype.DatatypeConstants#DATE
The following examples show how to use
javax.xml.datatype.DatatypeConstants#DATE .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DefaultTimeLib.java From jdmn with Apache License 2.0 | 6 votes |
public XMLGregorianCalendar time(XMLGregorianCalendar from) { if (from == null) { return null; } FEELXMLGregorianCalendar calendar = (FEELXMLGregorianCalendar) from.clone(); if (from.getXMLSchemaType() == DatatypeConstants.DATE) { calendar.setYear(DatatypeConstants.FIELD_UNDEFINED); calendar.setMonth(DatatypeConstants.FIELD_UNDEFINED); calendar.setDay(DatatypeConstants.FIELD_UNDEFINED); calendar.setHour(0); calendar.setMinute(0); calendar.setSecond(0); calendar.setZoneID("Z"); } else if (from.getXMLSchemaType() == DatatypeConstants.DATETIME) { calendar.setYear(DatatypeConstants.FIELD_UNDEFINED); calendar.setMonth(DatatypeConstants.FIELD_UNDEFINED); calendar.setDay(DatatypeConstants.FIELD_UNDEFINED); } return this.isValidTime(calendar) ? calendar : null; }
Example 2
Source File: FEELXMLGregorianCalendar.java From jdmn with Apache License 2.0 | 6 votes |
@Override public QName getXMLSchemaType() { int mask = (year != DatatypeConstants.FIELD_UNDEFINED ? 0x20 : 0) | (month != DatatypeConstants.FIELD_UNDEFINED ? 0x10 : 0) | (day != DatatypeConstants.FIELD_UNDEFINED ? 0x08 : 0) | (hour != DatatypeConstants.FIELD_UNDEFINED ? 0x04 : 0) | (minute != DatatypeConstants.FIELD_UNDEFINED ? 0x02 : 0) | (second != DatatypeConstants.FIELD_UNDEFINED ? 0x01 : 0); switch (mask) { case 0x3F: return DatatypeConstants.DATETIME; case 0x38: return DatatypeConstants.DATE; case 0x07: return DatatypeConstants.TIME; default: throw new IllegalStateException( errorMessage("InvalidXGCFields", new Object[] {this.getClass().getName() + "#getXMLSchemaType() :"}) ); } }
Example 3
Source File: XMLGregorianCalendarImpl.java From jdk1.8-source-analysis with Apache License 2.0 | 5 votes |
/** * <p>Return the lexical representation of <code>this</code> instance. * The format is specified in * <a href="http://www.w3.org/TR/xmlschema-2/#dateTime-order">XML Schema 1.0 Part 2, Section 3.2.[7-14].1, * <i>Lexical Representation</i>".</a></p> * * <p>Specific target lexical representation format is determined by * {@link #getXMLSchemaType()}.</p> * * @return XML, as <code>String</code>, representation of this <code>XMLGregorianCalendar</code> * * @throws java.lang.IllegalStateException if the combination of set fields * does not match one of the eight defined XML Schema builtin date/time datatypes. */ public String toXMLFormat() { QName typekind = getXMLSchemaType(); String formatString = null; // Fix 4971612: invalid SCCS macro substitution in data string // no %{alpha}% to avoid SCCS macro substitution if (typekind == DatatypeConstants.DATETIME) { formatString = "%Y-%M-%DT%h:%m:%s" + "%z"; } else if (typekind == DatatypeConstants.DATE) { formatString = "%Y-%M-%D" + "%z"; } else if (typekind == DatatypeConstants.TIME) { formatString = "%h:%m:%s" + "%z"; } else if (typekind == DatatypeConstants.GMONTH) { formatString = "--%M" + "%z"; } else if (typekind == DatatypeConstants.GDAY) { formatString = "---%D" + "%z"; } else if (typekind == DatatypeConstants.GYEAR) { formatString = "%Y" + "%z"; } else if (typekind == DatatypeConstants.GYEARMONTH) { formatString = "%Y-%M" + "%z"; } else if (typekind == DatatypeConstants.GMONTHDAY) { formatString = "--%M-%D" + "%z"; } return format(formatString); }
Example 4
Source File: XMLGregorianCalendarImpl.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
/** * <p>Return the lexical representation of <code>this</code> instance. * The format is specified in * <a href="http://www.w3.org/TR/xmlschema-2/#dateTime-order">XML Schema 1.0 Part 2, Section 3.2.[7-14].1, * <i>Lexical Representation</i>".</a></p> * * <p>Specific target lexical representation format is determined by * {@link #getXMLSchemaType()}.</p> * * @return XML, as <code>String</code>, representation of this <code>XMLGregorianCalendar</code> * * @throws java.lang.IllegalStateException if the combination of set fields * does not match one of the eight defined XML Schema builtin date/time datatypes. */ public String toXMLFormat() { QName typekind = getXMLSchemaType(); String formatString = null; // Fix 4971612: invalid SCCS macro substitution in data string // no %{alpha}% to avoid SCCS macro substitution if (typekind == DatatypeConstants.DATETIME) { formatString = "%Y-%M-%DT%h:%m:%s" + "%z"; } else if (typekind == DatatypeConstants.DATE) { formatString = "%Y-%M-%D" + "%z"; } else if (typekind == DatatypeConstants.TIME) { formatString = "%h:%m:%s" + "%z"; } else if (typekind == DatatypeConstants.GMONTH) { formatString = "--%M" + "%z"; } else if (typekind == DatatypeConstants.GDAY) { formatString = "---%D" + "%z"; } else if (typekind == DatatypeConstants.GYEAR) { formatString = "%Y" + "%z"; } else if (typekind == DatatypeConstants.GYEARMONTH) { formatString = "%Y-%M" + "%z"; } else if (typekind == DatatypeConstants.GMONTHDAY) { formatString = "--%M-%D" + "%z"; } return format(formatString); }
Example 5
Source File: XMLGregorianCalendarImpl.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
/** * <p>Return the lexical representation of <code>this</code> instance. * The format is specified in * <a href="http://www.w3.org/TR/xmlschema-2/#dateTime-order">XML Schema 1.0 Part 2, Section 3.2.[7-14].1, * <i>Lexical Representation</i>".</a></p> * * <p>Specific target lexical representation format is determined by * {@link #getXMLSchemaType()}.</p> * * @return XML, as <code>String</code>, representation of this <code>XMLGregorianCalendar</code> * * @throws java.lang.IllegalStateException if the combination of set fields * does not match one of the eight defined XML Schema builtin date/time datatypes. */ public String toXMLFormat() { QName typekind = getXMLSchemaType(); String formatString = null; // Fix 4971612: invalid SCCS macro substitution in data string // no %{alpha}% to avoid SCCS macro substitution if (typekind == DatatypeConstants.DATETIME) { formatString = "%Y-%M-%DT%h:%m:%s" + "%z"; } else if (typekind == DatatypeConstants.DATE) { formatString = "%Y-%M-%D" + "%z"; } else if (typekind == DatatypeConstants.TIME) { formatString = "%h:%m:%s" + "%z"; } else if (typekind == DatatypeConstants.GMONTH) { formatString = "--%M" + "%z"; } else if (typekind == DatatypeConstants.GDAY) { formatString = "---%D" + "%z"; } else if (typekind == DatatypeConstants.GYEAR) { formatString = "%Y" + "%z"; } else if (typekind == DatatypeConstants.GYEARMONTH) { formatString = "%Y-%M" + "%z"; } else if (typekind == DatatypeConstants.GMONTHDAY) { formatString = "--%M-%D" + "%z"; } return format(formatString); }
Example 6
Source File: XMLGregorianCalendarImpl.java From JDKSourceCode1.8 with MIT License | 5 votes |
/** * <p>Return the lexical representation of <code>this</code> instance. * The format is specified in * <a href="http://www.w3.org/TR/xmlschema-2/#dateTime-order">XML Schema 1.0 Part 2, Section 3.2.[7-14].1, * <i>Lexical Representation</i>".</a></p> * * <p>Specific target lexical representation format is determined by * {@link #getXMLSchemaType()}.</p> * * @return XML, as <code>String</code>, representation of this <code>XMLGregorianCalendar</code> * * @throws java.lang.IllegalStateException if the combination of set fields * does not match one of the eight defined XML Schema builtin date/time datatypes. */ public String toXMLFormat() { QName typekind = getXMLSchemaType(); String formatString = null; // Fix 4971612: invalid SCCS macro substitution in data string // no %{alpha}% to avoid SCCS macro substitution if (typekind == DatatypeConstants.DATETIME) { formatString = "%Y-%M-%DT%h:%m:%s" + "%z"; } else if (typekind == DatatypeConstants.DATE) { formatString = "%Y-%M-%D" + "%z"; } else if (typekind == DatatypeConstants.TIME) { formatString = "%h:%m:%s" + "%z"; } else if (typekind == DatatypeConstants.GMONTH) { formatString = "--%M" + "%z"; } else if (typekind == DatatypeConstants.GDAY) { formatString = "---%D" + "%z"; } else if (typekind == DatatypeConstants.GYEAR) { formatString = "%Y" + "%z"; } else if (typekind == DatatypeConstants.GYEARMONTH) { formatString = "%Y-%M" + "%z"; } else if (typekind == DatatypeConstants.GMONTHDAY) { formatString = "--%M-%D" + "%z"; } return format(formatString); }
Example 7
Source File: FEELXMLGregorianCalendar.java From jdmn with Apache License 2.0 | 5 votes |
@Override public String toXMLFormat() { QName kind = getXMLSchemaType(); String formatString = null; // Fix 4971612: invalid SCCS macro substitution in data string // no %{alpha}% to avoid SCCS macro substitution if (kind == DatatypeConstants.DATETIME) { formatString = "%Y-%M-%DT%h:%m:%s" + "%z"; } else if (kind == DatatypeConstants.DATE) { formatString = "%Y-%M-%D" + "%z"; } else if (kind == DatatypeConstants.TIME) { formatString = "%h:%m:%s" + "%z"; } return format(formatString); }
Example 8
Source File: TCKUtil.java From jdmn with Apache License 2.0 | 5 votes |
private boolean isDate(Object value) { if (value instanceof XMLGregorianCalendar) { return ((XMLGregorianCalendar) value).getXMLSchemaType() == DatatypeConstants.DATE; } else { return false; } }
Example 9
Source File: TCKUtil.java From jdmn with Apache License 2.0 | 5 votes |
private boolean isDate(Object value, Type type) { if (value instanceof XMLGregorianCalendar) { return ((XMLGregorianCalendar) value).getXMLSchemaType() == DatatypeConstants.DATE; } if (type == null) { return false; } return type == DateType.DATE || type.equivalentTo(ListType.DATE_LIST); }
Example 10
Source File: XMLGregorianCalendarImpl.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
/** * <p>Return the lexical representation of <code>this</code> instance. * The format is specified in * <a href="http://www.w3.org/TR/xmlschema-2/#dateTime-order">XML Schema 1.0 Part 2, Section 3.2.[7-14].1, * <i>Lexical Representation</i>".</a></p> * * <p>Specific target lexical representation format is determined by * {@link #getXMLSchemaType()}.</p> * * @return XML, as <code>String</code>, representation of this <code>XMLGregorianCalendar</code> * * @throws java.lang.IllegalStateException if the combination of set fields * does not match one of the eight defined XML Schema builtin date/time datatypes. */ public String toXMLFormat() { QName typekind = getXMLSchemaType(); String formatString = null; // Fix 4971612: invalid SCCS macro substitution in data string // no %{alpha}% to avoid SCCS macro substitution if (typekind == DatatypeConstants.DATETIME) { formatString = "%Y-%M-%DT%h:%m:%s" + "%z"; } else if (typekind == DatatypeConstants.DATE) { formatString = "%Y-%M-%D" + "%z"; } else if (typekind == DatatypeConstants.TIME) { formatString = "%h:%m:%s" + "%z"; } else if (typekind == DatatypeConstants.GMONTH) { formatString = "--%M" + "%z"; } else if (typekind == DatatypeConstants.GDAY) { formatString = "---%D" + "%z"; } else if (typekind == DatatypeConstants.GYEAR) { formatString = "%Y" + "%z"; } else if (typekind == DatatypeConstants.GYEARMONTH) { formatString = "%Y-%M" + "%z"; } else if (typekind == DatatypeConstants.GMONTHDAY) { formatString = "--%M-%D" + "%z"; } return format(formatString); }
Example 11
Source File: XMLGregorianCalendarImpl.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
/** * <p>Return the lexical representation of <code>this</code> instance. * The format is specified in * <a href="http://www.w3.org/TR/xmlschema-2/#dateTime-order">XML Schema 1.0 Part 2, Section 3.2.[7-14].1, * <i>Lexical Representation</i>".</a></p> * * <p>Specific target lexical representation format is determined by * {@link #getXMLSchemaType()}.</p> * * @return XML, as <code>String</code>, representation of this <code>XMLGregorianCalendar</code> * * @throws java.lang.IllegalStateException if the combination of set fields * does not match one of the eight defined XML Schema builtin date/time datatypes. */ public String toXMLFormat() { QName typekind = getXMLSchemaType(); String formatString = null; // Fix 4971612: invalid SCCS macro substitution in data string // no %{alpha}% to avoid SCCS macro substitution if (typekind == DatatypeConstants.DATETIME) { formatString = "%Y-%M-%DT%h:%m:%s" + "%z"; } else if (typekind == DatatypeConstants.DATE) { formatString = "%Y-%M-%D" + "%z"; } else if (typekind == DatatypeConstants.TIME) { formatString = "%h:%m:%s" + "%z"; } else if (typekind == DatatypeConstants.GMONTH) { formatString = "--%M" + "%z"; } else if (typekind == DatatypeConstants.GDAY) { formatString = "---%D" + "%z"; } else if (typekind == DatatypeConstants.GYEAR) { formatString = "%Y" + "%z"; } else if (typekind == DatatypeConstants.GYEARMONTH) { formatString = "%Y-%M" + "%z"; } else if (typekind == DatatypeConstants.GMONTHDAY) { formatString = "--%M-%D" + "%z"; } return format(formatString); }
Example 12
Source File: XMLGregorianCalendarImpl.java From Bytecoder with Apache License 2.0 | 5 votes |
/** * <p>Return the lexical representation of <code>this</code> instance. * The format is specified in * <a href="http://www.w3.org/TR/xmlschema-2/#dateTime-order">XML Schema 1.0 Part 2, Section 3.2.[7-14].1, * <i>Lexical Representation</i>".</a></p> * * <p>Specific target lexical representation format is determined by * {@link #getXMLSchemaType()}.</p> * * @return XML, as <code>String</code>, representation of this <code>XMLGregorianCalendar</code> * * @throws java.lang.IllegalStateException if the combination of set fields * does not match one of the eight defined XML Schema builtin date/time datatypes. */ public String toXMLFormat() { QName typekind = getXMLSchemaType(); String formatString = null; // Fix 4971612: invalid SCCS macro substitution in data string // no %{alpha}% to avoid SCCS macro substitution if (typekind == DatatypeConstants.DATETIME) { formatString = "%Y-%M-%DT%h:%m:%s" + "%z"; } else if (typekind == DatatypeConstants.DATE) { formatString = "%Y-%M-%D" + "%z"; } else if (typekind == DatatypeConstants.TIME) { formatString = "%h:%m:%s" + "%z"; } else if (typekind == DatatypeConstants.GMONTH) { formatString = "--%M" + "%z"; } else if (typekind == DatatypeConstants.GDAY) { formatString = "---%D" + "%z"; } else if (typekind == DatatypeConstants.GYEAR) { formatString = "%Y" + "%z"; } else if (typekind == DatatypeConstants.GYEARMONTH) { formatString = "%Y-%M" + "%z"; } else if (typekind == DatatypeConstants.GMONTHDAY) { formatString = "--%M-%D" + "%z"; } return format(formatString); }
Example 13
Source File: XMLGregorianCalendarImpl.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
/** * <p>Return the lexical representation of <code>this</code> instance. * The format is specified in * <a href="http://www.w3.org/TR/xmlschema-2/#dateTime-order">XML Schema 1.0 Part 2, Section 3.2.[7-14].1, * <i>Lexical Representation</i>".</a></p> * * <p>Specific target lexical representation format is determined by * {@link #getXMLSchemaType()}.</p> * * @return XML, as <code>String</code>, representation of this <code>XMLGregorianCalendar</code> * * @throws java.lang.IllegalStateException if the combination of set fields * does not match one of the eight defined XML Schema builtin date/time datatypes. */ public String toXMLFormat() { QName typekind = getXMLSchemaType(); String formatString = null; // Fix 4971612: invalid SCCS macro substitution in data string // no %{alpha}% to avoid SCCS macro substitution if (typekind == DatatypeConstants.DATETIME) { formatString = "%Y-%M-%DT%h:%m:%s" + "%z"; } else if (typekind == DatatypeConstants.DATE) { formatString = "%Y-%M-%D" + "%z"; } else if (typekind == DatatypeConstants.TIME) { formatString = "%h:%m:%s" + "%z"; } else if (typekind == DatatypeConstants.GMONTH) { formatString = "--%M" + "%z"; } else if (typekind == DatatypeConstants.GDAY) { formatString = "---%D" + "%z"; } else if (typekind == DatatypeConstants.GYEAR) { formatString = "%Y" + "%z"; } else if (typekind == DatatypeConstants.GYEARMONTH) { formatString = "%Y-%M" + "%z"; } else if (typekind == DatatypeConstants.GMONTHDAY) { formatString = "--%M-%D" + "%z"; } return format(formatString); }
Example 14
Source File: XMLGregorianCalendarImpl.java From hottub with GNU General Public License v2.0 | 5 votes |
/** * <p>Return the lexical representation of <code>this</code> instance. * The format is specified in * <a href="http://www.w3.org/TR/xmlschema-2/#dateTime-order">XML Schema 1.0 Part 2, Section 3.2.[7-14].1, * <i>Lexical Representation</i>".</a></p> * * <p>Specific target lexical representation format is determined by * {@link #getXMLSchemaType()}.</p> * * @return XML, as <code>String</code>, representation of this <code>XMLGregorianCalendar</code> * * @throws java.lang.IllegalStateException if the combination of set fields * does not match one of the eight defined XML Schema builtin date/time datatypes. */ public String toXMLFormat() { QName typekind = getXMLSchemaType(); String formatString = null; // Fix 4971612: invalid SCCS macro substitution in data string // no %{alpha}% to avoid SCCS macro substitution if (typekind == DatatypeConstants.DATETIME) { formatString = "%Y-%M-%DT%h:%m:%s" + "%z"; } else if (typekind == DatatypeConstants.DATE) { formatString = "%Y-%M-%D" + "%z"; } else if (typekind == DatatypeConstants.TIME) { formatString = "%h:%m:%s" + "%z"; } else if (typekind == DatatypeConstants.GMONTH) { formatString = "--%M" + "%z"; } else if (typekind == DatatypeConstants.GDAY) { formatString = "---%D" + "%z"; } else if (typekind == DatatypeConstants.GYEAR) { formatString = "%Y" + "%z"; } else if (typekind == DatatypeConstants.GYEARMONTH) { formatString = "%Y-%M" + "%z"; } else if (typekind == DatatypeConstants.GMONTHDAY) { formatString = "--%M-%D" + "%z"; } return format(formatString); }
Example 15
Source File: XMLGregorianCalendarImpl.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
/** * <p>Return the lexical representation of <code>this</code> instance. * The format is specified in * <a href="http://www.w3.org/TR/xmlschema-2/#dateTime-order">XML Schema 1.0 Part 2, Section 3.2.[7-14].1, * <i>Lexical Representation</i>".</a></p> * * <p>Specific target lexical representation format is determined by * {@link #getXMLSchemaType()}.</p> * * @return XML, as <code>String</code>, representation of this <code>XMLGregorianCalendar</code> * * @throws java.lang.IllegalStateException if the combination of set fields * does not match one of the eight defined XML Schema builtin date/time datatypes. */ public String toXMLFormat() { QName typekind = getXMLSchemaType(); String formatString = null; // Fix 4971612: invalid SCCS macro substitution in data string // no %{alpha}% to avoid SCCS macro substitution if (typekind == DatatypeConstants.DATETIME) { formatString = "%Y-%M-%DT%h:%m:%s" + "%z"; } else if (typekind == DatatypeConstants.DATE) { formatString = "%Y-%M-%D" + "%z"; } else if (typekind == DatatypeConstants.TIME) { formatString = "%h:%m:%s" + "%z"; } else if (typekind == DatatypeConstants.GMONTH) { formatString = "--%M" + "%z"; } else if (typekind == DatatypeConstants.GDAY) { formatString = "---%D" + "%z"; } else if (typekind == DatatypeConstants.GYEAR) { formatString = "%Y" + "%z"; } else if (typekind == DatatypeConstants.GYEARMONTH) { formatString = "%Y-%M" + "%z"; } else if (typekind == DatatypeConstants.GMONTHDAY) { formatString = "--%M-%D" + "%z"; } return format(formatString); }
Example 16
Source File: XMLGregorianCalendarImpl.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
/** * <p>Return the lexical representation of <code>this</code> instance. * The format is specified in * <a href="http://www.w3.org/TR/xmlschema-2/#dateTime-order">XML Schema 1.0 Part 2, Section 3.2.[7-14].1, * <i>Lexical Representation</i>".</a></p> * * <p>Specific target lexical representation format is determined by * {@link #getXMLSchemaType()}.</p> * * @return XML, as <code>String</code>, representation of this <code>XMLGregorianCalendar</code> * * @throws java.lang.IllegalStateException if the combination of set fields * does not match one of the eight defined XML Schema builtin date/time datatypes. */ public String toXMLFormat() { QName typekind = getXMLSchemaType(); String formatString = null; // Fix 4971612: invalid SCCS macro substitution in data string // no %{alpha}% to avoid SCCS macro substitution if (typekind == DatatypeConstants.DATETIME) { formatString = "%Y-%M-%DT%h:%m:%s" + "%z"; } else if (typekind == DatatypeConstants.DATE) { formatString = "%Y-%M-%D" + "%z"; } else if (typekind == DatatypeConstants.TIME) { formatString = "%h:%m:%s" + "%z"; } else if (typekind == DatatypeConstants.GMONTH) { formatString = "--%M" + "%z"; } else if (typekind == DatatypeConstants.GDAY) { formatString = "---%D" + "%z"; } else if (typekind == DatatypeConstants.GYEAR) { formatString = "%Y" + "%z"; } else if (typekind == DatatypeConstants.GYEARMONTH) { formatString = "%Y-%M" + "%z"; } else if (typekind == DatatypeConstants.GMONTHDAY) { formatString = "--%M-%D" + "%z"; } return format(formatString); }