/** * 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; }
/** * 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; }
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(); }
/** * 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); } }
/** * 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()); } }
/** * 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()); } }
return (TimeZone) defaultTimeZone.clone();
@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; } }
/** * 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()); } }
/** * 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()); } }
return (T) ((TimeZone) source).clone();
@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."); } }
@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."); } }
/** * 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()); } }
/** * 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()); } }
/** * 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()); } }
/** * 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()); } }
/** * 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()); } }
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; } }