Java Code Examples for javax.xml.datatype.XMLGregorianCalendar#getMonth()
The following examples show how to use
javax.xml.datatype.XMLGregorianCalendar#getMonth() .
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: XMLGregorianCalendarImpl.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
/** * <p>Returns a hash code consistent with the definition of the equals method.</p> * * @return hash code of this object. */ public int hashCode() { // Following two dates compare to EQUALS since in different timezones. // 2000-01-15T12:00:00-05:00 == 2000-01-15T13:00:00-04:00 // // Must ensure both instances generate same hashcode by normalizing // this to UTC timezone. int timezone = getTimezone(); if (timezone == DatatypeConstants.FIELD_UNDEFINED) { timezone = 0; } XMLGregorianCalendar gc = this; if (timezone != 0) { gc = this.normalizeToTimezone(getTimezone()); } return gc.getYear() + gc.getMonth() + gc.getDay() + gc.getHour() + gc.getMinute() + gc.getSecond(); }
Example 2
Source File: XMLGregorianCalendarImpl.java From openjdk-8-source with GNU General Public License v2.0 | 6 votes |
/** * <p>Returns a hash code consistent with the definition of the equals method.</p> * * @return hash code of this object. */ public int hashCode() { // Following two dates compare to EQUALS since in different timezones. // 2000-01-15T12:00:00-05:00 == 2000-01-15T13:00:00-04:00 // // Must ensure both instances generate same hashcode by normalizing // this to UTC timezone. int timezone = getTimezone(); if (timezone == DatatypeConstants.FIELD_UNDEFINED) { timezone = 0; } XMLGregorianCalendar gc = this; if (timezone != 0) { gc = this.normalizeToTimezone(getTimezone()); } return gc.getYear() + gc.getMonth() + gc.getDay() + gc.getHour() + gc.getMinute() + gc.getSecond(); }
Example 3
Source File: XMLGregorianCalendarImpl.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
/** * <p>Returns a hash code consistent with the definition of the equals method.</p> * * @return hash code of this object. */ public int hashCode() { // Following two dates compare to EQUALS since in different timezones. // 2000-01-15T12:00:00-05:00 == 2000-01-15T13:00:00-04:00 // // Must ensure both instances generate same hashcode by normalizing // this to UTC timezone. int timezone = getTimezone(); if (timezone == DatatypeConstants.FIELD_UNDEFINED) { timezone = 0; } XMLGregorianCalendar gc = this; if (timezone != 0) { gc = this.normalizeToTimezone(getTimezone()); } return gc.getYear() + gc.getMonth() + gc.getDay() + gc.getHour() + gc.getMinute() + gc.getSecond(); }
Example 4
Source File: XMLGregorianCalendarImpl.java From JDKSourceCode1.8 with MIT License | 6 votes |
/** * <p>Returns a hash code consistent with the definition of the equals method.</p> * * @return hash code of this object. */ public int hashCode() { // Following two dates compare to EQUALS since in different timezones. // 2000-01-15T12:00:00-05:00 == 2000-01-15T13:00:00-04:00 // // Must ensure both instances generate same hashcode by normalizing // this to UTC timezone. int timezone = getTimezone(); if (timezone == DatatypeConstants.FIELD_UNDEFINED) { timezone = 0; } XMLGregorianCalendar gc = this; if (timezone != 0) { gc = this.normalizeToTimezone(getTimezone()); } return gc.getYear() + gc.getMonth() + gc.getDay() + gc.getHour() + gc.getMinute() + gc.getSecond(); }
Example 5
Source File: DateTimeConverter.java From atdl4j with MIT License | 6 votes |
public static DateTime convertXMLGregorianCalendarToDateTime( XMLGregorianCalendar aXMLGregorianCalendar, Timezone aTimezone ) { // -- DateTime(int year, int monthOfYear, int dayOfMonth, int hourOfDay, int minuteOfHour, int secondOfMinute, int millisOfSecond) -- int tempSubsecond = 0; if ( aXMLGregorianCalendar.getFractionalSecond() != null ) { tempSubsecond = aXMLGregorianCalendar.getFractionalSecond().intValue(); } DateTimeZone tempDateTimeZone = convertTimezoneToDateTimeZone( aTimezone ); if ( tempDateTimeZone == null ) { tempDateTimeZone = DateTimeZone.getDefault(); } return new DateTime( aXMLGregorianCalendar.getYear(), aXMLGregorianCalendar.getMonth(), aXMLGregorianCalendar.getDay(), aXMLGregorianCalendar.getHour(), aXMLGregorianCalendar.getMinute(), aXMLGregorianCalendar.getSecond(), tempSubsecond, tempDateTimeZone ); }
Example 6
Source File: FEELXMLGregorianCalendar.java From jdmn with Apache License 2.0 | 6 votes |
@Override public int hashCode() { // Following two dates compare to EQUALS since in different timezones. // 2000-01-15T12:00:00-05:00 == 2000-01-15T13:00:00-04:00 // // Must ensure both instances generate same hashcode by normalizing this to UTC timezone. int timezone = getTimezone(); if (timezone == DatatypeConstants.FIELD_UNDEFINED) { timezone = 0; } XMLGregorianCalendar gc = this; if (timezone != 0) { gc = this.normalizeToTimezone(getZoneID()); } return gc.getYear() + gc.getMonth() + gc.getDay() + gc.getHour() + gc.getMinute() + gc.getSecond(); }
Example 7
Source File: XMLGregorianCalendarImpl.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
/** * <p>Returns a hash code consistent with the definition of the equals method.</p> * * @return hash code of this object. */ public int hashCode() { // Following two dates compare to EQUALS since in different timezones. // 2000-01-15T12:00:00-05:00 == 2000-01-15T13:00:00-04:00 // // Must ensure both instances generate same hashcode by normalizing // this to UTC timezone. int timezone = getTimezone(); if (timezone == DatatypeConstants.FIELD_UNDEFINED) { timezone = 0; } XMLGregorianCalendar gc = this; if (timezone != 0) { gc = this.normalizeToTimezone(getTimezone()); } return gc.getYear() + gc.getMonth() + gc.getDay() + gc.getHour() + gc.getMinute() + gc.getSecond(); }
Example 8
Source File: XMLGregorianCalendarImpl.java From hottub with GNU General Public License v2.0 | 6 votes |
/** * <p>Returns a hash code consistent with the definition of the equals method.</p> * * @return hash code of this object. */ public int hashCode() { // Following two dates compare to EQUALS since in different timezones. // 2000-01-15T12:00:00-05:00 == 2000-01-15T13:00:00-04:00 // // Must ensure both instances generate same hashcode by normalizing // this to UTC timezone. int timezone = getTimezone(); if (timezone == DatatypeConstants.FIELD_UNDEFINED) { timezone = 0; } XMLGregorianCalendar gc = this; if (timezone != 0) { gc = this.normalizeToTimezone(getTimezone()); } return gc.getYear() + gc.getMonth() + gc.getDay() + gc.getHour() + gc.getMinute() + gc.getSecond(); }
Example 9
Source File: AbstractTypeTestClient.java From cxf with Apache License 2.0 | 5 votes |
protected boolean equalsDateTime(XMLGregorianCalendar orig, XMLGregorianCalendar actual) { boolean result = false; if ((orig.getYear() == actual.getYear()) && (orig.getMonth() == actual.getMonth()) && (orig.getDay() == actual.getDay()) && (orig.getHour() == actual.getHour()) && (orig.getMinute() == actual.getMinute()) && (orig.getSecond() == actual.getSecond()) && (orig.getMillisecond() == actual.getMillisecond())) { result = orig.getTimezone() == actual.getTimezone(); } return result; }
Example 10
Source File: CalendarUtil.java From hsac-fitnesse-fixtures with Apache License 2.0 | 5 votes |
/** * Determines number of years between two dates so that premium duration can * be established. * * @param startDate start date of a period (e.g. date of birth of insured * party). * @param endDate end date (e.g. premium end date of an insurance). * @return number of years between start and end. */ public int getDurationInYears(XMLGregorianCalendar startDate, XMLGregorianCalendar endDate) { int startYear = startDate.getYear(); final int dec = 12; if (startDate.getMonth() == dec) { // started in December, increase year with one startYear++; } int endYear = endDate.getYear(); return endYear - startYear; }
Example 11
Source File: XMLGregorianCalendarTypeInfoCompiler.java From jsonix-schema-compiler with BSD 2-Clause "Simplified" License | 5 votes |
@Override public JSAssignmentExpression createValue(MappingCompiler<T, C> mappingCompiler, String item) { final JSCodeModel codeModel = mappingCompiler.getCodeModel(); final JSObjectLiteral result = codeModel.object(); final XMLGregorianCalendar calendar = datatypeFactory.newXMLGregorianCalendar(item); if (calendar.getYear() != DatatypeConstants.FIELD_UNDEFINED) { result.append("year", codeModel.integer(calendar.getYear())); } if (calendar.getMonth() != DatatypeConstants.FIELD_UNDEFINED) { result.append("month", codeModel.integer(calendar.getMonth())); } if (calendar.getDay() != DatatypeConstants.FIELD_UNDEFINED) { result.append("day", codeModel.integer(calendar.getDay())); } if (calendar.getHour() != DatatypeConstants.FIELD_UNDEFINED) { result.append("hour", codeModel.integer(calendar.getHour())); } if (calendar.getMinute() != DatatypeConstants.FIELD_UNDEFINED) { result.append("minute", codeModel.integer(calendar.getMinute())); } if (calendar.getSecond() != DatatypeConstants.FIELD_UNDEFINED) { result.append("second", codeModel.integer(calendar.getSecond())); } if (calendar.getFractionalSecond() != null) { result.append("second", codeModel.decimal(calendar.getFractionalSecond().toString())); } if (calendar.getTimezone() != DatatypeConstants.FIELD_UNDEFINED) { result.append("timeZone", codeModel.integer(calendar.getTimezone())); } return result; }
Example 12
Source File: SWTClockWidget.java From atdl4j with MIT License | 5 votes |
/** * Used when applying Clock@initValue (xs:time) * @param aValue * @param @InitValueMode */ protected void setAndRenderInitValue( XMLGregorianCalendar aValue, int aInitValueMode ) { if ( aValue != null ) { // -- Note that this will throw IllegalArgumentException if timezone ID // specified cannot be resolved -- DateTimeZone tempLocalMktTz = getLocalMktTz(); logger.debug( "control.getID(): " + control.getID() + " aValue: " + aValue + " getLocalMktTz(): " + tempLocalMktTz ); // -- localMktTz is required when using/interpreting aValue -- if ( tempLocalMktTz == null ) { throw new IllegalArgumentException( "localMktTz is required when aValue (" + aValue + ") is specified. (Control.ID: " + control.getID() + ")" ); } DateTime tempNow = new DateTime( tempLocalMktTz ); DateTime tempInit = new DateTime( ( showMonthYear && aValue.getYear() != DatatypeConstants.FIELD_UNDEFINED ) ? aValue.getYear() : tempNow.getYear(), ( showMonthYear && aValue.getMonth() != DatatypeConstants.FIELD_UNDEFINED ) ? aValue.getMonth() : tempNow.getMonthOfYear(), ( showMonthYear && aValue.getDay() != DatatypeConstants.FIELD_UNDEFINED ) ? aValue.getDay() : tempNow.getDayOfMonth(), ( showMonthYear && aValue.getHour() != DatatypeConstants.FIELD_UNDEFINED ) ? aValue.getHour() : 0, ( showMonthYear && aValue.getMinute() != DatatypeConstants.FIELD_UNDEFINED ) ? aValue.getMinute() : 0, ( showMonthYear && aValue.getSecond() != DatatypeConstants.FIELD_UNDEFINED ) ? aValue.getSecond(): 0, 0, tempLocalMktTz ); if ( ( aInitValueMode == Atdl4jConstants.CLOCK_INIT_VALUE_MODE_USE_CURRENT_TIME_IF_LATER ) && ( tempNow.isAfter( tempInit ) ) ) { // -- Use current time -- tempInit = tempNow; } // -- Make sure that the value is rendered on the display in local timezone -- setValue( tempInit.withZone( DateTimeZone.getDefault() ) ); } }
Example 13
Source File: Month.java From rdf4j with BSD 3-Clause "New" or "Revised" License | 5 votes |
@Override public Literal evaluate(ValueFactory valueFactory, Value... args) throws ValueExprEvaluationException { if (args.length != 1) { throw new ValueExprEvaluationException("MONTH requires 1 argument, got " + args.length); } Value argValue = args[0]; if (argValue instanceof Literal) { Literal literal = (Literal) argValue; IRI datatype = literal.getDatatype(); if (datatype != null && XMLDatatypeUtil.isCalendarDatatype(datatype)) { try { XMLGregorianCalendar calValue = literal.calendarValue(); int month = calValue.getMonth(); if (DatatypeConstants.FIELD_UNDEFINED != month) { return valueFactory.createLiteral(String.valueOf(month), XMLSchema.INTEGER); } else { throw new ValueExprEvaluationException("can not determine month from value: " + argValue); } } catch (IllegalArgumentException e) { throw new ValueExprEvaluationException("illegal calendar value: " + argValue); } } else { throw new ValueExprEvaluationException("unexpected input value for function: " + argValue); } } else { throw new ValueExprEvaluationException("unexpected input value for function: " + args[0]); } }
Example 14
Source File: DateTimeCast.java From rdf4j with BSD 3-Clause "New" or "Revised" License | 4 votes |
@Override protected Literal convert(ValueFactory vf, Value value) throws ValueExprEvaluationException { if (value instanceof Literal) { Literal literal = (Literal) value; IRI datatype = literal.getDatatype(); if (datatype.equals(XMLSchema.DATE)) { // If ST is xs:date, then let SYR be eg:convertYearToString( // fn:year-from-date( SV )), let SMO be eg:convertTo2CharString( // fn:month-from-date( SV )), let SDA be eg:convertTo2CharString( // fn:day-from-date( SV )) and let STZ be eg:convertTZtoString( // fn:timezone-from-date( SV )); TV is xs:dateTime( fn:concat( // SYR , '-', SMO , '-', SDA , 'T00:00:00 ', STZ ) ). try { XMLGregorianCalendar calValue = literal.calendarValue(); int year = calValue.getYear(); int month = calValue.getMonth(); int day = calValue.getDay(); int timezoneOffset = calValue.getTimezone(); if (DatatypeConstants.FIELD_UNDEFINED != year && DatatypeConstants.FIELD_UNDEFINED != month && DatatypeConstants.FIELD_UNDEFINED != day) { StringBuilder dtBuilder = new StringBuilder(); dtBuilder.append(year); dtBuilder.append("-"); if (month < 10) { dtBuilder.append("0"); } dtBuilder.append(month); dtBuilder.append("-"); if (day < 10) { dtBuilder.append("0"); } dtBuilder.append(day); dtBuilder.append("T00:00:00"); if (DatatypeConstants.FIELD_UNDEFINED != timezoneOffset) { int minutes = Math.abs(timezoneOffset); int hours = minutes / 60; minutes = minutes - (hours * 60); if (timezoneOffset > 0) { dtBuilder.append("+"); } else { dtBuilder.append("-"); } if (hours < 10) { dtBuilder.append("0"); } dtBuilder.append(hours); dtBuilder.append(":"); if (minutes < 10) { dtBuilder.append("0"); } dtBuilder.append(minutes); } return vf.createLiteral(dtBuilder.toString(), XMLSchema.DATETIME); } else { throw typeError(literal, null); } } catch (IllegalArgumentException e) { throw typeError(literal, e); } } } throw typeError(value, null); }
Example 15
Source File: RuntimeBuiltinLeafInfoImpl.java From openjdk-8 with GNU General Public License v2.0 | 4 votes |
private static void checkXmlGregorianCalendarFieldRef(QName type, XMLGregorianCalendar cal)throws javax.xml.bind.MarshalException{ StringBuilder buf = new StringBuilder(); int bitField = xmlGregorianCalendarFieldRef.get(type); final int l = 0x1; int pos = 0; while (bitField != 0x0){ int bit = bitField & l; bitField >>>= 4; pos++; if (bit == 1) { switch(pos){ case 1: if (cal.getSecond() == DatatypeConstants.FIELD_UNDEFINED){ buf.append(" ").append(Messages.XMLGREGORIANCALENDAR_SEC); } break; case 2: if (cal.getMinute() == DatatypeConstants.FIELD_UNDEFINED){ buf.append(" ").append(Messages.XMLGREGORIANCALENDAR_MIN); } break; case 3: if (cal.getHour() == DatatypeConstants.FIELD_UNDEFINED){ buf.append(" ").append(Messages.XMLGREGORIANCALENDAR_HR); } break; case 4: if (cal.getDay() == DatatypeConstants.FIELD_UNDEFINED){ buf.append(" ").append(Messages.XMLGREGORIANCALENDAR_DAY); } break; case 5: if (cal.getMonth() == DatatypeConstants.FIELD_UNDEFINED){ buf.append(" ").append(Messages.XMLGREGORIANCALENDAR_MONTH); } break; case 6: if (cal.getYear() == DatatypeConstants.FIELD_UNDEFINED){ buf.append(" ").append(Messages.XMLGREGORIANCALENDAR_YEAR); } break; case 7: // ignore timezone setting break; } } } if (buf.length() > 0){ throw new javax.xml.bind.MarshalException( Messages.XMLGREGORIANCALENDAR_INVALID.format(type.getLocalPart()) + buf.toString()); } }
Example 16
Source File: RuntimeBuiltinLeafInfoImpl.java From hottub with GNU General Public License v2.0 | 4 votes |
private static void checkXmlGregorianCalendarFieldRef(QName type, XMLGregorianCalendar cal)throws javax.xml.bind.MarshalException{ StringBuilder buf = new StringBuilder(); int bitField = xmlGregorianCalendarFieldRef.get(type); final int l = 0x1; int pos = 0; while (bitField != 0x0){ int bit = bitField & l; bitField >>>= 4; pos++; if (bit == 1) { switch(pos){ case 1: if (cal.getSecond() == DatatypeConstants.FIELD_UNDEFINED){ buf.append(" ").append(Messages.XMLGREGORIANCALENDAR_SEC); } break; case 2: if (cal.getMinute() == DatatypeConstants.FIELD_UNDEFINED){ buf.append(" ").append(Messages.XMLGREGORIANCALENDAR_MIN); } break; case 3: if (cal.getHour() == DatatypeConstants.FIELD_UNDEFINED){ buf.append(" ").append(Messages.XMLGREGORIANCALENDAR_HR); } break; case 4: if (cal.getDay() == DatatypeConstants.FIELD_UNDEFINED){ buf.append(" ").append(Messages.XMLGREGORIANCALENDAR_DAY); } break; case 5: if (cal.getMonth() == DatatypeConstants.FIELD_UNDEFINED){ buf.append(" ").append(Messages.XMLGREGORIANCALENDAR_MONTH); } break; case 6: if (cal.getYear() == DatatypeConstants.FIELD_UNDEFINED){ buf.append(" ").append(Messages.XMLGREGORIANCALENDAR_YEAR); } break; case 7: // ignore timezone setting break; } } } if (buf.length() > 0){ throw new javax.xml.bind.MarshalException( Messages.XMLGREGORIANCALENDAR_INVALID.format(type.getLocalPart()) + buf.toString()); } }
Example 17
Source File: RuntimeBuiltinLeafInfoImpl.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
private static void checkXmlGregorianCalendarFieldRef(QName type, XMLGregorianCalendar cal)throws javax.xml.bind.MarshalException{ StringBuilder buf = new StringBuilder(); int bitField = xmlGregorianCalendarFieldRef.get(type); final int l = 0x1; int pos = 0; while (bitField != 0x0){ int bit = bitField & l; bitField >>>= 4; pos++; if (bit == 1) { switch(pos){ case 1: if (cal.getSecond() == DatatypeConstants.FIELD_UNDEFINED){ buf.append(" ").append(Messages.XMLGREGORIANCALENDAR_SEC); } break; case 2: if (cal.getMinute() == DatatypeConstants.FIELD_UNDEFINED){ buf.append(" ").append(Messages.XMLGREGORIANCALENDAR_MIN); } break; case 3: if (cal.getHour() == DatatypeConstants.FIELD_UNDEFINED){ buf.append(" ").append(Messages.XMLGREGORIANCALENDAR_HR); } break; case 4: if (cal.getDay() == DatatypeConstants.FIELD_UNDEFINED){ buf.append(" ").append(Messages.XMLGREGORIANCALENDAR_DAY); } break; case 5: if (cal.getMonth() == DatatypeConstants.FIELD_UNDEFINED){ buf.append(" ").append(Messages.XMLGREGORIANCALENDAR_MONTH); } break; case 6: if (cal.getYear() == DatatypeConstants.FIELD_UNDEFINED){ buf.append(" ").append(Messages.XMLGREGORIANCALENDAR_YEAR); } break; case 7: // ignore timezone setting break; } } } if (buf.length() > 0){ throw new javax.xml.bind.MarshalException( Messages.XMLGREGORIANCALENDAR_INVALID.format(type.getLocalPart()) + buf.toString()); } }
Example 18
Source File: RuntimeBuiltinLeafInfoImpl.java From openjdk-jdk8u with GNU General Public License v2.0 | 4 votes |
private static void checkXmlGregorianCalendarFieldRef(QName type, XMLGregorianCalendar cal)throws javax.xml.bind.MarshalException{ StringBuilder buf = new StringBuilder(); int bitField = xmlGregorianCalendarFieldRef.get(type); final int l = 0x1; int pos = 0; while (bitField != 0x0){ int bit = bitField & l; bitField >>>= 4; pos++; if (bit == 1) { switch(pos){ case 1: if (cal.getSecond() == DatatypeConstants.FIELD_UNDEFINED){ buf.append(" ").append(Messages.XMLGREGORIANCALENDAR_SEC); } break; case 2: if (cal.getMinute() == DatatypeConstants.FIELD_UNDEFINED){ buf.append(" ").append(Messages.XMLGREGORIANCALENDAR_MIN); } break; case 3: if (cal.getHour() == DatatypeConstants.FIELD_UNDEFINED){ buf.append(" ").append(Messages.XMLGREGORIANCALENDAR_HR); } break; case 4: if (cal.getDay() == DatatypeConstants.FIELD_UNDEFINED){ buf.append(" ").append(Messages.XMLGREGORIANCALENDAR_DAY); } break; case 5: if (cal.getMonth() == DatatypeConstants.FIELD_UNDEFINED){ buf.append(" ").append(Messages.XMLGREGORIANCALENDAR_MONTH); } break; case 6: if (cal.getYear() == DatatypeConstants.FIELD_UNDEFINED){ buf.append(" ").append(Messages.XMLGREGORIANCALENDAR_YEAR); } break; case 7: // ignore timezone setting break; } } } if (buf.length() > 0){ throw new javax.xml.bind.MarshalException( Messages.XMLGREGORIANCALENDAR_INVALID.format(type.getLocalPart()) + buf.toString()); } }
Example 19
Source File: RuntimeBuiltinLeafInfoImpl.java From jdk8u60 with GNU General Public License v2.0 | 4 votes |
private static void checkXmlGregorianCalendarFieldRef(QName type, XMLGregorianCalendar cal)throws javax.xml.bind.MarshalException{ StringBuilder buf = new StringBuilder(); int bitField = xmlGregorianCalendarFieldRef.get(type); final int l = 0x1; int pos = 0; while (bitField != 0x0){ int bit = bitField & l; bitField >>>= 4; pos++; if (bit == 1) { switch(pos){ case 1: if (cal.getSecond() == DatatypeConstants.FIELD_UNDEFINED){ buf.append(" ").append(Messages.XMLGREGORIANCALENDAR_SEC); } break; case 2: if (cal.getMinute() == DatatypeConstants.FIELD_UNDEFINED){ buf.append(" ").append(Messages.XMLGREGORIANCALENDAR_MIN); } break; case 3: if (cal.getHour() == DatatypeConstants.FIELD_UNDEFINED){ buf.append(" ").append(Messages.XMLGREGORIANCALENDAR_HR); } break; case 4: if (cal.getDay() == DatatypeConstants.FIELD_UNDEFINED){ buf.append(" ").append(Messages.XMLGREGORIANCALENDAR_DAY); } break; case 5: if (cal.getMonth() == DatatypeConstants.FIELD_UNDEFINED){ buf.append(" ").append(Messages.XMLGREGORIANCALENDAR_MONTH); } break; case 6: if (cal.getYear() == DatatypeConstants.FIELD_UNDEFINED){ buf.append(" ").append(Messages.XMLGREGORIANCALENDAR_YEAR); } break; case 7: // ignore timezone setting break; } } } if (buf.length() > 0){ throw new javax.xml.bind.MarshalException( Messages.XMLGREGORIANCALENDAR_INVALID.format(type.getLocalPart()) + buf.toString()); } }
Example 20
Source File: RuntimeBuiltinLeafInfoImpl.java From TencentKona-8 with GNU General Public License v2.0 | 4 votes |
private static void checkXmlGregorianCalendarFieldRef(QName type, XMLGregorianCalendar cal)throws javax.xml.bind.MarshalException{ StringBuilder buf = new StringBuilder(); int bitField = xmlGregorianCalendarFieldRef.get(type); final int l = 0x1; int pos = 0; while (bitField != 0x0){ int bit = bitField & l; bitField >>>= 4; pos++; if (bit == 1) { switch(pos){ case 1: if (cal.getSecond() == DatatypeConstants.FIELD_UNDEFINED){ buf.append(" ").append(Messages.XMLGREGORIANCALENDAR_SEC); } break; case 2: if (cal.getMinute() == DatatypeConstants.FIELD_UNDEFINED){ buf.append(" ").append(Messages.XMLGREGORIANCALENDAR_MIN); } break; case 3: if (cal.getHour() == DatatypeConstants.FIELD_UNDEFINED){ buf.append(" ").append(Messages.XMLGREGORIANCALENDAR_HR); } break; case 4: if (cal.getDay() == DatatypeConstants.FIELD_UNDEFINED){ buf.append(" ").append(Messages.XMLGREGORIANCALENDAR_DAY); } break; case 5: if (cal.getMonth() == DatatypeConstants.FIELD_UNDEFINED){ buf.append(" ").append(Messages.XMLGREGORIANCALENDAR_MONTH); } break; case 6: if (cal.getYear() == DatatypeConstants.FIELD_UNDEFINED){ buf.append(" ").append(Messages.XMLGREGORIANCALENDAR_YEAR); } break; case 7: // ignore timezone setting break; } } } if (buf.length() > 0){ throw new javax.xml.bind.MarshalException( Messages.XMLGREGORIANCALENDAR_INVALID.format(type.getLocalPart()) + buf.toString()); } }