@Override
 public ZonedDateTime buildObject(FudgeDeserializationContext context, FudgeMsg msg) {
   final OffsetDateTime odt = msg.getValue(OffsetDateTime.class, ODT_FIELD_NAME);
   if (odt == null) {
     throw new IllegalArgumentException(
         "Fudge message is not a ZonedDateTime - field 'odt' is not present");
   }
   final String zone = msg.getString(ZONE_FIELD_NAME);
   if (zone == null) {
     throw new IllegalArgumentException(
         "Fudge message is not a ZonedDateTime - field 'zone' is not present");
   }
   return ZonedDateTime.of(odt, TimeZone.of(zone));
 }
Пример #2
0
 /**
  * Gets the time-zone. For larger regions, there can be multiple time-zones, so this is only
  * reliable for municipalities.
  *
  * @return the value of the property
  */
 public TimeZone getTimeZone() {
   String id = _externalIdBundle.getValue(ExternalSchemes.TZDB_TIME_ZONE);
   return (id != null ? TimeZone.of(id) : null);
 }
Пример #3
0
 /**
  * Creates a tz database time-zone code.
  *
  * <p>Examples might be {@code Europe/London} or {@code Asia/Hong_Kong}.
  *
  * @param zone the time-zone, not null
  * @return the region identifier, not null
  */
 public static ExternalId timeZoneRegionId(TimeZone zone) {
   ArgumentChecker.notNull(zone, "zone");
   return ExternalId.of(TZDB_TIME_ZONE, zone.getID());
 }