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

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

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

XMLGregorianCalendar.setTime介绍

[英]Set time as one unit.
[中]将时间设置为一个单位。

代码示例

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

/**
 * <p>Set time as one unit.</p>
 *
 * @param hour value constraints are summarized in
 * <a href="#datetimefield-hour">hour field of date/time field mapping table</a>.
 * @param minute value constraints are summarized in
 * <a href="#datetimefield-minute">minute field of date/time field mapping table</a>.
 * @param second value constraints are summarized in
 * <a href="#datetimefield-second">second field of date/time field mapping table</a>.
 *
 * @see #setTime(int, int, int, BigDecimal)
 *
 * @throws IllegalArgumentException if any parameter is
 * outside value constraints for the field as specified in
 * <a href="#datetimefieldmapping">date/time field mapping table</a>.
 */
public void setTime(int hour, int minute, int second) {
  setTime(
    hour,
    minute,
    second,
    null // fractional
  );
}

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

@Override
public XMLGregorianCalendar date(XMLGregorianCalendar from) {
  if (from == null) {
    return null;
  }
  XMLGregorianCalendar clone = (XMLGregorianCalendar) from.clone();
  clone.setTime(DatatypeConstants.FIELD_UNDEFINED, DatatypeConstants.FIELD_UNDEFINED, DatatypeConstants.FIELD_UNDEFINED);
  clone.setTimezone(DatatypeConstants.FIELD_UNDEFINED);
  return DateTimeUtil.isValidDate(clone) ? clone : null;
}

代码示例来源:origin: goldmansachs/jdmn

@Override
public XMLGregorianCalendar date(XMLGregorianCalendar from) {
  if (from == null) {
    return null;
  }
  XMLGregorianCalendar clone = (XMLGregorianCalendar) from.clone();
  clone.setTime(DatatypeConstants.FIELD_UNDEFINED, DatatypeConstants.FIELD_UNDEFINED, DatatypeConstants.FIELD_UNDEFINED);
  clone.setTimezone(DatatypeConstants.FIELD_UNDEFINED);
  return DateTimeUtil.isValidDate(clone) ? clone : null;
}

代码示例来源:origin: psidev.psi.mi/psi25-xml

public void setTime( int hour, int minute, int second, int millisecond ) {
  calendar.setTime( hour, minute, second, millisecond );
}

代码示例来源:origin: org.xcmis/xcmis-spi

/**
* Get XMLGregorianCalendar that is based on Calendar.
*
* @param calendar source Calendar
* @return XMLGregorianCalendar
*/
public static XMLGregorianCalendar fromCalendar(Calendar calendar)
{
 XMLGregorianCalendar xmlCalendar;
 try
 {
   xmlCalendar = DatatypeFactory.newInstance().newXMLGregorianCalendar();
 }
 catch (DatatypeConfigurationException e)
 {
   String msg = "Unable get XMLGregorianCalendar.";
   throw new RuntimeException(msg, e);
 }
 xmlCalendar.setYear(calendar.get(Calendar.YEAR));
 xmlCalendar.setMonth(calendar.get(Calendar.MONTH) + 1);
 xmlCalendar.setDay(calendar.get(Calendar.DAY_OF_MONTH));
 int zoneOffsetInMinutes = (calendar.get(Calendar.ZONE_OFFSET) + calendar.get(Calendar.DST_OFFSET)) / (60*1000);
 xmlCalendar.setTimezone(zoneOffsetInMinutes);
 xmlCalendar.setTime(calendar.get(Calendar.HOUR_OF_DAY), calendar.get(Calendar.MINUTE), calendar
   .get(Calendar.SECOND), calendar.get(Calendar.MILLISECOND));
 return xmlCalendar;
}

代码示例来源:origin: psidev.psi.mi/psi25-xml

public void setTime( int hour, int minute, int second, int millisecond ) {
  calendar.setTime( hour, minute, second, millisecond );
}

代码示例来源:origin: rocks.xmpp/xmpp-extensions-common

/**
 * Creates a date value.
 *
 * @param date The date value.
 */
private Value(OffsetDateTime date) {
  XMLGregorianCalendar xmlGregorianCalendar;
  try {
    xmlGregorianCalendar = DatatypeFactory.newInstance().newXMLGregorianCalendar();
    xmlGregorianCalendar.setYear(date.getYear());
    xmlGregorianCalendar.setMonth(date.getMonth().getValue());
    xmlGregorianCalendar.setDay(date.getDayOfMonth());
    xmlGregorianCalendar.setTime(date.getHour(), date.getMinute(), date.getSecond()); // date.get(ChronoField.MILLI_OF_SECOND)
    xmlGregorianCalendar.setTimezone(date.getOffset().getTotalSeconds() / 60);
  } catch (DatatypeConfigurationException e) {
    xmlGregorianCalendar = null;
  }
  this.value = xmlGregorianCalendar;
}

代码示例来源:origin: psidev.psi.mi/psi25-xml

public void setTime( int hour, int minute, int second ) {
  calendar.setTime( hour, minute, second );
}

代码示例来源:origin: psidev.psi.mi/psi25-xml

public void setTime( int hour, int minute, int second, BigDecimal fractional ) {
  calendar.setTime( hour, minute, second, fractional );
}

代码示例来源:origin: psidev.psi.mi/psi25-xml

public void setTime( int hour, int minute, int second, BigDecimal fractional ) {
  calendar.setTime( hour, minute, second, fractional );
}

代码示例来源:origin: psidev.psi.mi/psi25-xml

public void setTime( int hour, int minute, int second ) {
  calendar.setTime( hour, minute, second );
}

代码示例来源:origin: ibinti/bugvm

/**
 * <p>Set time as one unit.</p>
 *
 * @param hour value constraints are summarized in
 * <a href="#datetimefield-hour">hour field of date/time field mapping table</a>.
 * @param minute value constraints are summarized in
 * <a href="#datetimefield-minute">minute field of date/time field mapping table</a>.
 * @param second value constraints are summarized in
 * <a href="#datetimefield-second">second field of date/time field mapping table</a>.
 *
 * @see #setTime(int, int, int, BigDecimal)
 *
 * @throws IllegalArgumentException if any parameter is
 * outside value constraints for the field as specified in
 * <a href="#datetimefieldmapping">date/time field mapping table</a>.
 */
public void setTime(int hour, int minute, int second) {
  setTime(
    hour,
    minute,
    second,
    null // fractional
  );
}

代码示例来源:origin: MobiVM/robovm

/**
 * <p>Set time as one unit.</p>
 *
 * @param hour value constraints are summarized in
 * <a href="#datetimefield-hour">hour field of date/time field mapping table</a>.
 * @param minute value constraints are summarized in
 * <a href="#datetimefield-minute">minute field of date/time field mapping table</a>.
 * @param second value constraints are summarized in
 * <a href="#datetimefield-second">second field of date/time field mapping table</a>.
 *
 * @see #setTime(int, int, int, BigDecimal)
 *
 * @throws IllegalArgumentException if any parameter is
 * outside value constraints for the field as specified in
 * <a href="#datetimefieldmapping">date/time field mapping table</a>.
 */
public void setTime(int hour, int minute, int second) {
  setTime(
    hour,
    minute,
    second,
    null // fractional
  );
}

代码示例来源:origin: FlexoVM/flexovm

/**
 * <p>Set time as one unit.</p>
 *
 * @param hour value constraints are summarized in
 * <a href="#datetimefield-hour">hour field of date/time field mapping table</a>.
 * @param minute value constraints are summarized in
 * <a href="#datetimefield-minute">minute field of date/time field mapping table</a>.
 * @param second value constraints are summarized in
 * <a href="#datetimefield-second">second field of date/time field mapping table</a>.
 *
 * @see #setTime(int, int, int, BigDecimal)
 *
 * @throws IllegalArgumentException if any parameter is
 * outside value constraints for the field as specified in
 * <a href="#datetimefieldmapping">date/time field mapping table</a>.
 */
public void setTime(int hour, int minute, int second) {
  setTime(
    hour,
    minute,
    second,
    null // fractional
  );
}

代码示例来源:origin: javax.xml.parsers/jaxp-api

/**
 * <p>Set time as one unit.</p>
 *
 * @param hour value constraints are summarized in 
 * <a href="#datetimefield-hour">hour field of date/time field mapping table</a>.
 * @param minute value constraints are summarized in 
 * <a href="#datetimefield-minute">minute field of date/time field mapping table</a>.
 * @param second value constraints are summarized in 
 * <a href="#datetimefield-second">second field of date/time field mapping table</a>.
 *
 * @see #setTime(int, int, int, BigDecimal)
 *
 * @throws IllegalArgumentException if any parameter is 
 * outside value constraints for the field as specified in 
 * <a href="#datetimefieldmapping">date/time field mapping table</a>.
 */
public void setTime(int hour, int minute, int second) {
  
  setTime(
    hour,
    minute,
    second,
    null // fractional
  );
}

代码示例来源:origin: com.bugvm/bugvm-rt

/**
 * <p>Set time as one unit.</p>
 *
 * @param hour value constraints are summarized in
 * <a href="#datetimefield-hour">hour field of date/time field mapping table</a>.
 * @param minute value constraints are summarized in
 * <a href="#datetimefield-minute">minute field of date/time field mapping table</a>.
 * @param second value constraints are summarized in
 * <a href="#datetimefield-second">second field of date/time field mapping table</a>.
 *
 * @see #setTime(int, int, int, BigDecimal)
 *
 * @throws IllegalArgumentException if any parameter is
 * outside value constraints for the field as specified in
 * <a href="#datetimefieldmapping">date/time field mapping table</a>.
 */
public void setTime(int hour, int minute, int second) {
  setTime(
    hour,
    minute,
    second,
    null // fractional
  );
}

代码示例来源:origin: com.mobidevelop.robovm/robovm-rt

/**
 * <p>Set time as one unit.</p>
 *
 * @param hour value constraints are summarized in
 * <a href="#datetimefield-hour">hour field of date/time field mapping table</a>.
 * @param minute value constraints are summarized in
 * <a href="#datetimefield-minute">minute field of date/time field mapping table</a>.
 * @param second value constraints are summarized in
 * <a href="#datetimefield-second">second field of date/time field mapping table</a>.
 *
 * @see #setTime(int, int, int, BigDecimal)
 *
 * @throws IllegalArgumentException if any parameter is
 * outside value constraints for the field as specified in
 * <a href="#datetimefieldmapping">date/time field mapping table</a>.
 */
public void setTime(int hour, int minute, int second) {
  setTime(
    hour,
    minute,
    second,
    null // fractional
  );
}

代码示例来源:origin: com.gluonhq/robovm-rt

/**
 * <p>Set time as one unit.</p>
 *
 * @param hour value constraints are summarized in
 * <a href="#datetimefield-hour">hour field of date/time field mapping table</a>.
 * @param minute value constraints are summarized in
 * <a href="#datetimefield-minute">minute field of date/time field mapping table</a>.
 * @param second value constraints are summarized in
 * <a href="#datetimefield-second">second field of date/time field mapping table</a>.
 *
 * @see #setTime(int, int, int, BigDecimal)
 *
 * @throws IllegalArgumentException if any parameter is
 * outside value constraints for the field as specified in
 * <a href="#datetimefieldmapping">date/time field mapping table</a>.
 */
public void setTime(int hour, int minute, int second) {
  setTime(
    hour,
    minute,
    second,
    null // fractional
  );
}

代码示例来源:origin: org.ow2.authzforce/authzforce-ce-core-pdp-api

/**
 * Creates a new <code>DateAttributeValue</code> from a Calendar
 *
 * @param calendar
 *            a <code>XMLGregorianCalendar</code> object representing the specified date; beware that this method modifies {@code calendar} by unsetting all time fields:
 *            {@code calendar.setTime(DatatypeConstants.FIELD_UNDEFINED, DatatypeConstants.FIELD_UNDEFINED, DatatypeConstants.FIELD_UNDEFINED, DatatypeConstants.FIELD_UNDEFINED)}
 * @return new instance
 * @throws java.lang.IllegalArgumentException
 *             if {@code calendar == null}
 */
public static DateValue getInstance(final XMLGregorianCalendar calendar) throws IllegalArgumentException
{
  // we only want the date, so unset time fields
  calendar.setTime(DatatypeConstants.FIELD_UNDEFINED, DatatypeConstants.FIELD_UNDEFINED, DatatypeConstants.FIELD_UNDEFINED, DatatypeConstants.FIELD_UNDEFINED);
  return new DateValue(calendar);
}

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

private static String getDateValue(final XmlSchemaTypeEnum dateType, final Object fieldValue){
  final XMLGregorianCalendar xmlGregorianCalendar = (XMLGregorianCalendar)fieldValue;
  switch(dateType){
  case DATE:
    xmlGregorianCalendar.setTime(DatatypeConstants.FIELD_UNDEFINED, DatatypeConstants.FIELD_UNDEFINED,
        DatatypeConstants.FIELD_UNDEFINED, DatatypeConstants.FIELD_UNDEFINED);
    break;
  case TIME:
    xmlGregorianCalendar.setDay(DatatypeConstants.FIELD_UNDEFINED);
    xmlGregorianCalendar.setMonth(DatatypeConstants.FIELD_UNDEFINED);
    xmlGregorianCalendar.setYear(DatatypeConstants.FIELD_UNDEFINED);
    break;
  default:
    break;
  }
  return xmlGregorianCalendar.toXMLFormat();
}

相关文章