/** * Provides a configuration to a traversal in the form of a key value pair. The key of the configuration must be * graph provider specific and therefore a configuration could be supplied that is not known to be valid until * execution. This is a handy shortcut for building an {@link OptionsStrategy} manually and then add with * {@link #withStrategies(TraversalStrategy[])}. * * @param key the key of the configuration to apply to a traversal * @param value the value of the configuration to apply to a traversal * @return a new traversal source with the included configuration * @since 3.4.0 */ public default TraversalSource with(final String key, final Object value) { final OptionsStrategy.Builder builder = OptionsStrategy.build(); getStrategies().getStrategy(OptionsStrategy.class) .ifPresent(optionsStrategy -> optionsStrategy.getOptions().forEach(builder::with)); builder.with(key, value); return withStrategies(builder.create()); }
/** * Provides a configuration to a traversal in the form of a key value pair. The key of the configuration must be * graph provider specific and therefore a configuration could be supplied that is not known to be valid until * execution. This is a handy shortcut for building an {@link OptionsStrategy} manually and then add with * {@link #withStrategies(TraversalStrategy[])}. * * @param key the key of the configuration to apply to a traversal * @param value the value of the configuration to apply to a traversal * @return a new traversal source with the included configuration * @since 3.4.0 */ public default TraversalSource with(final String key, final Object value) { final OptionsStrategy.Builder builder = OptionsStrategy.build(); getStrategies().getStrategy(OptionsStrategy.class) .ifPresent(optionsStrategy -> optionsStrategy.getOptions().forEach(builder::with)); builder.with(key, value); return withStrategies(builder.create()); }
public static Builder build() { return new Builder(); }
/** * Adds an key to the configuration with the value of {@code true}. */ public Builder with(final String key) { return with(key, true); }
public static Builder build() { return new Builder(); }
/** * Adds an key to the configuration with the value of {@code true}. */ public Builder with(final String key) { return with(key, true); }