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

## Class Trigger.OnceTrigger<W extends BoundedWindow>

- java.lang.Object
- - com.google.cloud.dataflow.sdk.transforms.windowing.Trigger<W>
  - - com.google.cloud.dataflow.sdk.transforms.windowing.Trigger.OnceTrigger<W>

Type Parameters:
  `W` - `BoundedWindow` subclass used to represent the windows used by this `AtMostOnceTrigger`

All Implemented Interfaces:
  TriggerBuilder<W>, Serializable

Direct Known Subclasses:
  AfterAll, AfterDelayFromFirstElement, AfterFirst, AfterPane, AfterWatermark.FromEndOfWindow

Enclosing class:
  Trigger<W extends BoundedWindow>

    public abstract static class Trigger.OnceTrigger<W extends BoundedWindow>
    extends Trigger<W>

`Trigger`s that are guaranteed to fire at most once should extend from this, rather than the general `Trigger` class to indicate that behavior.

See Also:
  Serialized Form

### Nested Class Summary

### Nested classes/interfaces inherited from class com.google.cloud.dataflow.sdk.transforms.windowing.Trigger

`Trigger.MergingTriggerInfo<W extends BoundedWindow>, Trigger.OnceTrigger<W extends BoundedWindow>, Trigger.OnElementContext, Trigger.OnMergeContext, Trigger.TriggerContext, Trigger.TriggerInfo<W extends BoundedWindow>`

### Field Summary

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

`subTriggers`

### Constructor Summary

Constructors
`protected` `OnceTrigger(List<Trigger<W>> subTriggers)`

### Method Summary

All Methods Instance Methods Abstract Methods Concrete Methods
`Trigger.OnceTrigger<W>` `getContinuationTrigger()` Return a trigger to use after a `GroupByKey` to preserve the intention of this trigger.
`void` `onFire(Trigger.TriggerContext context)` Adjusts the state of the trigger to be ready for the next pane.
`protected abstract void` `onOnlyFiring(Trigger.TriggerContext context)` Called exactly once by `onFire(com.google.cloud.dataflow.sdk.transforms.windowing.Trigger<W>.TriggerContext)` when the trigger is fired.

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

`buildTrigger, clear, equals, getContinuationTrigger, getWatermarkThatGuaranteesFiring, hashCode, isCompatible, onElement, onMerge, orFinally, prefetchOnElement, prefetchOnFire, prefetchOnMerge, prefetchShouldFire, shouldFire, subTriggers, toString`

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

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

### Constructor Detail

#### OnceTrigger

    protected OnceTrigger(List<Trigger<W>> subTriggers)

### Method Detail

#### getContinuationTrigger

    public final Trigger.OnceTrigger<W> getContinuationTrigger()

Description copied from class: `Trigger`
Return a trigger to use after a `GroupByKey` to preserve the intention of this trigger. Specifically, triggers that are time based and intended to provide speculative results should continue providing speculative results. Triggers that fire once (or multiple times) should continue firing once (or multiple times).

Overrides:
  `getContinuationTrigger` in class `Trigger<W extends BoundedWindow>`

#### onFire

    public final void onFire(Trigger.TriggerContext context)
                      throws Exception

Adjusts the state of the trigger to be ready for the next pane. For example, a `Repeatedly` trigger will reset its inner trigger, since it has fired.

If the trigger is finished, it is the responsibility of the trigger itself to record that fact via the `context`.

Specified by:
  `onFire` in class `Trigger<W extends BoundedWindow>`
Throws:
  `Exception`

#### onOnlyFiring

    protected abstract void onOnlyFiring(Trigger.TriggerContext context)
                                  throws Exception

Called exactly once by `onFire(com.google.cloud.dataflow.sdk.transforms.windowing.Trigger<W>.TriggerContext)` when the trigger is fired. By default, invokes `onFire(com.google.cloud.dataflow.sdk.transforms.windowing.Trigger<W>.TriggerContext)` on all subtriggers for which `Trigger.shouldFire(com.google.cloud.dataflow.sdk.transforms.windowing.Trigger<W>.TriggerContext)` is `true`.

Throws:
  `Exception`