/** * Get this object as a MutableDateTime using ISOChronology in the default zone. * This method is identical to <code>toMutableDateTime()</code>. * <p> * This method returns a MutableDateTime object in the default zone. * This differs from the similarly named method on DateTime, DateMidnight * or MutableDateTime which retains the time zone. The difference is * because Instant really represents a time <i>without</i> a zone, * thus calling this method we really have no zone to 'retain' and * hence expect to switch to the default zone. * <p> * This method is deprecated because it is a duplicate of {@link #toMutableDateTime()}. * However, removing it would cause the superclass implementation to be used, * which would create silent bugs in any caller depending on this implementation. * As such, the method itself is not currently planned to be removed. * <p> * This method definition preserves compatibility with earlier versions * of Joda-Time. * * @return a MutableDateTime using the same millis with ISOChronology * @deprecated Use toMutableDateTime() as it is identical */ @Deprecated public MutableDateTime toMutableDateTimeISO() { return toMutableDateTime(); }
/** * Get this object as a MutableDateTime using ISOChronology in the default zone. * This method is identical to <code>toMutableDateTime()</code>. * <p> * This method returns a MutableDateTime object in the default zone. * This differs from the similarly named method on DateTime, DateMidnight * or MutableDateTime which retains the time zone. The difference is * because Instant really represents a time <i>without</i> a zone, * thus calling this method we really have no zone to 'retain' and * hence expect to switch to the default zone. * <p> * This method is deprecated because it is a duplicate of {@link #toMutableDateTime()}. * However, removing it would cause the superclass implementation to be used, * which would create silent bugs in any caller depending on this implementation. * As such, the method itself is not currently planned to be removed. * <p> * This method definition preserves compatibility with earlier versions * of Joda-Time. * * @return a MutableDateTime using the same millis with ISOChronology * @deprecated Use toMutableDateTime() as it is identical */ @Deprecated public MutableDateTime toMutableDateTimeISO() { return toMutableDateTime(); }
@Override public GroundedTime setTimeZone(DateTimeZone tz) { MutableDateTime tzBase = base.toInstant().toMutableDateTime(); tzBase.setZone(tz); // TODO: setZoneRetainFields? return new GroundedTime(this, tzBase); }
/** * Get this object as a MutableDateTime using ISOChronology in the default zone. * This method is identical to <code>toMutableDateTime()</code>. * <p> * This method returns a MutableDateTime object in the default zone. * This differs from the similarly named method on DateTime, DateMidnight * or MutableDateTime which retains the time zone. The difference is * because Instant really represents a time <i>without</i> a zone, * thus calling this method we really have no zone to 'retain' and * hence expect to switch to the default zone. * <p> * This method is deprecated because it is a duplicate of {@link #toMutableDateTime()}. * However, removing it would cause the superclass implementation to be used, * which would create silent bugs in any caller depending on this implementation. * As such, the method itself is not currently planned to be removed. * <p> * This method definition preserves compatibility with earlier versions * of Joda-Time. * * @return a MutableDateTime using the same millis with ISOChronology * @deprecated Use toMutableDateTime() as it is identical */ @Deprecated public MutableDateTime toMutableDateTimeISO() { return toMutableDateTime(); }
/** * Get this object as a MutableDateTime using ISOChronology in the default zone. * This method is identical to <code>toMutableDateTime()</code>. * <p> * This method returns a MutableDateTime object in the default zone. * This differs from the similarly named method on DateTime, DateMidnight * or MutableDateTime which retains the time zone. The difference is * because Instant really represents a time <i>without</i> a zone, * thus calling this method we really have no zone to 'retain' and * hence expect to switch to the default zone. * <p> * This method definition preserves compatability with earlier versions * of Joda-Time. * * @return a MutableDateTime using the same millis with ISOChronology * @deprecated Use toMutableDateTime() as it is identical */ public MutableDateTime toMutableDateTimeISO() { return toMutableDateTime(); }
/** * Get this object as a MutableDateTime using ISOChronology in the default zone. * This method is identical to <code>toMutableDateTime()</code>. * <p> * This method returns a MutableDateTime object in the default zone. * This differs from the similarly named method on DateTime, DateMidnight * or MutableDateTime which retains the time zone. The difference is * because Instant really represents a time <i>without</i> a zone, * thus calling this method we really have no zone to 'retain' and * hence expect to switch to the default zone. * <p> * This method is deprecated because it is a duplicate of {@link #toMutableDateTime()}. * However, removing it would cause the superclass implementation to be used, * which would create silent bugs in any caller depending on this implementation. * As such, the method itself is not currently planned to be removed. * <p> * This method definition preserves compatibility with earlier versions * of Joda-Time. * * @return a MutableDateTime using the same millis with ISOChronology * @deprecated Use toMutableDateTime() as it is identical */ @Deprecated public MutableDateTime toMutableDateTimeISO() { return toMutableDateTime(); }
/** * Get this object as a MutableDateTime using ISOChronology in the default zone. * This method is identical to <code>toMutableDateTime()</code>. * <p> * This method returns a MutableDateTime object in the default zone. * This differs from the similarly named method on DateTime, DateMidnight * or MutableDateTime which retains the time zone. The difference is * because Instant really represents a time <i>without</i> a zone, * thus calling this method we really have no zone to 'retain' and * hence expect to switch to the default zone. * <p> * This method is deprecated because it is a duplicate of {@link #toMutableDateTime()}. * However, removing it would cause the superclass implementation to be used, * which would create silent bugs in any caller depending on this implementation. * As such, the method itself is not currently planned to be removed. * <p> * This method definition preserves compatibility with earlier versions * of Joda-Time. * * @return a MutableDateTime using the same millis with ISOChronology * @deprecated Use toMutableDateTime() as it is identical */ @Deprecated public MutableDateTime toMutableDateTimeISO() { return toMutableDateTime(); }
/** * Get this object as a MutableDateTime using ISOChronology in the default zone. * This method is identical to <code>toMutableDateTime()</code>. * <p> * This method returns a MutableDateTime object in the default zone. * This differs from the similarly named method on DateTime, DateMidnight * or MutableDateTime which retains the time zone. The difference is * because Instant really represents a time <i>without</i> a zone, * thus calling this method we really have no zone to 'retain' and * hence expect to switch to the default zone. * <p> * This method is deprecated because it is a duplicate of {@link #toMutableDateTime()}. * However, removing it would cause the superclass implementation to be used, * which would create silent bugs in any caller depending on this implementation. * As such, the method itself is not currently planned to be removed. * <p> * This method definition preserves compatibility with earlier versions * of Joda-Time. * * @return a MutableDateTime using the same millis with ISOChronology * @deprecated Use toMutableDateTime() as it is identical */ @Deprecated public MutableDateTime toMutableDateTimeISO() { return toMutableDateTime(); }
/** * Get this object as a MutableDateTime using ISOChronology in the default zone. * This method is identical to <code>toMutableDateTime()</code>. * <p> * This method returns a MutableDateTime object in the default zone. * This differs from the similarly named method on DateTime, DateMidnight * or MutableDateTime which retains the time zone. The difference is * because Instant really represents a time <i>without</i> a zone, * thus calling this method we really have no zone to 'retain' and * hence expect to switch to the default zone. * <p> * This method is deprecated because it is a duplicate of {@link #toMutableDateTime()}. * However, removing it would cause the superclass implementation to be used, * which would create silent bugs in any caller depending on this implementation. * As such, the method itself is not currently planned to be removed. * <p> * This method definition preserves compatibility with earlier versions * of Joda-Time. * * @return a MutableDateTime using the same millis with ISOChronology * @deprecated Use toMutableDateTime() as it is identical */ @Deprecated public MutableDateTime toMutableDateTimeISO() { return toMutableDateTime(); }
/** * Get this object as a MutableDateTime using ISOChronology in the default zone. * This method is identical to <code>toMutableDateTime()</code>. * <p> * This method returns a MutableDateTime object in the default zone. * This differs from the similarly named method on DateTime, DateMidnight * or MutableDateTime which retains the time zone. The difference is * because Instant really represents a time <i>without</i> a zone, * thus calling this method we really have no zone to 'retain' and * hence expect to switch to the default zone. * <p> * This method is deprecated because it is a duplicate of {@link #toMutableDateTime()}. * However, removing it would cause the superclass implementation to be used, * which would create silent bugs in any caller depending on this implementation. * As such, the method itself is not currently planned to be removed. * <p> * This method definition preserves compatibility with earlier versions * of Joda-Time. * * @return a MutableDateTime using the same millis with ISOChronology * @deprecated Use toMutableDateTime() as it is identical */ @Deprecated public MutableDateTime toMutableDateTimeISO() { return toMutableDateTime(); }
/** * Get this object as a MutableDateTime using ISOChronology in the default zone. * This method is identical to <code>toMutableDateTime()</code>. * <p> * This method returns a MutableDateTime object in the default zone. * This differs from the similarly named method on DateTime, DateMidnight * or MutableDateTime which retains the time zone. The difference is * because Instant really represents a time <i>without</i> a zone, * thus calling this method we really have no zone to 'retain' and * hence expect to switch to the default zone. * <p> * This method is deprecated because it is a duplicate of {@link #toMutableDateTime()}. * However, removing it would cause the superclass implementation to be used, * which would create silent bugs in any caller depending on this implementation. * As such, the method itself is not currently planned to be removed. * <p> * This method definition preserves compatibility with earlier versions * of Joda-Time. * * @return a MutableDateTime using the same millis with ISOChronology * @deprecated Use toMutableDateTime() as it is identical */ @Deprecated public MutableDateTime toMutableDateTimeISO() { return toMutableDateTime(); }
/** * Get this object as a MutableDateTime using ISOChronology in the default zone. * This method is identical to <code>toMutableDateTime()</code>. * <p> * This method returns a MutableDateTime object in the default zone. * This differs from the similarly named method on DateTime, DateMidnight * or MutableDateTime which retains the time zone. The difference is * because Instant really represents a time <i>without</i> a zone, * thus calling this method we really have no zone to 'retain' and * hence expect to switch to the default zone. * <p> * This method is deprecated because it is a duplicate of {@link #toMutableDateTime()}. * However, removing it would cause the superclass implementation to be used, * which would create silent bugs in any caller depending on this implementation. * As such, the method itself is not currently planned to be removed. * <p> * This method definition preserves compatibility with earlier versions * of Joda-Time. * * @return a MutableDateTime using the same millis with ISOChronology * @deprecated Use toMutableDateTime() as it is identical */ @Deprecated public MutableDateTime toMutableDateTimeISO() { return toMutableDateTime(); }
@Override public GroundedTime setTimeZone(DateTimeZone tz) { MutableDateTime tzBase = base.toInstant().toMutableDateTime(); tzBase.setZone(tz); // TODO: setZoneRetainFields? return new GroundedTime(this, tzBase); }
public GroundedTime setTimeZone(DateTimeZone tz) { MutableDateTime tzBase = base.toInstant().toMutableDateTime(); tzBase.setZone(tz); // TODO: setZoneRetainFields? return new GroundedTime(this, tzBase); }
MutableDateTime mutableNow = Instant.now().toMutableDateTime(); mutableNow.setMillisOfSecond(0); Instant now = mutableNow.toInstant();
@Test @Category(ValidatesRunner.class) public void testSideInputsWithMultipleWindows() { // Tests that the runner can safely run a DoFn that uses side inputs // on an input where the element is in multiple windows. The complication is // that side inputs are per-window, so the runner has to make sure // to process each window individually. MutableDateTime mutableNow = Instant.now().toMutableDateTime(); mutableNow.setMillisOfSecond(0); Instant now = mutableNow.toInstant(); SlidingWindows windowFn = SlidingWindows.of(Duration.standardSeconds(5)).every(Duration.standardSeconds(1)); PCollectionView<Integer> view = pipeline.apply(Create.of(1)).apply(View.asSingleton()); PCollection<String> res = pipeline .apply(Create.timestamped(TimestampedValue.of("a", now))) .apply(Window.into(windowFn)) .apply(ParDo.of(new FnWithSideInputs(view)).withSideInputs(view)); for (int i = 0; i < 4; ++i) { Instant base = now.minus(Duration.standardSeconds(i)); IntervalWindow window = new IntervalWindow(base, base.plus(Duration.standardSeconds(5))); PAssert.that(res).inWindow(window).containsInAnyOrder("a:1"); } pipeline.run(); }