本文整理汇总了Java中org.joda.time.chrono.LenientChronology.getInstance方法的典型用法代码示例。如果您正苦于以下问题:Java LenientChronology.getInstance方法的具体用法?Java LenientChronology.getInstance怎么用?Java LenientChronology.getInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.joda.time.chrono.LenientChronology
的用法示例。
在下文中一共展示了LenientChronology.getInstance方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testEqualsHashCode_Lenient
import org.joda.time.chrono.LenientChronology; //导入方法依赖的package包/类
public void testEqualsHashCode_Lenient() {
Chronology chrono1 = LenientChronology.getInstance(ISOChronology.getInstanceUTC());
Chronology chrono2 = LenientChronology.getInstance(ISOChronology.getInstanceUTC());
Chronology chrono3 = LenientChronology.getInstance(ISOChronology.getInstance());
assertEquals(true, chrono1.equals(chrono2));
assertEquals(false, chrono1.equals(chrono3));
DateTime dt1 = new DateTime(0L, chrono1);
DateTime dt2 = new DateTime(0L, chrono2);
DateTime dt3 = new DateTime(0L, chrono3);
assertEquals(true, dt1.equals(dt2));
assertEquals(false, dt1.equals(dt3));
assertEquals(true, chrono1.hashCode() == chrono2.hashCode());
assertEquals(false, chrono1.hashCode() == chrono3.hashCode());
}
示例2: testPropertyEqualsHashCodeLenient
import org.joda.time.chrono.LenientChronology; //导入方法依赖的package包/类
public void testPropertyEqualsHashCodeLenient() {
MonthDay test1 = new MonthDay(5, 6, LenientChronology.getInstance(COPTIC_PARIS));
MonthDay test2 = new MonthDay(5, 6, LenientChronology.getInstance(COPTIC_PARIS));
assertEquals(true, test1.dayOfMonth().equals(test2.dayOfMonth()));
assertEquals(true, test2.dayOfMonth().equals(test1.dayOfMonth()));
assertEquals(true, test1.dayOfMonth().equals(test1.dayOfMonth()));
assertEquals(true, test2.dayOfMonth().equals(test2.dayOfMonth()));
assertEquals(true, test1.dayOfMonth().hashCode() == test2.dayOfMonth().hashCode());
assertEquals(true, test1.dayOfMonth().hashCode() == test1.dayOfMonth().hashCode());
assertEquals(true, test2.dayOfMonth().hashCode() == test2.dayOfMonth().hashCode());
}
示例3: testPropertyEqualsHashCodeLenient
import org.joda.time.chrono.LenientChronology; //导入方法依赖的package包/类
public void testPropertyEqualsHashCodeLenient() {
YearMonth test1 = new YearMonth(1970, 6, LenientChronology.getInstance(COPTIC_PARIS));
YearMonth test2 = new YearMonth(1970, 6, LenientChronology.getInstance(COPTIC_PARIS));
assertEquals(true, test1.monthOfYear().equals(test2.monthOfYear()));
assertEquals(true, test2.monthOfYear().equals(test1.monthOfYear()));
assertEquals(true, test1.monthOfYear().equals(test1.monthOfYear()));
assertEquals(true, test2.monthOfYear().equals(test2.monthOfYear()));
assertEquals(true, test1.monthOfYear().hashCode() == test2.monthOfYear().hashCode());
assertEquals(true, test1.monthOfYear().hashCode() == test1.monthOfYear().hashCode());
assertEquals(true, test2.monthOfYear().hashCode() == test2.monthOfYear().hashCode());
}
示例4: testPropertyEqualsHashCodeLenient
import org.joda.time.chrono.LenientChronology; //导入方法依赖的package包/类
public void testPropertyEqualsHashCodeLenient() {
DateTime test1 = new DateTime(1970, 6, 9, 0, 0, 0, 0, LenientChronology.getInstance(COPTIC_PARIS));
DateTime test2 = new DateTime(1970, 6, 9, 0, 0, 0, 0, LenientChronology.getInstance(COPTIC_PARIS));
assertEquals(true, test1.dayOfMonth().equals(test2.dayOfMonth()));
assertEquals(true, test2.dayOfMonth().equals(test1.dayOfMonth()));
assertEquals(true, test1.dayOfMonth().equals(test1.dayOfMonth()));
assertEquals(true, test2.dayOfMonth().equals(test2.dayOfMonth()));
assertEquals(true, test1.dayOfMonth().hashCode() == test2.dayOfMonth().hashCode());
assertEquals(true, test1.dayOfMonth().hashCode() == test1.dayOfMonth().hashCode());
assertEquals(true, test2.dayOfMonth().hashCode() == test2.dayOfMonth().hashCode());
}
示例5: testEqualsHashCodeLenient
import org.joda.time.chrono.LenientChronology; //导入方法依赖的package包/类
public void testEqualsHashCodeLenient() {
LocalDate test1 = new LocalDate(1970, 6, 9, LenientChronology.getInstance(COPTIC_PARIS));
LocalDate test2 = new LocalDate(1970, 6, 9, LenientChronology.getInstance(COPTIC_PARIS));
assertEquals(true, test1.equals(test2));
assertEquals(true, test2.equals(test1));
assertEquals(true, test1.equals(test1));
assertEquals(true, test2.equals(test2));
assertEquals(true, test1.hashCode() == test2.hashCode());
assertEquals(true, test1.hashCode() == test1.hashCode());
assertEquals(true, test2.hashCode() == test2.hashCode());
}
示例6: testPropertyEqualsHashCodeLenient
import org.joda.time.chrono.LenientChronology; //导入方法依赖的package包/类
public void testPropertyEqualsHashCodeLenient() {
YearMonthDay test1 = new YearMonthDay(1970, 6, 9, LenientChronology.getInstance(COPTIC_PARIS));
YearMonthDay test2 = new YearMonthDay(1970, 6, 9, LenientChronology.getInstance(COPTIC_PARIS));
assertEquals(true, test1.dayOfMonth().equals(test2.dayOfMonth()));
assertEquals(true, test2.dayOfMonth().equals(test1.dayOfMonth()));
assertEquals(true, test1.dayOfMonth().equals(test1.dayOfMonth()));
assertEquals(true, test2.dayOfMonth().equals(test2.dayOfMonth()));
assertEquals(true, test1.dayOfMonth().hashCode() == test2.dayOfMonth().hashCode());
assertEquals(true, test1.dayOfMonth().hashCode() == test1.dayOfMonth().hashCode());
assertEquals(true, test2.dayOfMonth().hashCode() == test2.dayOfMonth().hashCode());
}
示例7: testPropertyEqualsHashCodeLenient
import org.joda.time.chrono.LenientChronology; //导入方法依赖的package包/类
public void testPropertyEqualsHashCodeLenient() {
DateMidnight test1 = new DateMidnight(1970, 6, 9, LenientChronology.getInstance(COPTIC_PARIS));
DateMidnight test2 = new DateMidnight(1970, 6, 9, LenientChronology.getInstance(COPTIC_PARIS));
assertEquals(true, test1.dayOfMonth().equals(test2.dayOfMonth()));
assertEquals(true, test2.dayOfMonth().equals(test1.dayOfMonth()));
assertEquals(true, test1.dayOfMonth().equals(test1.dayOfMonth()));
assertEquals(true, test2.dayOfMonth().equals(test2.dayOfMonth()));
assertEquals(true, test1.dayOfMonth().hashCode() == test2.dayOfMonth().hashCode());
assertEquals(true, test1.dayOfMonth().hashCode() == test1.dayOfMonth().hashCode());
assertEquals(true, test2.dayOfMonth().hashCode() == test2.dayOfMonth().hashCode());
}
示例8: testEqualsHashCodeLenient
import org.joda.time.chrono.LenientChronology; //导入方法依赖的package包/类
public void testEqualsHashCodeLenient() {
Interval test1 = new Interval(
new DateTime(TEST_TIME1, LenientChronology.getInstance(COPTIC_PARIS)),
new DateTime(TEST_TIME2, LenientChronology.getInstance(COPTIC_PARIS)));
Interval test2 = new Interval(
new DateTime(TEST_TIME1, LenientChronology.getInstance(COPTIC_PARIS)),
new DateTime(TEST_TIME2, LenientChronology.getInstance(COPTIC_PARIS)));
assertEquals(true, test1.equals(test2));
assertEquals(true, test2.equals(test1));
assertEquals(true, test1.equals(test1));
assertEquals(true, test2.equals(test2));
assertEquals(true, test1.hashCode() == test2.hashCode());
assertEquals(true, test1.hashCode() == test1.hashCode());
assertEquals(true, test2.hashCode() == test2.hashCode());
}
示例9: testEqualsHashCodeStrict
import org.joda.time.chrono.LenientChronology; //导入方法依赖的package包/类
public void testEqualsHashCodeStrict() {
Interval test1 = new Interval(
new DateTime(TEST_TIME1, LenientChronology.getInstance(COPTIC_PARIS)),
new DateTime(TEST_TIME2, LenientChronology.getInstance(COPTIC_PARIS)));
Interval test2 = new Interval(
new DateTime(TEST_TIME1, LenientChronology.getInstance(COPTIC_PARIS)),
new DateTime(TEST_TIME2, LenientChronology.getInstance(COPTIC_PARIS)));
assertEquals(true, test1.equals(test2));
assertEquals(true, test2.equals(test1));
assertEquals(true, test1.equals(test1));
assertEquals(true, test2.equals(test2));
assertEquals(true, test1.hashCode() == test2.hashCode());
assertEquals(true, test1.hashCode() == test1.hashCode());
assertEquals(true, test2.hashCode() == test2.hashCode());
}
示例10: testPropertyEqualsHashCodeLenient
import org.joda.time.chrono.LenientChronology; //导入方法依赖的package包/类
public void testPropertyEqualsHashCodeLenient() {
LocalDate test1 = new LocalDate(1970, 6, 9, LenientChronology.getInstance(COPTIC_PARIS));
LocalDate test2 = new LocalDate(1970, 6, 9, LenientChronology.getInstance(COPTIC_PARIS));
assertEquals(true, test1.dayOfMonth().equals(test2.dayOfMonth()));
assertEquals(true, test2.dayOfMonth().equals(test1.dayOfMonth()));
assertEquals(true, test1.dayOfMonth().equals(test1.dayOfMonth()));
assertEquals(true, test2.dayOfMonth().equals(test2.dayOfMonth()));
assertEquals(true, test1.dayOfMonth().hashCode() == test2.dayOfMonth().hashCode());
assertEquals(true, test1.dayOfMonth().hashCode() == test1.dayOfMonth().hashCode());
assertEquals(true, test2.dayOfMonth().hashCode() == test2.dayOfMonth().hashCode());
}
示例11: createFormatter
import org.joda.time.chrono.LenientChronology; //导入方法依赖的package包/类
/**
* 変換規則から、{@link DateTimeFormatter}のインスタンスを作成する。
* <p>アノテーション{@link CsvDateTimeFormat}が付与されていない場合は、各種タイプごとの標準の書式で作成する。</p>
* @param field フィールド情報
* @param config システム設定
* @return {@link DateTimeFormatter}のインスタンス。
*/
protected DateTimeFormatter createFormatter(final FieldAccessor field, final Configuration config) {
final Optional<CsvDateTimeFormat> formatAnno = field.getAnnotation(CsvDateTimeFormat.class);
if(!formatAnno.isPresent()) {
return DateTimeFormat.forPattern(getDefaultPattern());
}
String pattern = formatAnno.get().pattern();
if(pattern.isEmpty()) {
pattern = getDefaultPattern();
}
final Locale locale = Utils.getLocale(formatAnno.get().locale());
final DateTimeZone zone = formatAnno.get().timezone().isEmpty() ? DateTimeZone.getDefault()
: DateTimeZone.forTimeZone(TimeZone.getTimeZone(formatAnno.get().timezone()));
final DateTimeFormatter formatter = DateTimeFormat.forPattern(pattern)
.withLocale(locale)
.withZone(zone);
final boolean lenient = formatAnno.get().lenient();
if(lenient) {
Chronology chronology = LenientChronology.getInstance(ISOChronology.getInstance());
return formatter.withChronology(chronology);
} else {
return formatter;
}
}
示例12: getLenientISOChronology
import org.joda.time.chrono.LenientChronology; //导入方法依赖的package包/类
static Chronology getLenientISOChronology() {
if (cLenientISO == null) {
cLenientISO = LenientChronology.getInstance(ISOChronology.getInstanceUTC());
}
return cLenientISO;
}