本文整理了Java中javax.xml.datatype.XMLGregorianCalendar.setFractionalSecond()
方法的一些代码示例,展示了XMLGregorianCalendar.setFractionalSecond()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XMLGregorianCalendar.setFractionalSecond()
方法的具体详情如下:
包路径:javax.xml.datatype.XMLGregorianCalendar
类名称:XMLGregorianCalendar
方法名:setFractionalSecond
[英]Set fractional seconds.
Unset this field by invoking the setter with a parameter value of null
.
[中]设置分数秒。
通过调用参数值为[$0$]的setter来取消设置此字段。
代码示例来源:origin: robovm/robovm
/**
* <p>Set time as one unit, including the optional infinite precision
* fractional seconds.</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>.
* @param fractional value of <code>null</code> indicates this optional
* field is not set.
*
* @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,
BigDecimal fractional) {
setHour(hour);
setMinute(minute);
setSecond(second);
setFractionalSecond(fractional);
}
代码示例来源:origin: apache/metron
ErrorUtils.RuntimeErrors.ILLEGAL_STATE.throwRuntime("Unable to set the begin time due to", e);
gTime.setFractionalSecond(null);
LOG.info("Begin Time: {}", gTime);
request.setExclusiveBeginTimestamp(gTime);
代码示例来源:origin: at.bestsolution.efxclipse.eclipse/org.eclipse.emf.ecore
@Override
public void setFractionalSecond(BigDecimal fractionalSecond)
{
xmlGregorianCalendar.setFractionalSecond(fractionalSecond);
}
代码示例来源:origin: org.eclipse.emf/org.eclipse.emf.ecore
@Override
public void setFractionalSecond(BigDecimal fractionalSecond)
{
xmlGregorianCalendar.setFractionalSecond(fractionalSecond);
}
代码示例来源:origin: psidev.psi.mi/psi25-xml
public void setFractionalSecond( BigDecimal fractional ) {
calendar.setFractionalSecond( fractional );
}
代码示例来源:origin: psidev.psi.mi/psi25-xml
public void setFractionalSecond( BigDecimal fractional ) {
calendar.setFractionalSecond( fractional );
}
代码示例来源:origin: org.openrdf.alibaba/alibaba-repository-object
public Literal serialize(Timestamp object) {
GregorianCalendar gc = new GregorianCalendar(0, 0, 0);
gc.setTime(object);
XMLGregorianCalendar xgc = factory.newXMLGregorianCalendar(gc);
BigDecimal fraction = BigDecimal.valueOf(object.getNanos(), 9);
xgc.setFractionalSecond(fraction);
String label = xgc.toXMLFormat();
return vf.createLiteral(label, datatype);
}
代码示例来源:origin: org.openrdf.elmo/elmo-sesame
public Literal serialize(Timestamp object) {
GregorianCalendar gc = new GregorianCalendar(0, 0, 0);
gc.setTime(object);
XMLGregorianCalendar xgc = factory.newXMLGregorianCalendar(gc);
BigDecimal fraction = BigDecimal.valueOf(object.getNanos(), 9);
xgc.setFractionalSecond(fraction);
String label = xgc.toXMLFormat();
return vf.createLiteral(label, datatype);
}
代码示例来源:origin: anno4j/anno4j
public Literal serialize(Timestamp object) {
GregorianCalendar gc = new GregorianCalendar(0, 0, 0);
gc.setTime(object);
XMLGregorianCalendar xgc = factory.newXMLGregorianCalendar(gc);
BigDecimal fraction = BigDecimal.valueOf(object.getNanos(), 9);
xgc.setFractionalSecond(fraction);
String label = xgc.toXMLFormat();
return vf.createLiteral(label, datatype);
}
代码示例来源:origin: prowide/prowide-core
@Override
public XMLGregorianCalendar deserialize(JsonElement jsonElement, Type type, JsonDeserializationContext jsonDeserializationContext) {
try {
JsonObject obj = jsonElement.getAsJsonObject();
XMLGregorianCalendar xmlGregCalendar = DatatypeFactory.newInstance().newXMLGregorianCalendar(
obj.get(YEAR).getAsInt(),
obj.get(MONTH).getAsInt(),
obj.get(DAY).getAsInt(),
obj.get(HOUR).getAsInt(),
obj.get(MINUTE).getAsInt(),
obj.get(SECOND).getAsInt(),
0,
obj.get(TIMEZONE).getAsInt());
xmlGregCalendar.setFractionalSecond(obj.get(FRACTIONAL).getAsBigDecimal());
return xmlGregCalendar;
// use the line below as implementation in Java 8
//return DatatypeFactory.newInstance().newXMLGregorianCalendar(jsonElement.getAsString());
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
代码示例来源:origin: arhs/sd-dss
/**
* Converts a given {@code Date} to a new {@code XMLGregorianCalendar}.
*
* @param date the date to be converted
* @return the new {@code XMLGregorianCalendar} or null
*/
public static XMLGregorianCalendar createXMLGregorianCalendar(final Date date) {
if (date == null) {
return null;
}
final GregorianCalendar calendar = new GregorianCalendar();
calendar.setTime(date);
try {
XMLGregorianCalendar xmlGregorianCalendar = DatatypeFactory.newInstance().newXMLGregorianCalendar(calendar);
xmlGregorianCalendar.setFractionalSecond(null);
xmlGregorianCalendar = xmlGregorianCalendar.normalize(); // to UTC = Zulu
return xmlGregorianCalendar;
} catch (DatatypeConfigurationException e) {
// LOG.warn("Unable to properly convert a Date to an XMLGregorianCalendar",e);
}
return null;
}
代码示例来源:origin: esig/dss
/**
* Converts a given {@code Date} to a new {@code XMLGregorianCalendar}.
*
* @param date
* the date to be converted
* @return the new {@code XMLGregorianCalendar} or null
*/
public static XMLGregorianCalendar createXMLGregorianCalendar(final Date date) {
if (date == null) {
return null;
}
final GregorianCalendar calendar = new GregorianCalendar();
calendar.setTime(date);
try {
XMLGregorianCalendar xmlGregorianCalendar = DatatypeFactory.newInstance().newXMLGregorianCalendar(calendar);
xmlGregorianCalendar.setFractionalSecond(null);
return xmlGregorianCalendar.normalize(); // to UTC = Zulu
} catch (DatatypeConfigurationException e) {
LOG.warn("Unable to properly convert a Date to an XMLGregorianCalendar " + e.getMessage(), e);
}
return null;
}
代码示例来源:origin: cpesch/RouteConverter
public static XMLGregorianCalendar formatXMLTime(CompactCalendar time, boolean reduceTimeToSecondPrecision) {
if (time == null)
return null;
try {
GregorianCalendar gregorianCalendar = toUTC(time.getCalendar());
XMLGregorianCalendar result = getDataTypeFactory().newXMLGregorianCalendar(gregorianCalendar);
if (reduceTimeToSecondPrecision)
result.setFractionalSecond(null);
return result;
} catch (DatatypeConfigurationException e) {
return null;
}
}
代码示例来源:origin: com.mobidevelop.robovm/robovm-rt
/**
* <p>Set time as one unit, including the optional infinite precision
* fractional seconds.</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>.
* @param fractional value of <code>null</code> indicates this optional
* field is not set.
*
* @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,
BigDecimal fractional) {
setHour(hour);
setMinute(minute);
setSecond(second);
setFractionalSecond(fractional);
}
代码示例来源:origin: FlexoVM/flexovm
/**
* <p>Set time as one unit, including the optional infinite precision
* fractional seconds.</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>.
* @param fractional value of <code>null</code> indicates this optional
* field is not set.
*
* @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,
BigDecimal fractional) {
setHour(hour);
setMinute(minute);
setSecond(second);
setFractionalSecond(fractional);
}
代码示例来源:origin: MobiVM/robovm
/**
* <p>Set time as one unit, including the optional infinite precision
* fractional seconds.</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>.
* @param fractional value of <code>null</code> indicates this optional
* field is not set.
*
* @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,
BigDecimal fractional) {
setHour(hour);
setMinute(minute);
setSecond(second);
setFractionalSecond(fractional);
}
代码示例来源:origin: javax.xml.parsers/jaxp-api
/**
* <p>Set time as one unit, including the optional infinite precision
* fractional seconds.</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>.
* @param fractional value of <code>null</code> indicates this optional
* field is not set.
*
* @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,
BigDecimal fractional) {
setHour(hour);
setMinute(minute);
setSecond(second);
setFractionalSecond(fractional);
}
代码示例来源:origin: com.bugvm/bugvm-rt
/**
* <p>Set time as one unit, including the optional infinite precision
* fractional seconds.</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>.
* @param fractional value of <code>null</code> indicates this optional
* field is not set.
*
* @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,
BigDecimal fractional) {
setHour(hour);
setMinute(minute);
setSecond(second);
setFractionalSecond(fractional);
}
代码示例来源:origin: ibinti/bugvm
/**
* <p>Set time as one unit, including the optional infinite precision
* fractional seconds.</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>.
* @param fractional value of <code>null</code> indicates this optional
* field is not set.
*
* @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,
BigDecimal fractional) {
setHour(hour);
setMinute(minute);
setSecond(second);
setFractionalSecond(fractional);
}
代码示例来源:origin: stackoverflow.com
cal.setMinute(ldt.getMinute());
cal.setSecond(ldt.getSecond());
cal.setFractionalSecond(new BigDecimal("0." + ldt.getNano()));
内容来源于网络,如有侵权,请联系作者删除!