gpt4 book ai didi

java.time.ZoneId.equals()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-17 17:46:40 29 4
gpt4 key购买 nike

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

ZoneId.equals介绍

[英]Checks if this time-zone ID is equal to another time-zone ID.

The comparison is based on the ID.
[中]检查此时区ID是否等于另一个时区ID。
比较基于ID。

代码示例

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

@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);
}

代码示例来源:origin: blynkkk/blynk-server

@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);
}

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

@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);
}

代码示例来源:origin: apache/hive

@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());
}

代码示例来源:origin: apache/flink

@Override
public Clock withZone(ZoneId zone) {
  if (zone.equals(this.zoneId)) {
    return this;
  }
  return new SettableClock(zone, epochMilli);
}

代码示例来源:origin: apache/hive

@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;
}

代码示例来源:origin: apache/hive

@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();
}

代码示例来源:origin: apache/hive

@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;
 }
}

代码示例来源:origin: apache/hive

@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;
}

代码示例来源:origin: apache/hive

@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);
}

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

final ZoneId defaultZoneId) {
if (this.instantSeconds != null) {
  if (!defaultZoneId.equals(ZoneOffset.UTC)) {

代码示例来源:origin: apache/hive

@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;
}

代码示例来源:origin: apache/hive

@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;
}

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

@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;
}

代码示例来源:origin: org.elasticsearch/elasticsearch

@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;
}

代码示例来源:origin: com.vaadin/vaadin-server

/**
 * 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;
}

代码示例来源:origin: org.elasticsearch/elasticsearch

@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);
}

代码示例来源:origin: apache/metron

@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));
}

代码示例来源:origin: apache/metron

@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));
}

代码示例来源:origin: apache/metron

@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));
}

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com