org.apache.tinkerpop.gremlin.process.traversal.strategy.optimization

## Class ProductiveByStrategy

- java.lang.Object
- - org.apache.tinkerpop.gremlin.process.traversal.strategy.AbstractTraversalStrategy<TraversalStrategy.OptimizationStrategy>
  - - org.apache.tinkerpop.gremlin.process.traversal.strategy.optimization.ProductiveByStrategy

- All Implemented Interfaces:
    Serializable, Comparable<Class<? extends TraversalStrategy>>, TraversalStrategy<TraversalStrategy.OptimizationStrategy>, TraversalStrategy.OptimizationStrategy

      public class ProductiveByStrategy
      extends AbstractTraversalStrategy<TraversalStrategy.OptimizationStrategy>
      implements TraversalStrategy.OptimizationStrategy

  Takes an argument of `by()` and wraps it `CoalesceStep` so that the result is either the initial `Traversal` argument or `null`. In this way, the `by()` is always "productive". This strategy is an "optimization" but it is perhaps more of a "decoration", but it should follow `ByModulatorOptimizationStrategy` which features optimizations relevant to this one.
  See Also:
    Serialized Form

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `ProductiveByStrategy.Builder`

    - ### Nested classes/interfaces inherited from interface org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategy

      `TraversalStrategy.DecorationStrategy, TraversalStrategy.FinalizationStrategy, TraversalStrategy.OptimizationStrategy, TraversalStrategy.ProviderOptimizationStrategy, TraversalStrategy.VerificationStrategy`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static String` | `PRODUCTIVE_KEYS`

    - ### Fields inherited from interface org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategy

      `STRATEGY`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `apply(Traversal.Admin<?,?> traversal)`
    `Set<Class<? extends TraversalStrategy.OptimizationStrategy>>` | `applyPrior()` The set of strategies that must be executed before this strategy is executed.
    `static ProductiveByStrategy.Builder` | `build()`
    `static ProductiveByStrategy` | `create(org.apache.commons.configuration2.Configuration configuration)`
    `org.apache.commons.configuration2.Configuration` | `getConfiguration()` Get the configuration representation of this strategy.
    `static ProductiveByStrategy` | `instance()` Gets the standard configuration of this strategy that will apply it for all conditions.

    - ### Methods inherited from class org.apache.tinkerpop.gremlin.process.traversal.strategy.AbstractTraversalStrategy

      `equals, hashCode, toString`

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

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

    - ### Methods inherited from interface org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategy.OptimizationStrategy

      `compareTo, getTraversalCategory`

    - ### Methods inherited from interface org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategy

      `applyPost`

- - ### Field Detail

    - #### PRODUCTIVE_KEYS

          public static final String PRODUCTIVE_KEYS

      See Also:
        Constant Field Values

  - ### Method Detail

    - #### create

          public static ProductiveByStrategy create(org.apache.commons.configuration2.Configuration configuration)

    - #### instance

          public static ProductiveByStrategy instance()

      Gets the standard configuration of this strategy that will apply it for all conditions. It is this version of the strategy that is added as standard. Note that it may be helpful to configure a custom instance using the `build()` method in cases where there is certainty that a `by()` will be productive as it will reduce the complexity of the traversal and perhaps improve the execution of other optimizations.

    - #### applyPrior

          public Set<Class<? extends TraversalStrategy.OptimizationStrategy>> applyPrior()

      Description copied from interface: `TraversalStrategy`
      The set of strategies that must be executed before this strategy is executed. If there are no ordering requirements, the default implementation returns an empty set.
      Specified by:
        `applyPrior` in interface `TraversalStrategy<TraversalStrategy.OptimizationStrategy>`
      Returns:
        the set of strategies that must be executed prior to this one.

    - #### apply

          public void apply(Traversal.Admin<?,?> traversal)

      Specified by:
        `apply` in interface `TraversalStrategy<TraversalStrategy.OptimizationStrategy>`

    - #### getConfiguration

          public org.apache.commons.configuration2.Configuration getConfiguration()

      Description copied from interface: `TraversalStrategy`
      Get the configuration representation of this strategy. This is useful for converting a strategy into a serialized form.
      Specified by:
        `getConfiguration` in interface `TraversalStrategy<TraversalStrategy.OptimizationStrategy>`
      Returns:
        the configuration used to create this strategy

    - #### build

          public static ProductiveByStrategy.Builder build()

Copyright © 2013–2022 Apache Software Foundation. All rights reserved.