org.joda.time.LocalTime.fromCalendarFields()方法的使用及代码示例

x33g5p2x  于2022-01-23 转载在 其他  
字(2.9k)|赞(0)|评价(0)|浏览(215)

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

LocalTime.fromCalendarFields介绍

[英]Constructs a LocalTime from a java.util.Calendar using exactly the same field values.

Each field is queried from the Calendar and assigned to the LocalTime. This is useful if you have been using the Calendar as a local time, ignoring the zone.

One advantage of this method is that this method is unaffected if the version of the time zone data differs between the JDK and Joda-Time. That is because the local field values are transferred, calculated using the JDK time zone data and without using the Joda-Time time zone data.

This factory method ignores the type of the calendar and always creates a LocalTime with ISO chronology. It is expected that you will only pass in instances of GregorianCalendar however this is not validated.
[中]使用完全相同的字段值从java.util.Calendar构造LocalTime。
从日历中查询每个字段并将其分配给LocalTime。如果您一直将日历用作本地时间,而忽略区域,则此选项非常有用。
此方法的一个优点是,如果时区数据的版本在JDK和Joda时间之间不同,则此方法不受影响。这是因为本地字段值是使用JDK时区数据传输、计算的,而不使用Joda时区数据。
此factory方法忽略日历的类型,并始终使用ISO时间顺序创建LocalTime。预计您将只在GregorianCalendar的实例中传递,但这不会得到验证。

代码示例

代码示例来源:origin: org.jboss.oreva/odata-core

/**
 * Creates a new LocalTime-valued OData property with {@link EdmSimpleType#TIME}
 *
 * @param name  the property name
 * @param value  the property value
 * @return a new OData property instance
 */
public static OProperty<LocalTime> time(String name, Calendar value) {
 return new Impl<LocalTime>(name, EdmSimpleType.TIME, value != null ? LocalTime.fromCalendarFields(value) : null);
}

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

/**
 * Creates a new LocalTime-valued OData property with {@link EdmSimpleType#TIME}
 *
 * @param name  the property name
 * @param value  the property value
 * @return a new OData property instance
 */
public static OProperty<LocalTime> time(String name, Calendar value) {
 return new Impl<LocalTime>(name, EdmSimpleType.TIME, value != null ? LocalTime.fromCalendarFields(value) : null);
}

代码示例来源:origin: org.sonatype.sisu/sisu-odata4j

/**
 * Creates a new LocalTime-valued OData property with {@link EdmSimpleType#TIME}
 *
 * @param name  the property name
 * @param value  the property value
 * @return a new OData property instance
 */
public static OProperty<LocalTime> time(String name, Calendar value) {
 return new Impl<LocalTime>(name, EdmSimpleType.TIME, value != null ? LocalTime.fromCalendarFields(value) : null);
}

代码示例来源:origin: org.sonatype.sisu/sisu-odata4j

return (T) LocalTime.fromDateFields((Date) obj);
else if (Calendar.class.isAssignableFrom(objClass))
 return (T) LocalTime.fromCalendarFields((Calendar) obj);

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

return (T) LocalTime.fromDateFields((Date) obj);
else if (Calendar.class.isAssignableFrom(objClass))
 return (T) LocalTime.fromCalendarFields((Calendar) obj);

代码示例来源:origin: org.jboss.oreva/odata-core

return (T) LocalTime.fromDateFields((Date) obj);
else if (Calendar.class.isAssignableFrom(objClass))
 return (T) LocalTime.fromCalendarFields((Calendar) obj);

相关文章