本文整理汇总了Java中org.joda.time.ReadableInstant.get方法的典型用法代码示例。如果您正苦于以下问题:Java ReadableInstant.get方法的具体用法?Java ReadableInstant.get怎么用?Java ReadableInstant.get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.joda.time.ReadableInstant
的用法示例。
在下文中一共展示了ReadableInstant.get方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: compareTo
import org.joda.time.ReadableInstant; //导入方法依赖的package包/类
/**
* Compare this field to the same field on another instant.
* <p>
* The comparison is based on the value of the same field type, irrespective
* of any difference in chronology. Thus, if this property represents the
* hourOfDay field, then the hourOfDay field of the other instant will be queried
* whether in the same chronology or not.
*
* @param instant the instant to compare to
* @return negative value if this is less, 0 if equal, or positive value if greater
* @throws IllegalArgumentException if the instant is null or the instant
* doesn't support the field of this property
*/
public int compareTo(ReadableInstant instant) {
if (instant == null) {
throw new IllegalArgumentException("The instant must not be null");
}
int thisValue = get();
int otherValue = instant.get(getFieldType());
if (thisValue < otherValue) {
return -1;
} else if (thisValue > otherValue) {
return 1;
} else {
return 0;
}
}
示例2: compareTo
import org.joda.time.ReadableInstant; //导入方法依赖的package包/类
/**
* Compare this field to the same field on another instant.
* <p>
* The comparison is based on the value of the same field type, irrespective
* of any difference in chronology. Thus, if this property represents the
* hourOfDay field, then the hourOfDay field of the other instant will be queried
* whether in the same chronology or not.
*
* @param instant the instant to compare to
* @return negative value if this is less, 0 if equal, or positive value if greater
* @throws IllegalArgumentException if the instant is null
*/
public int compareTo(ReadableInstant instant) {
if (instant == null) {
throw new IllegalArgumentException("The instant must not be null");
}
int thisValue = get();
int otherValue = instant.get(getFieldType());
if (thisValue < otherValue) {
return -1;
} else if (thisValue > otherValue) {
return 1;
} else {
return 0;
}
}