java.util.TimeZone.clone()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(9.0k)|赞(0)|评价(0)|浏览(124)

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

TimeZone.clone介绍

[英]Creates a copy of this TimeZone.
[中]创建此TimeZone的副本。

代码示例

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

/**
 * Returns a new {@code SimpleTimeZone} with the same ID, {@code rawOffset} and daylight
 * savings time rules as this SimpleTimeZone.
 *
 * @return a shallow copy of this {@code SimpleTimeZone}.
 * @see java.lang.Cloneable
 */
@Override
public Object clone() {
  SimpleTimeZone zone = (SimpleTimeZone) super.clone();
  return zone;
}

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

/**
 * Overrides the default time zone for the current process only.
 *
 * <p><strong>Warning</strong>: avoid using this method to use a custom time
 * zone in your process. This value may be cleared or overwritten at any
 * time, which can cause unexpected behavior. Instead, manually supply a
 * custom time zone as needed.
 *
 * @param timeZone a custom time zone, or {@code null} to set the default to
 *     the user's preferred value.
 */
public static synchronized void setDefault(TimeZone timeZone) {
  defaultTimeZone = timeZone != null ? (TimeZone) timeZone.clone() : null;
}

代码示例来源:origin: opentripplanner/OpenTripPlanner

public LocalizedServiceId(FeedScopedId serviceId, TimeZone timeZone) {
  if (serviceId == null)
    throw new IllegalArgumentException("serviceId cannot be null");
  if (timeZone == null)
    throw new IllegalArgumentException("timeZone cannot be null");
  this.id = serviceId;
  this.timeZone = (TimeZone) timeZone.clone();
}

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

/**
 * Returns a shallow copy of this {@code Calendar} with the same properties.
 */
@Override
public Object clone() {
  try {
    Calendar clone = (Calendar) super.clone();
    clone.fields = fields.clone();
    clone.isSet = isSet.clone();
    clone.zone = (TimeZone) zone.clone();
    return clone;
  } catch (CloneNotSupportedException e) {
    throw new AssertionError(e);
  }
}

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

return (TimeZone) GMT.clone();
    return (TimeZone) UTC.clone();
return (zone != null) ? zone : (TimeZone) GMT.clone();

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

/**
 * Constructs a new {@code CronExpression} as a copy of an existing
 * instance.
 * 
 * @param expression
 *            The existing cron expression to be copied
 */
public CronExpression(CronExpression expression) {
  /*
   * We don't call the other constructor here since we need to swallow the
   * ParseException. We also elide some of the sanity checking as it is
   * not logically trippable.
   */
  this.cronExpression = expression.getCronExpression();
  try {
    buildExpression(cronExpression);
  } catch (ParseException ex) {
    throw new AssertionError();
  }
  if (expression.getTimeZone() != null) {
    setTimeZone((TimeZone) expression.getTimeZone().clone());
  }
}

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

/**
 * Constructs a new {@code CronExpression} as a copy of an existing
 * instance.
 * 
 * @param expression
 *            The existing cron expression to be copied
 */
public CronExpression(CronExpression expression) {
  /*
   * We don't call the other constructor here since we need to swallow the
   * ParseException. We also elide some of the sanity checking as it is
   * not logically trippable.
   */
  this.cronExpression = expression.getCronExpression();
  try {
    buildExpression(cronExpression);
  } catch (ParseException ex) {
    throw new AssertionError();
  }
  if (expression.getTimeZone() != null) {
    setTimeZone((TimeZone) expression.getTimeZone().clone());
  }
}

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

return (TimeZone) defaultTimeZone.clone();

代码示例来源:origin: pentaho/pentaho-kettle

@Override
public ValueMetaBase clone() {
 try {
  ValueMetaBase valueMeta = (ValueMetaBase) super.clone();
  valueMeta.dateFormat = null;
  valueMeta.decimalFormat = null;
  if ( dateFormatLocale != null ) {
   valueMeta.dateFormatLocale = (Locale) dateFormatLocale.clone();
  }
  if ( dateFormatTimeZone != null ) {
   valueMeta.dateFormatTimeZone = (TimeZone) dateFormatTimeZone.clone();
  }
  if ( storageMetadata != null ) {
   valueMeta.storageMetadata = storageMetadata.clone();
  }
  if ( conversionMetadata != null ) {
   valueMeta.conversionMetadata = conversionMetadata.clone();
  }
  valueMeta.compareStorageAndActualFormat();
  return valueMeta;
 } catch ( CloneNotSupportedException e ) {
  return null;
 }
}

代码示例来源:origin: lets-blade/blade

/**
 * Constructs a new {@code CronExpression} as a copy of an existing
 * instance.
 *
 * @param expression The existing cron expression to be copied
 */
public CronExpression(CronExpression expression) {
  /*
   * We don't call the other constructor here since we need to swallow the
   * ParseException. We also elide some of the sanity checking as it is
   * not logically trippable.
   */
  this.cronExpression = expression.getCronExpression();
  try {
    buildExpression(cronExpression);
  } catch (ParseException ex) {
    throw new AssertionError();
  }
  if (expression.getTimeZone() != null) {
    setTimeZone((TimeZone) expression.getTimeZone().clone());
  }
}

代码示例来源:origin: lets-blade/blade

/**
 * Constructs a new {@code CronExpression} as a copy of an existing
 * instance.
 *
 * @param expression The existing cron expression to be copied
 */
public CronExpression(CronExpression expression) {
  /*
   * We don't call the other constructor here since we need to swallow the
   * ParseException. We also elide some of the sanity checking as it is
   * not logically trippable.
   */
  this.cronExpression = expression.getCronExpression();
  try {
    buildExpression(cronExpression);
  } catch (ParseException ex) {
    throw new AssertionError();
  }
  if (expression.getTimeZone() != null) {
    setTimeZone((TimeZone) expression.getTimeZone().clone());
  }
}

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

return (T) ((TimeZone) source).clone();

代码示例来源:origin: quartz-scheduler/quartz

@Override
public Object clone()  {
  try {
    BaseCalendar clone = (BaseCalendar) super.clone();
    if (getBaseCalendar() != null) {
      clone.baseCalendar = (Calendar) getBaseCalendar().clone();
    }
    if(getTimeZone() != null)
      clone.timeZone = (TimeZone) getTimeZone().clone();
    return clone;
  } catch (CloneNotSupportedException ex) {
    throw new IncompatibleClassChangeError("Not Cloneable.");
  }
}

代码示例来源:origin: quartz-scheduler/quartz

@Override
public Object clone()  {
  try {
    BaseCalendar clone = (BaseCalendar) super.clone();
    if (getBaseCalendar() != null) {
      clone.baseCalendar = (Calendar) getBaseCalendar().clone();
    }
    if(getTimeZone() != null)
      clone.timeZone = (TimeZone) getTimeZone().clone();
    return clone;
  } catch (CloneNotSupportedException ex) {
    throw new IncompatibleClassChangeError("Not Cloneable.");
  }
}

代码示例来源:origin: quartz-scheduler/quartz

/**
 * Constructs a new {@code CronExpression} as a copy of an existing
 * instance.
 * 
 * @param expression
 *            The existing cron expression to be copied
 */
public CronExpression(CronExpression expression) {
  /*
   * We don't call the other constructor here since we need to swallow the
   * ParseException. We also elide some of the sanity checking as it is
   * not logically trippable.
   */
  this.cronExpression = expression.getCronExpression();
  try {
    buildExpression(cronExpression);
  } catch (ParseException ex) {
    throw new AssertionError();
  }
  if (expression.getTimeZone() != null) {
    setTimeZone((TimeZone) expression.getTimeZone().clone());
  }
}

代码示例来源:origin: ltsopensource/light-task-scheduler

/**
 * Constructs a new {@code CronExpression} as a copy of an existing
 * instance.
 *
 * @param expression
 *            The existing cron expression to be copied
 */
public CronExpression(CronExpression expression) {
  /*
   * We don't call the other constructor here since we need to swallow the
   * ParseException. We also elide some of the sanity checking as it is
   * not logically trippable.
   */
  this.cronExpression = expression.getCronExpression();
  try {
    buildExpression(cronExpression);
  } catch (ParseException ex) {
    throw new AssertionError();
  }
  if (expression.getTimeZone() != null) {
    setTimeZone((TimeZone) expression.getTimeZone().clone());
  }
}

代码示例来源:origin: ltsopensource/light-task-scheduler

/**
 * Constructs a new {@code CronExpression} as a copy of an existing
 * instance.
 *
 * @param expression
 *            The existing cron expression to be copied
 */
public CronExpression(CronExpression expression) {
  /*
   * We don't call the other constructor here since we need to swallow the
   * ParseException. We also elide some of the sanity checking as it is
   * not logically trippable.
   */
  this.cronExpression = expression.getCronExpression();
  try {
    buildExpression(cronExpression);
  } catch (ParseException ex) {
    throw new AssertionError();
  }
  if (expression.getTimeZone() != null) {
    setTimeZone((TimeZone) expression.getTimeZone().clone());
  }
}

代码示例来源:origin: quartz-scheduler/quartz

/**
 * Constructs a new {@code CronExpression} as a copy of an existing
 * instance.
 * 
 * @param expression
 *            The existing cron expression to be copied
 */
public CronExpression(CronExpression expression) {
  /*
   * We don't call the other constructor here since we need to swallow the
   * ParseException. We also elide some of the sanity checking as it is
   * not logically trippable.
   */
  this.cronExpression = expression.getCronExpression();
  try {
    buildExpression(cronExpression);
  } catch (ParseException ex) {
    throw new AssertionError();
  }
  if (expression.getTimeZone() != null) {
    setTimeZone((TimeZone) expression.getTimeZone().clone());
  }
}

代码示例来源:origin: aol/cyclops

/**
 * Constructs a new {@code CronExpression} as a copy of an existing
 * instance.
 *
 * @param expression
 *            The existing cron expression to be copied
 */
public CronExpression(final CronExpression expression) {
  /*
   * We don't call the other constructor here since we need to swallow the
   * ParseException. We also elide some of the sanity checking as it is
   * not logically trippable.
   */
  cronExpression = expression.getCronExpression();
  try {
    buildExpression(cronExpression);
  } catch (final ParseException ex) {
    throw new AssertionError();
  }
  if (expression.getTimeZone() != null) {
    setTimeZone((TimeZone) expression.getTimeZone()
                     .clone());
  }
}

代码示例来源:origin: kostaskougios/cloning

public Object clone(final Object t, final IDeepCloner cloner, final Map<Object, Object> clones) {
    final GregorianCalendar gc = new GregorianCalendar();
    Calendar c = (Calendar) t;
    gc.setTimeInMillis(c.getTimeInMillis());
    gc.setTimeZone((TimeZone) c.getTimeZone().clone());
    return gc;
  }
}

相关文章