javax.xml.datatype.XMLGregorianCalendar.normalize()方法的使用及代码示例

x33g5p2x  于2022-02-02 转载在 其他  
字(6.5k)|赞(0)|评价(0)|浏览(102)

本文整理了Java中javax.xml.datatype.XMLGregorianCalendar.normalize()方法的一些代码示例,展示了XMLGregorianCalendar.normalize()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XMLGregorianCalendar.normalize()方法的具体详情如下:
包路径:javax.xml.datatype.XMLGregorianCalendar
类名称:XMLGregorianCalendar
方法名:normalize

XMLGregorianCalendar.normalize介绍

[英]Normalize this instance to UTC.

2000-03-04T23:00:00+03:00 normalizes to 2000-03-04T20:00:00Z

Implements W3C XML Schema Part 2, Section 3.2.7.3 (A).
[中]

代码示例

代码示例来源: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: apache/metron

XMLGregorianCalendar gTime = null;
try {
 gTime = DatatypeFactory.newInstance().newXMLGregorianCalendar((GregorianCalendar) gc).normalize();
} catch (DatatypeConfigurationException e) {
 ErrorUtils.RuntimeErrors.ILLEGAL_STATE.throwRuntime("Unable to set the begin time due to", e);

代码示例来源:origin: org.eclipse.emf/org.eclipse.emf.ecore

@Override
public XMLGregorianCalendar normalize()
{
 return xmlGregorianCalendar.normalize();
}

代码示例来源:origin: at.bestsolution.efxclipse.eclipse/org.eclipse.emf.ecore

@Override
public XMLGregorianCalendar normalize()
{
 return xmlGregorianCalendar.normalize();
}

代码示例来源:origin: org.jvnet.hyperjaxb3/hyperjaxb3-ejb-runtime

public Date createDate(XMLGregorianCalendar calendar) {
  final java.sql.Time time = new java.sql.Time(calendar.normalize()
      .toGregorianCalendar(/* timeZone, Locale.UK, null */)
      .getTimeInMillis());
  return time;
}

代码示例来源:origin: org.jvnet.hyperjaxb3/hyperjaxb3-ejb-runtime

public Date createDate(XMLGregorianCalendar calendar) {
  final java.sql.Timestamp timestamp = new java.sql.Timestamp(calendar
      .normalize().toGregorianCalendar().getTimeInMillis());
  return timestamp;
}

代码示例来源:origin: highsource/hyperjaxb3

public Date createDate(XMLGregorianCalendar calendar) {
  final java.sql.Timestamp timestamp = new java.sql.Timestamp(calendar
      .normalize().toGregorianCalendar().getTimeInMillis());
  return timestamp;
}

代码示例来源:origin: org.jvnet.hyperjaxb3/hyperjaxb3-ejb-runtime

@Override
public Date createDate(XMLGregorianCalendar calendar) {
  return new java.sql.Date(calendar.normalize().toGregorianCalendar()
      .getTimeInMillis());
}

代码示例来源:origin: net.sourceforge.owlapi/jfact

@Override
public Date parseValue(String s) {
  try {
    XMLGregorianCalendar cal = javax.xml.datatype.DatatypeFactory.newInstance().newXMLGregorianCalendar(s);
    return cal.normalize().toGregorianCalendar().getTime();
  } catch (DatatypeConfigurationException e) {
    throw new ReasonerInternalException(e);
  }
}

代码示例来源:origin: org.picketlink/picketlink-fed

/**
* <p>
* Sets the expiration time.
* </p>
* 
* @param expires a reference to the {@code XMLGregorianCalendar} that represents the expiration time.
*/
public void setExpires(XMLGregorianCalendar expires)
{
 this.expires = expires.normalize();
 this.delegate.getExpires().setValue(this.expires.toXMLFormat());
}

代码示例来源:origin: org.picketlink/picketlink-fed-core

/**
* <p>
* Sets the creation time.
* </p>
* 
* @param created a reference to the {@code XMLGregorianCalendar} that represents the creation time to be set.
*/
public void setCreated(XMLGregorianCalendar created)
{
 this.created = created.normalize();
 this.delegate.getCreated().setValue(this.created.toXMLFormat());
}

代码示例来源:origin: org.picketlink/picketlink-fed-core

/**
* <p>
* Sets the expiration time.
* </p>
* 
* @param expires a reference to the {@code XMLGregorianCalendar} that represents the expiration time.
*/
public void setExpires(XMLGregorianCalendar expires)
{
 this.expires = expires.normalize();
 this.delegate.getExpires().setValue(this.expires.toXMLFormat());
}

代码示例来源:origin: org.picketlink/picketlink-federation

/**
 * <p>
 * Sets the expiration time.
 * </p>
 *
 * @param expires a reference to the {@code XMLGregorianCalendar} that represents the expiration time.
 */
public void setExpires(XMLGregorianCalendar expires) {
  this.expires = expires.normalize();
  this.delegate.getExpires().setValue(this.expires.toXMLFormat());
}

代码示例来源:origin: org.picketlink/picketlink-federation

/**
 * <p>
 * Sets the creation time.
 * </p>
 *
 * @param created a reference to the {@code XMLGregorianCalendar} that represents the creation time to be set.
 */
public void setCreated(XMLGregorianCalendar created) {
  this.created = created.normalize();
  this.delegate.getCreated().setValue(this.created.toXMLFormat());
}

代码示例来源:origin: org.picketlink/picketlink-core

/**
 * <p>
 * Sets the creation time.
 * </p>
 *
 * @param created a reference to the {@code XMLGregorianCalendar} that represents the creation time to be set.
 */
public void setCreated(XMLGregorianCalendar created) {
  this.created = created.normalize();
  this.delegate.getCreated().setValue(this.created.toXMLFormat());
}

代码示例来源:origin: org.picketlink/picketlink-core

/**
 * <p>
 * Sets the expiration time.
 * </p>
 *
 * @param expires a reference to the {@code XMLGregorianCalendar} that represents the expiration time.
 */
public void setExpires(XMLGregorianCalendar expires) {
  this.expires = expires.normalize();
  this.delegate.getExpires().setValue(this.expires.toXMLFormat());
}

代码示例来源:origin: com.goldmansachs.jdmn/jdmn-core

private XMLGregorianCalendar normalize(XMLGregorianCalendar first) {
  XMLGregorianCalendar normal1 = (XMLGregorianCalendar) first.clone();
  if (first.getTimezone() == DatatypeConstants.FIELD_UNDEFINED) {
    normal1 = normalizeToTimezone(first, 0);
  }
  return normal1.normalize();
}

代码示例来源:origin: org.picketlink/picketlink-fed

/**
* <p>
* Sets the creation time.
* </p>
* 
* @param created a reference to the {@code XMLGregorianCalendar} that represents the creation time to be set.
*/
public void setCreated(XMLGregorianCalendar created)
{
 this.created = created.normalize();
 this.delegate.getCreated().setValue(this.created.toXMLFormat());
}

代码示例来源:origin: picketlink/picketlink

/**
 * <p>
 * Sets the expiration time.
 * </p>
 *
 * @param expires a reference to the {@code XMLGregorianCalendar} that represents the expiration time.
 */
public void setExpires(XMLGregorianCalendar expires) {
  this.expires = expires.normalize();
  this.delegate.getExpires().setValue(this.expires.toXMLFormat());
}

代码示例来源:origin: picketlink/picketlink

/**
 * <p>
 * Sets the creation time.
 * </p>
 *
 * @param created a reference to the {@code XMLGregorianCalendar} that represents the creation time to be set.
 */
public void setCreated(XMLGregorianCalendar created) {
  this.created = created.normalize();
  this.delegate.getCreated().setValue(this.created.toXMLFormat());
}

相关文章