Java Code Examples for org.joda.time.chrono.LenientChronology#getInstance()
The following examples show how to use
org.joda.time.chrono.LenientChronology#getInstance() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TestChronology.java From astor with GNU General Public License v2.0 | 6 votes |
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()); }
Example 2
Source File: AbstractJodaProcessorBuilder.java From super-csv-annotation with Apache License 2.0 | 5 votes |
/** * 変換規則から、{@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; } }
Example 3
Source File: TestLocalDate_Properties.java From astor with GNU General Public License v2.0 | 5 votes |
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()); }
Example 4
Source File: TestYearMonthDay_Properties.java From astor with GNU General Public License v2.0 | 5 votes |
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()); }
Example 5
Source File: TestInterval_Basics.java From astor with GNU General Public License v2.0 | 5 votes |
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()); }
Example 6
Source File: TestYearMonth_Properties.java From astor with GNU General Public License v2.0 | 5 votes |
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()); }
Example 7
Source File: TestDateMidnight_Properties.java From astor with GNU General Public License v2.0 | 5 votes |
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()); }
Example 8
Source File: TestMonthDay_Properties.java From astor with GNU General Public License v2.0 | 5 votes |
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()); }
Example 9
Source File: TestYearMonthDay_Properties.java From astor with GNU General Public License v2.0 | 5 votes |
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()); }
Example 10
Source File: TestInterval_Basics.java From astor with GNU General Public License v2.0 | 5 votes |
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()); }
Example 11
Source File: TestDateMidnight_Properties.java From astor with GNU General Public License v2.0 | 5 votes |
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()); }
Example 12
Source File: TestLocalDate_Properties.java From astor with GNU General Public License v2.0 | 5 votes |
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()); }
Example 13
Source File: TestInterval_Basics.java From astor with GNU General Public License v2.0 | 5 votes |
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()); }
Example 14
Source File: TestDateTime_Properties.java From astor with GNU General Public License v2.0 | 5 votes |
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()); }
Example 15
Source File: TestYearMonth_Properties.java From astor with GNU General Public License v2.0 | 5 votes |
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()); }
Example 16
Source File: TestMonthDay_Properties.java From astor with GNU General Public License v2.0 | 5 votes |
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()); }
Example 17
Source File: Time_11_ZoneInfoCompiler_s.java From coming with MIT License | 4 votes |
static Chronology getLenientISOChronology() { if (cLenientISO == null) { cLenientISO = LenientChronology.getInstance(ISOChronology.getInstanceUTC()); } return cLenientISO; }
Example 18
Source File: ZoneInfoCompiler.java From astor with GNU General Public License v2.0 | 4 votes |
static Chronology getLenientISOChronology() { if (cLenientISO == null) { cLenientISO = LenientChronology.getInstance(ISOChronology.getInstanceUTC()); } return cLenientISO; }
Example 19
Source File: ZoneInfoCompiler.java From astor with GNU General Public License v2.0 | 4 votes |
static Chronology getLenientISOChronology() { if (cLenientISO == null) { cLenientISO = LenientChronology.getInstance(ISOChronology.getInstanceUTC()); } return cLenientISO; }
Example 20
Source File: Time_11_ZoneInfoCompiler_t.java From coming with MIT License | 4 votes |
static Chronology getLenientISOChronology() { if (cLenientISO == null) { cLenientISO = LenientChronology.getInstance(ISOChronology.getInstanceUTC()); } return cLenientISO; }