本文整理了Java中javax.xml.datatype.XMLGregorianCalendar.getYear()
方法的一些代码示例,展示了XMLGregorianCalendar.getYear()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XMLGregorianCalendar.getYear()
方法的具体详情如下:
包路径:javax.xml.datatype.XMLGregorianCalendar
类名称:XMLGregorianCalendar
方法名:getYear
[英]Return low order component for XML Schema 1.0 dateTime datatype field for year
or DatatypeConstants#FIELD_UNDEFINED.
Value constraints for this value are summarized in year field of date/time field mapping table.
[中]返回year
或DatatypeConstants#field_未定义的XML Schema 1.0 dateTime数据类型字段的低阶组件。
此值的值约束汇总在year field of date/time field mapping table中。
代码示例来源:origin: com.sun.xml.bind/jaxb-impl
if (cal.getYear() == DatatypeConstants.FIELD_UNDEFINED){
buf.append(" ").append(Messages.XMLGREGORIANCALENDAR_YEAR);
代码示例来源:origin: robovm/robovm
/**
* <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.normalize();
}
return gc.getYear()
+ gc.getMonth()
+ gc.getDay()
+ gc.getHour()
+ gc.getMinute()
+ gc.getSecond();
}
代码示例来源:origin: org.glassfish.jaxb/jaxb-runtime
if (cal.getYear() == DatatypeConstants.FIELD_UNDEFINED){
buf.append(" ").append(Messages.XMLGREGORIANCALENDAR_YEAR);
代码示例来源:origin: at.bestsolution.efxclipse.eclipse/org.eclipse.emf.ecore
@Override
public int getYear()
{
return xmlGregorianCalendar.getYear();
}
代码示例来源:origin: org.eclipse.emf/org.eclipse.emf.ecore
@Override
public int getYear()
{
return xmlGregorianCalendar.getYear();
}
代码示例来源:origin: com.goldmansachs.jdmn/jdmn-core
public BigDecimal year(XMLGregorianCalendar date) {
if (date == null) {
return null;
}
try {
return BigDecimal.valueOf(date.getYear());
} catch (Exception e) {
String message = String.format("year(%s)", date);
logError(message, e);
return null;
}
}
代码示例来源:origin: goldmansachs/jdmn
public BigDecimal year(XMLGregorianCalendar date) {
if (date == null) {
return null;
}
try {
return BigDecimal.valueOf(date.getYear());
} catch (Exception e) {
String message = String.format("year(%s)", date);
logError(message, e);
return null;
}
}
代码示例来源:origin: ORCID/ORCID-Source
private static Date getCreatedDate(XMLGregorianCalendar calendar) {
if (calendar != null) {
int year = calendar.getYear();
int month = calendar.getMonth();
int day = calendar.getDay();
return Date.valueOf(FuzzyDate.valueOf(year, month, day));
}
return null;
}
代码示例来源:origin: stackoverflow.com
public String convertToString(XMLGregorianCalendar cal)
{
return "" + cal.getYear() + "/" + cal.getMonth() + "/" + cal.getDay();
}
代码示例来源:origin: apache/marmotta
@Override
public Date dateValue(Value node) {
try {
XMLGregorianCalendar cal = ((Literal)node).calendarValue();
return new GregorianCalendar(cal.getYear(), cal.getMonth(), cal.getDay()).getTime();
} catch (ClassCastException e) {
throw new IllegalArgumentException("Value "+node.stringValue()+" is not a literal" +
"but of type "+debugType(node));
}
}
代码示例来源:origin: apache/marmotta
@Override
public Date dateValue(Value node) {
try {
XMLGregorianCalendar cal = ((Literal)node).calendarValue();
return new GregorianCalendar(cal.getYear(), cal.getMonth(), cal.getDay()).getTime();
} catch (ClassCastException e) {
throw new IllegalArgumentException("Value "+node.stringValue()+" is not a literal" +
"but of type "+debugType(node));
}
}
代码示例来源:origin: org.apache.marmotta/ldpath-backend-sesame
@Override
public Date dateValue(Value node) {
try {
XMLGregorianCalendar cal = ((Literal)node).calendarValue();
return new GregorianCalendar(cal.getYear(), cal.getMonth(), cal.getDay()).getTime();
} catch (ClassCastException e) {
throw new IllegalArgumentException("Value "+node.stringValue()+" is not a literal" +
"but of type "+debugType(node));
}
}
代码示例来源:origin: be.fedict.eid-trust-service/eid-trust-service-xkms2-ws-impl
private Date getDate(XMLGregorianCalendar xmlCalendar) {
GregorianCalendar calendar = new GregorianCalendar(
xmlCalendar.getYear(),
xmlCalendar.getMonth() - 1,
xmlCalendar.getDay(), //
xmlCalendar.getHour(), xmlCalendar.getMinute(),
xmlCalendar.getSecond());
calendar.setTimeZone(xmlCalendar.getTimeZone(0));
return calendar.getTime();
}
代码示例来源:origin: palominolabs/sf-api-connector
/**
* Convert an {@link XMLGregorianCalendar} (assumed to be in UTC) into a {@link DateTime}.
*
* @param soapTime the UTC timestamp extracted from the SF soap layer
*
* @return a DateTime object representing the same time as the original soapTime
*/
public static DateTime convertSFTimeToDateTime(XMLGregorianCalendar soapTime) {
return new DateTime(soapTime.getYear(), soapTime.getMonth(), soapTime.getDay(), soapTime.getHour(),
soapTime.getMinute(), soapTime.getSecond(), soapTime.getMillisecond(), DateTimeZone.UTC);
}
}
代码示例来源:origin: rocks.xmpp/xmpp-extensions-common
/**
* Gets the value as date or null.
*
* @return The date or null.
*/
public final OffsetDateTime getAsInstant() {
if (value instanceof XMLGregorianCalendar) {
XMLGregorianCalendar calendar = (XMLGregorianCalendar) value;
return OffsetDateTime.of(calendar.getYear(), calendar.getMonth(), calendar.getDay(), calendar.getHour(), calendar.getMinute(), calendar.getSecond(), 0, ZoneOffset.ofTotalSeconds(calendar.getTimezone() * 60));
}
return null;
}
代码示例来源:origin: goldmansachs/jdmn
public static boolean isValidDateTime(XMLGregorianCalendar calendar) {
if (calendar == null) {
return false;
}
long year = calendar.getYear();
BigInteger eonAndYear = calendar.getEonAndYear();
if (eonAndYear != null) {
year = eonAndYear.intValue();
}
return isValidDate(year, calendar.getMonth(), calendar.getDay())
|| isValidDate(year, calendar.getMonth(), calendar.getDay()) && isValidTime(calendar.getHour(), calendar.getMinute(), calendar.getSecond())
;
}
代码示例来源:origin: goldmansachs/jdmn
public static boolean isValidTime(XMLGregorianCalendar calendar) {
if (calendar == null) {
return false;
}
return
isValidTime(calendar.getHour(), calendar.getMinute(), calendar.getSecond())
&& isUndefined(calendar.getYear())
&& isUndefined(calendar.getMonth())
&& isUndefined(calendar.getDay())
;
}
代码示例来源:origin: com.goldmansachs.jdmn/jdmn-core
public static boolean isValidTime(XMLGregorianCalendar calendar) {
if (calendar == null) {
return false;
}
return
isValidTime(calendar.getHour(), calendar.getMinute(), calendar.getSecond())
&& isUndefined(calendar.getYear())
&& isUndefined(calendar.getMonth())
&& isUndefined(calendar.getDay())
;
}
代码示例来源:origin: apache/cxf
protected boolean equalsDate(XMLGregorianCalendar orig, XMLGregorianCalendar actual) {
boolean result = false;
if ((orig.getYear() == actual.getYear()) && (orig.getMonth() == actual.getMonth())
&& (orig.getDay() == actual.getDay()) && (actual.getHour() == DatatypeConstants.FIELD_UNDEFINED)
&& (actual.getMinute() == DatatypeConstants.FIELD_UNDEFINED)
&& (actual.getSecond() == DatatypeConstants.FIELD_UNDEFINED)
&& (actual.getMillisecond() == DatatypeConstants.FIELD_UNDEFINED)) {
result = orig.getTimezone() == actual.getTimezone();
}
return result;
}
代码示例来源:origin: apache/cxf
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;
}
内容来源于网络,如有侵权,请联系作者删除!