當前位置: 首頁>>代碼示例>>Java>>正文


Java XMLGregorianCalendar.getDay方法代碼示例

本文整理匯總了Java中javax.xml.datatype.XMLGregorianCalendar.getDay方法的典型用法代碼示例。如果您正苦於以下問題:Java XMLGregorianCalendar.getDay方法的具體用法?Java XMLGregorianCalendar.getDay怎麽用?Java XMLGregorianCalendar.getDay使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javax.xml.datatype.XMLGregorianCalendar的用法示例。


在下文中一共展示了XMLGregorianCalendar.getDay方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: hashCode

import javax.xml.datatype.XMLGregorianCalendar; //導入方法依賴的package包/類
/**
 * <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();
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:24,代碼來源:XMLGregorianCalendarImpl.java

示例2: checkXmlGregorianCalendarFieldRef

import javax.xml.datatype.XMLGregorianCalendar; //導入方法依賴的package包/類
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());
        }
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:55,代碼來源:RuntimeBuiltinLeafInfoImpl.java


注:本文中的javax.xml.datatype.XMLGregorianCalendar.getDay方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。