net.fortuna.ical4j.model.TimeZone.getID()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(7.1k)|赞(0)|评价(0)|浏览(117)

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

TimeZone.getID介绍

暂无

代码示例

代码示例来源:origin: net.oneandone.cosmo/cosmo-core

/**
   * Register.
   * @param timezone The timezone.
   * @param update The boolean for update.
   */
  // @Override
  public void register(TimeZone timezone, boolean update) {
    timezones.put(timezone.getID(), timezone);

  }
}

代码示例来源:origin: 1and1/cosmo

/**
   * Register.
   * @param timezone The timezone.
   * @param update The boolean for update.
   */
  // @Override
  public void register(TimeZone timezone, boolean update) {
    timezones.put(timezone.getID(), timezone);

  }
}

代码示例来源:origin: org.bedework.caleng/bw-calendar-engine-ical

@Override
public void register(final TimeZone timezone) {
 try {
  TimeZone tz = Timezones.getTz(timezone.getID());
  if (tz != null) {
   // Already three
   return;
  }
  if (localTzs == null) {
   localTzs = new HashMap<String, TimeZone>();
  }
  localTzs.put(timezone.getID(), timezone);
 } catch (Throwable t) {
  throw new RuntimeException(t);
 }
}

代码示例来源:origin: org.bedework.caleng/bw-calendar-engine-ical

public void register(final TimeZone timezone) {
 try {
  Timezones.registerTz(timezone.getID(), timezone);
 } catch (Throwable t) {
  throw new RuntimeException(t);
 }
}

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

/**
 * {@inheritDoc}
 */
public final void register(final TimeZone timezone, boolean update) {
  if (update) {
    try {
      // load any available updates for the timezone..
      timezones.put(timezone.getID(), new TimeZone(timeZoneLoader.loadVTimeZone(timezone.getID())));
    } catch (IOException | ParserException | ParseException e) {
      Logger log = LoggerFactory.getLogger(TimeZoneRegistryImpl.class);
      log.warn("Error occurred loading VTimeZone", e);
    }
  } else {
    timezones.put(timezone.getID(), timezone);
  }
}

代码示例来源:origin: org.mnode.ical4j/ical4j

/**
 * {@inheritDoc}
 */
public final void register(final TimeZone timezone, boolean update) {
  if (update) {
    try {
      // load any available updates for the timezone..
      timezones.put(timezone.getID(), new TimeZone(timeZoneLoader.loadVTimeZone(timezone.getID())));
    } catch (IOException | ParserException | ParseException e) {
      Logger log = LoggerFactory.getLogger(TimeZoneRegistryImpl.class);
      log.warn("Error occurred loading VTimeZone", e);
    }
  } else {
    timezones.put(timezone.getID(), timezone);
  }
}

代码示例来源:origin: org.bedework/bw-ical4j-cl

/**
 * {@inheritDoc}
 */
public final void register(final TimeZone timezone, boolean update) {
  if (update) {
    // load any available updates for the timezone..
    timezones.put(timezone.getID(), new TimeZone(updateDefinition(timezone.getVTimeZone())));
  }
  else {
    timezones.put(timezone.getID(), timezone);
  }
}

代码示例来源:origin: org.bedework.ical4j/ical4j

/**
 * {@inheritDoc}
 */
public final void register(final TimeZone timezone, boolean update) {
  if (update) {
    // load any available updates for the timezone..
    timezones.put(timezone.getID(), new TimeZone(updateDefinition(timezone.getVTimeZone())));
  } else {
    timezones.put(timezone.getID(), timezone);
  }
}

代码示例来源:origin: net.oneandone.ical4j/ical4j

/**
 * {@inheritDoc}
 */
public final void register(final TimeZone timezone, boolean update) {
  if (update) {
    // load any available updates for the timezone..
    timezones.put(timezone.getID(), new TimeZone(updateDefinition(timezone.getVTimeZone())));
  } else {
    timezones.put(timezone.getID(), timezone);
  }
}

代码示例来源:origin: net.oneandone.cosmo/cosmo-core

/**
 * Gets timezone id.
 * @param date The date.
 * @return The id.
 */
private String getTzId(Date date) {
  if(date instanceof DateTime) {
    DateTime dt = (DateTime) date;
    if (dt.getTimeZone()!=null) {
      return dt.getTimeZone().getID();
    }
  }
  
  return null;
}

代码示例来源:origin: 1and1/cosmo

/**
 * Gets timezone id.
 * @param date The date.
 * @return The id.
 */
private String getTzId(Date date) {
  if(date instanceof DateTime) {
    DateTime dt = (DateTime) date;
    if (dt.getTimeZone()!=null) {
      return dt.getTimeZone().getID();
    }
  }
  
  return null;
}

代码示例来源:origin: PrivacyApps/calendar-import-export

private void copyDateProperty(ContentValues c, String dbName, String dbTzName, DateProperty date) {
  if (dbName != null && date.getDate() != null) {
    c.put(dbName, date.getDate().getTime()); // ms since epoc in GMT
    if (dbTzName != null) {
      if (date.isUtc() || date.getTimeZone() == null)
        c.put(dbTzName, "UTC");
      else
        c.put(dbTzName, date.getTimeZone().getID());
    }
  }
}

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

/**
 * Assert the zone info id is the same as the Java timezone.
 */
public void testGetId() {
  // assertEquals(tz.getID(), timezone.getID());
  assertNotNull(timezone.getID());
  if (expectedTimezoneId != null) {
    assertEquals(expectedTimezoneId, timezone.getID());
  }
}

代码示例来源:origin: net.oneandone.cosmo/cosmo-core

/**
 * Set the timezone to use when converting floating times to
 * UTC.  Only used if isUTC is set to true.
 *
 * @param timezone The timezone.
 */
public void setTimezone(TimeZone timezone) {
  if(timezone != null ){
    this.timezone = TimeZoneRegistryFactory.getInstance().createRegistry().getTimeZone(timezone.getID());
  }
}

代码示例来源:origin: 1and1/cosmo

/**
 * Set the timezone to use when converting floating times to
 * UTC.  Only used if isUTC is set to true.
 *
 * @param timezone The timezone.
 */
public void setTimezone(TimeZone timezone) {
  if(timezone != null ){
    this.timezone = TimeZoneRegistryFactory.getInstance().createRegistry().getTimeZone(timezone.getID());
  }
}

代码示例来源:origin: net.oneandone.ical4j/ical4j

private void updateTimeZone(Property property, TimeZone timezone) {
  try {
    ((DateProperty) property).setTimeZone(timezone);
  } catch (ClassCastException e) {
    try {
      ((DateListProperty) property).setTimeZone(timezone);
    } catch (ClassCastException e2) {
      if (CompatibilityHints.isHintEnabled(CompatibilityHints.KEY_RELAXED_PARSING)) {
        Logger log = LoggerFactory.getLogger(CalendarBuilder.class);
        log.warn("Error setting timezone [" + timezone.getID()
            + "] on property [" + property.getName()
            + "]", e);
      } else {
        throw e2;
      }
    }
  }
}

代码示例来源:origin: org.bedework.ical4j/ical4j

private void updateTimeZone(Property property, TimeZone timezone) {
  try {
    ((DateProperty) property).setTimeZone(timezone);
  } catch (ClassCastException e) {
    try {
      ((DateListProperty) property).setTimeZone(timezone);
    } catch (ClassCastException e2) {
      if (CompatibilityHints.isHintEnabled(CompatibilityHints.KEY_RELAXED_PARSING)) {
        Logger log = LoggerFactory.getLogger(CalendarBuilder.class);
        log.warn("Error setting timezone [" + timezone.getID()
            + "] on property [" + property.getName()
            + "]", e);
      } else {
        throw e2;
      }
    }
  }
}

代码示例来源:origin: org.bedework.caleng/bw-calendar-engine-facade

/**
 * @param val
 * @return initialised BwDateTime
 * @throws CalFacadeException
 */
public static BwDateTime makeBwDateTime(final Date val) throws CalFacadeException {
 String tzid = null;
 boolean dateType = true;
 if (val instanceof DateTime) {
  dateType = false;
  TimeZone tz = ((DateTime)val).getTimeZone();
  if (tz != null) {
   tzid = tz.getID();
  }
 }
 return makeBwDateTime(dateType, val.toString(), tzid);
}

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

public String getName() {
  if (timezone != null) {
    return super.getName() + " [" + timezone.getID() + "]";
  }
  return super.getName();
}

代码示例来源:origin: net.oneandone.cosmo/cosmo-core

/**
 * Constructs an <code>ICalDate</code> from an iCalendar date
 * list. Date lists cannot be anytime.
 * @param dates The date list.
 * @throws UnknownTimeZoneException - if something is wrong this exception is thrown.
 */
public ICalDate(DateList dates) throws UnknownTimeZoneException {
  value = dates.getType();
  tz = dates.getTimeZone();
  if (tz != null) {
    String origId = tz.getID();
    tz = tzTranslator.translateToOlsonTz(tz);
    if (tz == null) {
      throw new UnknownTimeZoneException(origId);
    }
    String id = tz.getVTimeZone().getProperties().
      getProperty(Property.TZID).getValue();
    tzid = new TzId(id);
  }
  text = dates.toString();
  this.dates = dates;
}

相关文章