org.apache.tinkerpop.gremlin.process.traversal.step.util

## Class Parameters

- java.lang.Object
- - org.apache.tinkerpop.gremlin.process.traversal.step.util.Parameters

- All Implemented Interfaces:
    Serializable, Cloneable

      public class Parameters
      extends Object
      implements Cloneable, Serializable

  The parameters held by a `Traversal`.
  Author:
    Marko A. Rodriguez (http://markorodriguez.com), Stephen Mallette (http://stephen.genoprime.com)
  See Also:
    Serialized Form

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static Parameters` | `EMPTY`
    `protected Map<Object,List<Object>>` | `parameters`
    `protected Set<String>` | `referencedLabels`
    `protected List<Traversal.Admin<?,?>>` | `traversals` A cached list of traversals that serve as parameter values.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `Parameters()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `Parameters` | `clone()`
    `boolean` | `contains(Object key)` Checks for existence of key in parameter set.
    `boolean` | `contains(Object key, Object value)` Checks for existence of a key and value in a parameter set.
    `<E> List<E>` | `get(Object key, Supplier<E> defaultValue)` Gets the value of a key and if that key isn't present returns the default value from the `Supplier`.
    `<S,E> List<E>` | `get(Traverser.Admin<S> traverser, Object key, Supplier<E> defaultValue)` Gets the list of values for a key, while resolving the values of any parameters that are `Traversal` objects.
    `<S> Object[]` | `getKeyValues(Traverser.Admin<S> traverser, Object... exceptKeys)` Gets the array of keys/values of the parameters while resolving parameter values that contain `Traversal` instances.
    `Map<Object,List<Object>>` | `getRaw(Object... exceptKeys)` Gets an immutable set of the parameters without evaluating them in the context of a `Traverser` as is done in `getKeyValues(Traverser.Admin, Object...)`.
    `Set<String>` | `getReferencedLabels()` Gets a list of all labels held in parameters that have a traversal as a value.
    `<S,E> List<Traversal.Admin<S,E>>` | `getTraversals()` Gets all the `Traversal.Admin` objects in the map of parameters.
    `int` | `hashCode()`
    `Object` | `remove(Object key)` Remove a key from the parameter set.
    `void` | `rename(Object oldKey, Object newKey)` Renames a key in the parameter set.
    `void` | `set(TraversalParent parent, Object... keyValues)` Set parameters given key/value pairs.
    `String` | `toString()`

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

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

- - ### Field Detail

    - #### EMPTY

          public static final Parameters EMPTY

    - #### parameters

          protected Map<Object,List<Object>> parameters

    - #### referencedLabels

          protected Set<String> referencedLabels

    - #### traversals

          protected List<Traversal.Admin<?,?>> traversals

      A cached list of traversals that serve as parameter values. The list is cached on calls to `set(TraversalParent, Object...)` because when the parameter map is large the cost of iterating it repeatedly on the high number of calls to `getTraversals()` is great.

  - ### Constructor Detail

    - #### Parameters

          public Parameters()

  - ### Method Detail

    - #### contains

          public boolean contains(Object key)

      Checks for existence of key in parameter set.
      Parameters:
        `key` - the key to check
      Returns:
        `true` if the key is present and `false` otherwise

    - #### contains

          public boolean contains(Object key,
                                  Object value)

      Checks for existence of a key and value in a parameter set.
      Parameters:
        `key` - the key to check
        `value` - the value to check
      Returns:
        `true` if the key and value are present and `false` otherwise

    - #### rename

          public void rename(Object oldKey,
                             Object newKey)

      Renames a key in the parameter set.
      Parameters:
        `oldKey` - the key to rename
        `newKey` - the new name of the key

    - #### get

          public <S,E> List<E> get(Traverser.Admin<S> traverser,
                                   Object key,
                                   Supplier<E> defaultValue)

      Gets the list of values for a key, while resolving the values of any parameters that are `Traversal` objects.

    - #### get

          public <E> List<E> get(Object key,
                                 Supplier<E> defaultValue)

      Gets the value of a key and if that key isn't present returns the default value from the `Supplier`.
      Parameters:
        `key` - the key to retrieve
        `defaultValue` - the default value generator which if null will return an empty list

    - #### remove

          public Object remove(Object key)

      Remove a key from the parameter set.
      Parameters:
        `key` - the key to remove
      Returns:
        the value of the removed key

    - #### getKeyValues

          public <S> Object[] getKeyValues(Traverser.Admin<S> traverser,
                                           Object... exceptKeys)

      Gets the array of keys/values of the parameters while resolving parameter values that contain `Traversal` instances.

    - #### getRaw

          public Map<Object,List<Object>> getRaw(Object... exceptKeys)

      Gets an immutable set of the parameters without evaluating them in the context of a `Traverser` as is done in `getKeyValues(Traverser.Admin, Object...)`.
      Parameters:
        `exceptKeys` - keys to not include in the returned `Map`

    - #### set

          public void set(TraversalParent parent,
                          Object... keyValues)

      Set parameters given key/value pairs.

    - #### getTraversals

          public <S,E> List<Traversal.Admin<S,E>> getTraversals()

      Gets all the `Traversal.Admin` objects in the map of parameters.

    - #### getReferencedLabels

          public Set<String> getReferencedLabels()

      Gets a list of all labels held in parameters that have a traversal as a value.

    - #### clone

          public Parameters clone()

      Overrides:
        `clone` in class `Object`

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `Object`

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

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