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

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

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

XMLGregorianCalendar.getFractionalSecond介绍

[英]Return fractional seconds.

null is returned when this optional field is not defined.

Value constraints are detailed in second field of date/time field mapping table.

This optional field can only have a defined value when the xs:dateTime second field, represented by #getSecond(), does not return DatatypeConstants#FIELD_UNDEFINED.
[中]返回小数秒。
未定义此可选字段时返回null
值约束在second field of date/time field mapping table中有详细说明。
只有当由#getSecond()表示的xs:dateTime second字段不返回DatatypeConstants#field_UNDEFINED时,此可选字段才能具有已定义的值。

代码示例

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

/**
 * <p>Return millisecond precision of {@link #getFractionalSecond()}.</p>
 *
 * <p>This method represents a convenience accessor to infinite
 * precision fractional second value returned by
 * {@link #getFractionalSecond()}. The returned value is the rounded
 * down to milliseconds value of
 * {@link #getFractionalSecond()}. When {@link #getFractionalSecond()}
 * returns <code>null</code>, this method must return
 * {@link DatatypeConstants#FIELD_UNDEFINED}.</p>
 *
 * <p>Value constraints for this value are summarized in
 * <a href="#datetimefield-second">second field of date/time field mapping table</a>.</p>
 *
 * @return Millisecond  of this <code>XMLGregorianCalendar</code>.
 *
 * @see #getFractionalSecond()
 * @see #setTime(int, int, int)
 */
public int getMillisecond() {
  BigDecimal fractionalSeconds = getFractionalSecond();
  // is field undefined?
  if (fractionalSeconds == null) {
    return DatatypeConstants.FIELD_UNDEFINED;
  }
  return getFractionalSecond().movePointRight(3).intValue();
}

代码示例来源:origin: com.sun.xml.bind/jaxb-impl

case 's':
    printNumber(buf,value.getSecond(),2);
if (value.getFractionalSecond() != null) {
  String frac = value.getFractionalSecond().toPlainString();

代码示例来源:origin: org.glassfish.jaxb/jaxb-runtime

case 's':
    printNumber(buf,value.getSecond(),2);
if (value.getFractionalSecond() != null) {
  String frac = value.getFractionalSecond().toPlainString();

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

@Override
public BigDecimal getFractionalSecond()
{
 return xmlGregorianCalendar.getFractionalSecond();
}

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

@Override
public BigDecimal getFractionalSecond()
{
 return xmlGregorianCalendar.getFractionalSecond();
}

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

public BigDecimal getFractionalSecond() {
  return calendar.getFractionalSecond();
}

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

public BigDecimal getFractionalSecond() {
  return calendar.getFractionalSecond();
}

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

/**
 * <p>Return millisecond precision of {@link #getFractionalSecond()}.</p>
 *
 * <p>This method represents a convenience accessor to infinite
 * precision fractional second value returned by
 * {@link #getFractionalSecond()}. The returned value is the rounded
 * down to milliseconds value of
 * {@link #getFractionalSecond()}. When {@link #getFractionalSecond()}
 * returns <code>null</code>, this method must return
 * {@link DatatypeConstants#FIELD_UNDEFINED}.</p>
 *
 * <p>Value constraints for this value are summarized in
 * <a href="#datetimefield-second">second field of date/time field mapping table</a>.</p>
 *
 * @return Millisecond  of this <code>XMLGregorianCalendar</code>.
 *
 * @see #getFractionalSecond()
 * @see #setTime(int, int, int)
 */
public int getMillisecond() {
  BigDecimal fractionalSeconds = getFractionalSecond();
  // is field undefined?
  if (fractionalSeconds == null) {
    return DatatypeConstants.FIELD_UNDEFINED;
  }
  return getFractionalSecond().movePointRight(3).intValue();
}

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

/**
 * <p>Return millisecond precision of {@link #getFractionalSecond()}.</p>
 *
 * <p>This method represents a convenience accessor to infinite
 * precision fractional second value returned by
 * {@link #getFractionalSecond()}. The returned value is the rounded
 * down to milliseconds value of
 * {@link #getFractionalSecond()}. When {@link #getFractionalSecond()}
 * returns <code>null</code>, this method must return
 * {@link DatatypeConstants#FIELD_UNDEFINED}.</p>
 *
 * <p>Value constraints for this value are summarized in
 * <a href="#datetimefield-second">second field of date/time field mapping table</a>.</p>
 *
 * @return Millisecond  of this <code>XMLGregorianCalendar</code>.
 *
 * @see #getFractionalSecond()
 * @see #setTime(int, int, int)
 */
public int getMillisecond() {
  BigDecimal fractionalSeconds = getFractionalSecond();
  // is field undefined?
  if (fractionalSeconds == null) {
    return DatatypeConstants.FIELD_UNDEFINED;
  }
  return getFractionalSecond().movePointRight(3).intValue();
}

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

/**
 * <p>Return millisecond precision of {@link #getFractionalSecond()}.</p>
 *
 * <p>This method represents a convenience accessor to infinite
 * precision fractional second value returned by
 * {@link #getFractionalSecond()}. The returned value is the rounded
 * down to milliseconds value of
 * {@link #getFractionalSecond()}. When {@link #getFractionalSecond()}
 * returns <code>null</code>, this method must return
 * {@link DatatypeConstants#FIELD_UNDEFINED}.</p>
 *
 * <p>Value constraints for this value are summarized in
 * <a href="#datetimefield-second">second field of date/time field mapping table</a>.</p>
 *
 * @return Millisecond  of this <code>XMLGregorianCalendar</code>.
 *
 * @see #getFractionalSecond()
 * @see #setTime(int, int, int)
 */
public int getMillisecond() {
  BigDecimal fractionalSeconds = getFractionalSecond();
  // is field undefined?
  if (fractionalSeconds == null) {
    return DatatypeConstants.FIELD_UNDEFINED;
  }
  return getFractionalSecond().movePointRight(3).intValue();
}

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

/** 
 * <p>Return millisecond precision of {@link #getFractionalSecond()}.</p>
 * 
 * <p>This method represents a convenience accessor to infinite
 * precision fractional second value returned by 
 * {@link #getFractionalSecond()}. The returned value is the rounded 
 * down to milliseconds value of 
 * {@link #getFractionalSecond()}. When {@link #getFractionalSecond()} 
 * returns <code>null</code>, this method must return 
 * {@link DatatypeConstants#FIELD_UNDEFINED}.</p>
 *
 * <p>Value constraints for this value are summarized in 
 * <a href="#datetimefield-second">second field of date/time field mapping table</a>.</p>
 * 
 * @return Millisecond  of this <code>XMLGregorianCalendar</code>.
 * 
 * @see #getFractionalSecond()
 * @see #setTime(int, int, int)
 */
public int getMillisecond() {
  
  BigDecimal fractionalSeconds = getFractionalSecond();
  
  // is field undefined?
  if (fractionalSeconds == null) {
    return DatatypeConstants.FIELD_UNDEFINED;
  }
  
  return getFractionalSecond().movePointRight(3).intValue();
}

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

/**
 * <p>Return millisecond precision of {@link #getFractionalSecond()}.</p>
 *
 * <p>This method represents a convenience accessor to infinite
 * precision fractional second value returned by
 * {@link #getFractionalSecond()}. The returned value is the rounded
 * down to milliseconds value of
 * {@link #getFractionalSecond()}. When {@link #getFractionalSecond()}
 * returns <code>null</code>, this method must return
 * {@link DatatypeConstants#FIELD_UNDEFINED}.</p>
 *
 * <p>Value constraints for this value are summarized in
 * <a href="#datetimefield-second">second field of date/time field mapping table</a>.</p>
 *
 * @return Millisecond  of this <code>XMLGregorianCalendar</code>.
 *
 * @see #getFractionalSecond()
 * @see #setTime(int, int, int)
 */
public int getMillisecond() {
  BigDecimal fractionalSeconds = getFractionalSecond();
  // is field undefined?
  if (fractionalSeconds == null) {
    return DatatypeConstants.FIELD_UNDEFINED;
  }
  return getFractionalSecond().movePointRight(3).intValue();
}

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

/**
 * <p>Return millisecond precision of {@link #getFractionalSecond()}.</p>
 *
 * <p>This method represents a convenience accessor to infinite
 * precision fractional second value returned by
 * {@link #getFractionalSecond()}. The returned value is the rounded
 * down to milliseconds value of
 * {@link #getFractionalSecond()}. When {@link #getFractionalSecond()}
 * returns <code>null</code>, this method must return
 * {@link DatatypeConstants#FIELD_UNDEFINED}.</p>
 *
 * <p>Value constraints for this value are summarized in
 * <a href="#datetimefield-second">second field of date/time field mapping table</a>.</p>
 *
 * @return Millisecond  of this <code>XMLGregorianCalendar</code>.
 *
 * @see #getFractionalSecond()
 * @see #setTime(int, int, int)
 */
public int getMillisecond() {
  BigDecimal fractionalSeconds = getFractionalSecond();
  // is field undefined?
  if (fractionalSeconds == null) {
    return DatatypeConstants.FIELD_UNDEFINED;
  }
  return getFractionalSecond().movePointRight(3).intValue();
}

代码示例来源:origin: prowide/prowide-core

@Override
public JsonElement serialize(XMLGregorianCalendar cal, Type type, JsonSerializationContext jsonSerializationContext) {
  JsonObject obj = new JsonObject();
  obj.addProperty(YEAR, cal.getYear());
  obj.addProperty(MONTH, cal.getMonth());
  obj.addProperty(DAY, cal.getDay());
  obj.addProperty(TIMEZONE, cal.getTimezone());
  obj.addProperty(HOUR, cal.getHour());
  obj.addProperty(MINUTE, cal.getMinute());
  obj.addProperty(SECOND, cal.getSecond());
  obj.addProperty(FRACTIONAL, cal.getFractionalSecond());
  return obj;
  // this alternative implementation is not working
  //return new JsonPrimitive(cal.toXMLFormat());
}

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

public static DateTime convertXMLGregorianCalendarToDateTime( XMLGregorianCalendar aXMLGregorianCalendar, Timezone aTimezone )
{
  // -- DateTime(int year, int monthOfYear, int dayOfMonth, int hourOfDay, int minuteOfHour, int secondOfMinute, int millisOfSecond) --
  int tempSubsecond = 0;
  if ( aXMLGregorianCalendar.getFractionalSecond() != null )
  {
    tempSubsecond = aXMLGregorianCalendar.getFractionalSecond().intValue();
  }
  
  DateTimeZone tempDateTimeZone = convertTimezoneToDateTimeZone( aTimezone );
  if ( tempDateTimeZone == null )
  {
    tempDateTimeZone = DateTimeZone.getDefault();
  }
  
  return new DateTime( aXMLGregorianCalendar.getYear(), 
                aXMLGregorianCalendar.getMonth(),
                aXMLGregorianCalendar.getDay(),
                aXMLGregorianCalendar.getHour(),
                aXMLGregorianCalendar.getMinute(),
                aXMLGregorianCalendar.getSecond(),
                tempSubsecond, 
                tempDateTimeZone );
}

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

@Override
public XMLGregorianCalendar dateAndTime(XMLGregorianCalendar date, XMLGregorianCalendar time) {
  if (date == null || time == null) {
    return null;
  }
  try {
    return FEELXMLGregorianCalendar.makeDateTime(
        BigInteger.valueOf(date.getYear()), date.getMonth(), date.getDay(),
        time.getHour(), time.getMinute(), time.getSecond(), time.getFractionalSecond(),
        time.getTimezone(), ((FEELXMLGregorianCalendar)time).getZoneID()
    );
  } catch (Throwable e) {
    return null;
  }
}

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

@Override
public XMLGregorianCalendar dateAndTime(XMLGregorianCalendar date, XMLGregorianCalendar time) {
  if (date == null || time == null) {
    return null;
  }
  try {
    return FEELXMLGregorianCalendar.makeDateTime(
        BigInteger.valueOf(date.getYear()), date.getMonth(), date.getDay(),
        time.getHour(), time.getMinute(), time.getSecond(), time.getFractionalSecond(),
        time.getTimezone(), ((FEELXMLGregorianCalendar)time).getZoneID()
    );
  } catch (Throwable e) {
    return null;
  }
}

代码示例来源:origin: net.sourceforge.owlapi/pellet-core-ignazio1977

results[1] = createInteger( abox, value.getHour() );
results[2] = createInteger( abox, value.getMinute() );
final BigDecimal fractionalSeconds = value.getFractionalSecond();
results[3] = createDecimal( abox, (fractionalSeconds == null)
  ? value.getSecond()

代码示例来源:origin: com.github.ansell.pellet/pellet-common

results[1] = createInteger( abox, value.getHour() );
results[2] = createInteger( abox, value.getMinute() );
final BigDecimal fractionalSeconds = value.getFractionalSecond();
results[3] = createDecimal( abox, (fractionalSeconds == null)
  ? value.getSecond()

代码示例来源:origin: Galigator/openllet

@Override
public boolean apply(final ABox abox, final Literal[] args)
{
  if (restBound(args))
  {
    final Literal result = allBound.apply(abox, args[0], argList(args));
    if (result != null)
    {
      if (args[0] == null)
        args[0] = result;
      return true;
    }
    return false;
  }
  if (args[0].getValue() instanceof XMLGregorianCalendar)
  {
    final XMLGregorianCalendar value = (XMLGregorianCalendar) args[0].getValue();
    final Literal[] results = new Literal[5];
    results[0] = args[0];
    results[1] = createInteger(abox, value.getHour());
    results[2] = createInteger(abox, value.getMinute());
    final BigDecimal fractionalSeconds = value.getFractionalSecond();
    results[3] = createDecimal(abox, fractionalSeconds == null ? value.getSecond() : fractionalSeconds.add(BigDecimal.valueOf(value.getSecond())));
    if (value.getTimezone() != DatatypeConstants.FIELD_UNDEFINED)
      results[4] = abox.addLiteral(ATermUtils.makePlainLiteral(toTZ(value.getTimezone())));
    if (mergeResults(args, results))
      return true;
  }
  return false;
}

相关文章