本文整理汇总了Java中javax.xml.datatype.XMLGregorianCalendar.getSecond方法的典型用法代码示例。如果您正苦于以下问题:Java XMLGregorianCalendar.getSecond方法的具体用法?Java XMLGregorianCalendar.getSecond怎么用?Java XMLGregorianCalendar.getSecond使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.xml.datatype.XMLGregorianCalendar
的用法示例。
在下文中一共展示了XMLGregorianCalendar.getSecond方法的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();
}
示例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());
}
}