com.google.cloud.dataflow.sdk.transforms.windowing

## Class Window.Bound<T>

- java.lang.Object
- - com.google.cloud.dataflow.sdk.transforms.PTransform<PCollection<T>,PCollection<T>>
  - - com.google.cloud.dataflow.sdk.transforms.windowing.Window.Bound<T>

Type Parameters:
  `T` - The type of elements this `Window` is applied to

All Implemented Interfaces:
  HasDisplayData, Serializable

Enclosing class:
  Window

    public static class Window.Bound<T>
    extends PTransform<PCollection<T>,PCollection<T>>

A `PTransform` that windows the elements of a `PCollection<T>`, into finite windows according to a user-specified `WindowFn`.

See Also:
  Serialized Form

### Field Summary

### Fields inherited from class com.google.cloud.dataflow.sdk.transforms.PTransform

`name`

### Method Summary

All Methods Instance Methods Concrete Methods
`Window.Bound<T>` `accumulatingFiredPanes()` Returns a new `Window` `PTransform` that uses the registered WindowFn and Triggering behavior, and that accumulates elements in a pane after they are triggered.
`PCollection<T>` `apply(PCollection<T> input)` Applies this `PTransform` on the given `InputT`, and returns its `Output`.
`Window.Bound<T>` `discardingFiredPanes()` Returns a new `Window` `PTransform` that uses the registered WindowFn and Triggering behavior, and that discards elements in a pane after they are triggered.
`protected Coder<?>` `getDefaultOutputCoder(PCollection<T> input)` Returns the default `Coder` to use for the output of this single-output `PTransform` when applied to the given input.
`protected String` `getKindString()` Returns the name to use by default for this `PTransform` (not including the names of any enclosing `PTransform`s).
`com.google.cloud.dataflow.sdk.util.WindowingStrategy<?,?>` `getOutputStrategyInternal(com.google.cloud.dataflow.sdk.util.WindowingStrategy<?,?> inputStrategy)` Get the output strategy of this `Window PTransform`.
`WindowFn<? super T,?>` `getWindowFn()` Get the `WindowFn` of this `Window PTransform`.
`Window.Bound<T>` `named(String name)` Returns a new `Window` `PTransform` that's like this `PTransform` but with the specified name.
`void` `populateDisplayData(DisplayData.Builder builder)` Register display data for the given transform or component.
`Window.Bound<T>` `triggering(TriggerBuilder<?> trigger)` Sets a non-default trigger for this `Window` `PTransform`.
`void` `validate(PCollection<T> input)` Called before invoking apply (which may be intercepted by the runner) to verify this transform is fully specified and applicable to the specified input.
`Window.Bound<T>` `withAllowedLateness(Duration allowedLateness)` Override the amount of lateness allowed for data elements in the pipeline.
`Window.Bound<T>` `withAllowedLateness(Duration allowedLateness, Window.ClosingBehavior behavior)` Override the amount of lateness allowed for data elements in the pipeline.
`Window.Bound<T>` `withOutputTimeFn(OutputTimeFn<?> outputTimeFn)` (Experimental) Override the default `OutputTimeFn`, to control the output timestamp of values output from a `GroupByKey` operation.

### Methods inherited from class com.google.cloud.dataflow.sdk.transforms.PTransform

`getDefaultOutputCoder, getDefaultOutputCoder, getName, toString`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

### Method Detail

#### named

    public Window.Bound<T> named(String name)

Returns a new `Window` `PTransform` that's like this `PTransform` but with the specified name. Does not modify this `PTransform`.

See the discussion of Naming in `ParDo` for more explanation.

#### triggering

    @Experimental(value=TRIGGER)
    public Window.Bound<T> triggering(TriggerBuilder<?> trigger)

Sets a non-default trigger for this `Window` `PTransform`. Elements that are assigned to a specific window will be output when the trigger fires.

`Trigger` has more details on the available triggers.

Must also specify allowed lateness using `withAllowedLateness(org.joda.time.Duration)` and accumulation mode using either `discardingFiredPanes()` or `accumulatingFiredPanes()`.

#### discardingFiredPanes

    @Experimental(value=TRIGGER)
    public Window.Bound<T> discardingFiredPanes()

Returns a new `Window` `PTransform` that uses the registered WindowFn and Triggering behavior, and that discards elements in a pane after they are triggered.

Does not modify this transform. The resulting `PTransform` is sufficiently specified to be applied, but more properties can still be specified.

#### accumulatingFiredPanes

    @Experimental(value=TRIGGER)
    public Window.Bound<T> accumulatingFiredPanes()

Returns a new `Window` `PTransform` that uses the registered WindowFn and Triggering behavior, and that accumulates elements in a pane after they are triggered.

Does not modify this transform. The resulting `PTransform` is sufficiently specified to be applied, but more properties can still be specified.

#### withAllowedLateness

    @Experimental(value=TRIGGER)
    public Window.Bound<T> withAllowedLateness(Duration allowedLateness)

Override the amount of lateness allowed for data elements in the pipeline. Like the other properties on this `Window` operation, this will be applied at the next `GroupByKey`. Any elements that are later than this as decided by the system-maintained watermark will be dropped.

This value also determines how long state will be kept around for old windows. Once no elements will be added to a window (because this duration has passed) any state associated with the window will be cleaned up.

Depending on the trigger this may not produce a pane with `PaneInfo.isLast`. See `Window.ClosingBehavior.FIRE_IF_NON_EMPTY` for more details.

#### withOutputTimeFn

    @Experimental(value=OUTPUT_TIME)
    public Window.Bound<T> withOutputTimeFn(OutputTimeFn<?> outputTimeFn)

(Experimental) Override the default `OutputTimeFn`, to control the output timestamp of values output from a `GroupByKey` operation.

#### withAllowedLateness

    @Experimental(value=TRIGGER)
    public Window.Bound<T> withAllowedLateness(Duration allowedLateness,
                                                                            Window.ClosingBehavior behavior)

Override the amount of lateness allowed for data elements in the pipeline. Like the other properties on this `Window` operation, this will be applied at the next `GroupByKey`. Any elements that are later than this as decided by the system-maintained watermark will be dropped.

This value also determines how long state will be kept around for old windows. Once no elements will be added to a window (because this duration has passed) any state associated with the window will be cleaned up.

#### getOutputStrategyInternal

    public com.google.cloud.dataflow.sdk.util.WindowingStrategy<?,?> getOutputStrategyInternal(com.google.cloud.dataflow.sdk.util.WindowingStrategy<?,?> inputStrategy)

Get the output strategy of this `Window PTransform`. For internal use only.

#### getWindowFn

    public WindowFn<? super T,?> getWindowFn()

Get the `WindowFn` of this `Window PTransform`.

#### validate

    public void validate(PCollection<T> input)

Description copied from class: `PTransform`
Called before invoking apply (which may be intercepted by the runner) to verify this transform is fully specified and applicable to the specified input.

By default, does nothing.

Overrides:
  `validate` in class `PTransform<PCollection<T>,PCollection<T>>`

#### apply

    public PCollection<T> apply(PCollection<T> input)

Description copied from class: `PTransform`
Applies this `PTransform` on the given `InputT`, and returns its `Output`.

Composite transforms, which are defined in terms of other transforms, should return the output of one of the composed transforms. Non-composite transforms, which do not apply any transforms internally, should return a new unbound output and register evaluators (via backend-specific registration methods).

The default implementation throws an exception. A derived class must either implement apply, or else each runner must supply a custom implementation via `PipelineRunner.apply(com.google.cloud.dataflow.sdk.transforms.PTransform<InputT, OutputT>, InputT)`.

Overrides:
  `apply` in class `PTransform<PCollection<T>,PCollection<T>>`

#### populateDisplayData

    public void populateDisplayData(DisplayData.Builder builder)

Description copied from class: `PTransform`
Register display data for the given transform or component.

`populateDisplayData(DisplayData.Builder)` is invoked by Pipeline runners to collect display data via `DisplayData.from(HasDisplayData)`. Implementations may call `super.populateDisplayData(builder)` in order to register display data in the current namespace, but should otherwise use `subcomponent.populateDisplayData(builder)` to use the namespace of the subcomponent.

By default, does not register any display data. Implementors may override this method to provide their own display data.

Specified by:
  `populateDisplayData` in interface `HasDisplayData`
Overrides:
  `populateDisplayData` in class `PTransform<PCollection<T>,PCollection<T>>`
Parameters:
  `builder` - The builder to populate with display data.
See Also:
  `HasDisplayData`

#### getDefaultOutputCoder

    protected Coder<?> getDefaultOutputCoder(PCollection<T> input)

Description copied from class: `PTransform`
Returns the default `Coder` to use for the output of this single-output `PTransform` when applied to the given input.

Overrides:
  `getDefaultOutputCoder` in class `PTransform<PCollection<T>,PCollection<T>>`

#### getKindString

    protected String getKindString()

Description copied from class: `PTransform`
Returns the name to use by default for this `PTransform` (not including the names of any enclosing `PTransform`s).

By default, returns the base name of this `PTransform`'s class.

The caller is responsible for ensuring that names of applied `PTransform`s are unique, e.g., by adding a uniquifying suffix when needed.

Overrides:
  `getKindString` in class `PTransform<PCollection<T>,PCollection<T>>`