Java Code Examples for javax.xml.datatype.XMLGregorianCalendar#getMinute()

The following examples show how to use javax.xml.datatype.XMLGregorianCalendar#getMinute() . 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 TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * <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: DateTimeConverter.java    From atdl4j with MIT License 6 votes vote down vote up
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 3
Source File: XMLGregorianCalendarImpl.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * <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 vote down vote up
/**
 * <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: FEELXMLGregorianCalendar.java    From jdmn with Apache License 2.0 6 votes vote down vote up
@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 6
Source File: XMLGregorianCalendarImpl.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
/**
 * <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 7
Source File: XMLGregorianCalendarImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
/**
 * <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 openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
/**
 * <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: XMLGregorianCalendarImpl.java    From Bytecoder with Apache License 2.0 6 votes vote down vote up
/**
 * <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 10
Source File: XMLGregorianCalendarImpl.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * <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 11
Source File: XMLGregorianCalendarImpl.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
/**
 * <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 12
Source File: Minutes.java    From rdf4j with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
public Literal evaluate(ValueFactory valueFactory, Value... args) throws ValueExprEvaluationException {
	if (args.length != 1) {
		throw new ValueExprEvaluationException("MINUTES 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 minutes = calValue.getMinute();
				if (DatatypeConstants.FIELD_UNDEFINED != minutes) {
					return valueFactory.createLiteral(String.valueOf(minutes), XMLSchema.INTEGER);
				} else {
					throw new ValueExprEvaluationException("can not determine minutes 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 13
Source File: DefaultTimeLib.java    From jdmn with Apache License 2.0 5 votes vote down vote up
public Integer minute(XMLGregorianCalendar date) {
    if (date == null) {
        return null;
    }

    return date.getMinute();
}
 
Example 14
Source File: AbstractTypeTestClient.java    From cxf with Apache License 2.0 5 votes vote down vote up
protected boolean equalsTime(XMLGregorianCalendar orig, XMLGregorianCalendar actual) {
    boolean result = false;
    if ((orig.getHour() == actual.getHour()) && (orig.getMinute() == actual.getMinute())
        && (orig.getSecond() == actual.getSecond()) && (orig.getMillisecond() == actual.getMillisecond())
        && (orig.getTimezone() == actual.getTimezone())) {
        result = true;
    }
    return result;
}
 
Example 15
Source File: SwingJideClockWidget.java    From atdl4j with MIT License 5 votes vote down vote up
/**
 * 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(), 
				( showTime && aValue.getHour() != DatatypeConstants.FIELD_UNDEFINED ) ? aValue.getHour() : 0,
				( showTime && aValue.getMinute() != DatatypeConstants.FIELD_UNDEFINED ) ? aValue.getMinute() : 0,
				( showTime && 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 16
Source File: RuntimeBuiltinLeafInfoImpl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
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-8 with GNU General Public License v2.0 4 votes vote down vote up
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-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
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 openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
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 vote down vote up
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());
        }
}