@Override public boolean equals(Object other) { if (! (other instanceof FeedIdWithTimezone)) return false; FeedIdWithTimezone v = (FeedIdWithTimezone) other; return feedId.equals(v.feedId) && zoneId.equals(v.zoneId); }
@Override public boolean equals(Object o) { if (this == o) { return true; } if (!(o instanceof TimerTime)) { return false; } TimerTime timerTime = (TimerTime) o; if (id != timerTime.id) { return false; } if (time != timerTime.time) { return false; } if (!Arrays.equals(days, timerTime.days)) { return false; } return !(tzName != null ? !tzName.equals(timerTime.tzName) : timerTime.tzName != null); }
@Override public boolean equals(Object other) { if (! (other instanceof Validity)) return false; Validity v = (Validity) other; return validity.equals(v.validity) && zoneId.equals(v.zoneId) && start.equals(v.start); }
@Override public boolean equals(Object other) { if (this == other) { return true; } if (other == null || getClass() != other.getClass()) { return false; } TimestampLocalTZTypeInfo dti = (TimestampLocalTZTypeInfo) other; return this.timeZone().equals(dti.timeZone()); }
@Override public Clock withZone(ZoneId zone) { if (zone.equals(this.zoneId)) { return this; } return new SettableClock(zone, epochMilli); }
@Override public TimestampLocalTZWritable getPrimitiveWritableObject(Object o) { if (o == null) { return null; } TimestampLocalTZWritable t = (TimestampLocalTZWritable) o; TimestampLocalTZTypeInfo timestampTZTypeInfo = (TimestampLocalTZTypeInfo) typeInfo; if (!t.getTimestampTZ().getZonedDateTime().getZone().equals(timestampTZTypeInfo.timeZone())) { t.setTimeZone(timestampTZTypeInfo.timeZone()); } return t; }
@Override public TimestampTZ getPrimitiveJavaObject(Object o) { if (o == null) { return null; } TimestampLocalTZWritable t = (TimestampLocalTZWritable) o; TimestampLocalTZTypeInfo timestampTZTypeInfo = (TimestampLocalTZTypeInfo) typeInfo; if (!t.getTimestampTZ().getZonedDateTime().getZone().equals(timestampTZTypeInfo.timeZone())) { t.setTimeZone(timestampTZTypeInfo.timeZone()); } return t.getTimestampTZ(); }
@Override public TimestampTZ getPrimitiveJavaObject(Object o) { if (o == null) { return null; } TimestampTZ t = (TimestampTZ) o; TimestampLocalTZTypeInfo timestampTZTypeInfo = (TimestampLocalTZTypeInfo) typeInfo; if (!t.getZonedDateTime().getZone().equals(timestampTZTypeInfo.timeZone())) { t.setZonedDateTime( t.getZonedDateTime().withZoneSameInstant(timestampTZTypeInfo.timeZone())); } return t; } }
@Override public Object set(Object o, TimestampTZ t) { if (t == null) { return null; } TimestampLocalTZTypeInfo timestampTZTypeInfo = (TimestampLocalTZTypeInfo) typeInfo; if (!t.getZonedDateTime().getZone().equals(timestampTZTypeInfo.timeZone())) { t.setZonedDateTime(t.getZonedDateTime().withZoneSameInstant(timestampTZTypeInfo.timeZone())); } ((TimestampLocalTZWritable) o).set(t); return o; }
@Override public TimestampLocalTZWritable getPrimitiveWritableObject(Object o) { if (o == null) { return null; } TimestampTZ t = (TimestampTZ) o; TimestampLocalTZTypeInfo timestampTZTypeInfo = (TimestampLocalTZTypeInfo) typeInfo; if (!t.getZonedDateTime().getZone().equals(timestampTZTypeInfo.timeZone())) { t.setZonedDateTime( t.getZonedDateTime().withZoneSameInstant(timestampTZTypeInfo.timeZone())); } return new TimestampLocalTZWritable(t); }
final ZoneId defaultZoneId) { if (this.instantSeconds != null) { if (!defaultZoneId.equals(ZoneOffset.UTC)) {
@Override public TimestampTZ getPrimitiveJavaObject(Object o) { if (o == null) { return null; } TimestampTZ t = ((LazyTimestampLocalTZ) o).getWritableObject().getTimestampTZ(); TimestampLocalTZTypeInfo timestampTZTypeInfo = (TimestampLocalTZTypeInfo) typeInfo; if (!t.getZonedDateTime().getZone().equals(timestampTZTypeInfo.timeZone())) { t.setZonedDateTime(t.getZonedDateTime().withZoneSameInstant(timestampTZTypeInfo.timeZone())); } return t; }
@Override public Object set(Object o, TimestampLocalTZWritable t) { if (t == null) { return null; } TimestampLocalTZTypeInfo timestampTZTypeInfo = (TimestampLocalTZTypeInfo) typeInfo; if (!t.getTimestampTZ().getZonedDateTime().getZone().equals(timestampTZTypeInfo.timeZone())) { t.getTimestampTZ().setZonedDateTime( t.getTimestampTZ().getZonedDateTime().withZoneSameInstant(timestampTZTypeInfo.timeZone())); } ((TimestampLocalTZWritable) o).set(t); return o; }
@Override public boolean equals( Value other ) { if ( other instanceof DateTimeValue ) { ZonedDateTime that = ((DateTimeValue) other).value; boolean res = value.toLocalDateTime().equals( that.toLocalDateTime() ); if ( res ) { ZoneId thisZone = value.getZone(); ZoneId thatZone = that.getZone(); boolean thisIsOffset = thisZone instanceof ZoneOffset; boolean thatIsOffset = thatZone instanceof ZoneOffset; if ( thisIsOffset && thatIsOffset ) { res = thisZone.equals( thatZone ); } else if ( !thisIsOffset && !thatIsOffset ) { res = TimeZones.map( thisZone.getId() ) == TimeZones.map( thatZone.getId() ); } else { res = false; } } return res; } return false; }
@Override public DateFormatter withZone(ZoneId zoneId) { if (zoneId.equals(ZoneOffset.UTC) == false) { throw new IllegalArgumentException(pattern() + " date formatter can only be in zone offset UTC"); } return this; }
/** * Sets the {@link ZoneId}, which is used when {@code z} is included inside * the {@link #setDateFormat(String)}. * * @param zoneId * the zone id * @since 8.2 */ public void setZoneId(ZoneId zoneId) { if (zoneId != this.zoneId || (zoneId != null && !zoneId.equals(this.zoneId))) { updateTimeZoneJSON(zoneId, getLocale()); } this.zoneId = zoneId; }
@Override public DateFormatter withZone(ZoneId zoneId) { // shortcurt to not create new objects unnecessarily if (zoneId.equals(parsers[0].getZone())) { return this; } final DateTimeFormatter[] parsersWithZone = new DateTimeFormatter[parsers.length]; for (int i = 0; i < parsers.length; i++) { parsersWithZone[i] = parsers[i].withZone(zoneId); } return new JavaDateFormatter(format, printer.withZone(zoneId), parsersWithZone); }
@Test public void testConfigureDefault() { Map<String, Object> parserConfig = new HashMap<>(); Syslog5424Parser testParser = new Syslog5424Parser(); testParser.configure(parserConfig); testParser.init(); assertTrue(testParser.deviceClock.getZone().equals(ZoneOffset.UTC)); }
@Test public void testConfigureDefault() { Map<String, Object> parserConfig = new HashMap<>(); BasicAsaParser testParser = new BasicAsaParser(); testParser.configure(parserConfig); testParser.init(); assertTrue(testParser.deviceClock.getZone().equals(ZoneOffset.UTC)); }
@Test public void testConfigureDefault() { Map<String, Object> parserConfig = new HashMap<>(); Syslog3164Parser testParser = new Syslog3164Parser(); testParser.configure(parserConfig); testParser.init(); assertTrue(testParser.deviceClock.getZone().equals(ZoneOffset.UTC)); }