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 aTraversal
.- Author:
- Marko A. Rodriguez (http://markorodriguez.com), Stephen Mallette (http://stephen.genoprime.com)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field 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 Description Parameters()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method 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 theSupplier
.<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 areTraversal
objects.<S> Object[]
getKeyValues(Traverser.Admin<S> traverser, Object... exceptKeys)
Gets the array of keys/values of the parameters while resolving parameter values that containTraversal
instances.Map<Object,List<Object>>
getRaw(Object... exceptKeys)
Gets an immutable set of the parameters without evaluating them in the context of aTraverser
as is done ingetKeyValues(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 theTraversal.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()
-
-
-
Field Detail
-
EMPTY
public static final Parameters EMPTY
-
traversals
protected List<Traversal.Admin<?,?>> traversals
A cached list of traversals that serve as parameter values. The list is cached on calls toset(TraversalParent, Object...)
because when the parameter map is large the cost of iterating it repeatedly on the high number of calls togetTraversals()
is great.
-
-
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 andfalse
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 checkvalue
- the value to check- Returns:
true
if the key and value are present andfalse
otherwise
-
rename
public void rename(Object oldKey, Object newKey)
Renames a key in the parameter set.- Parameters:
oldKey
- the key to renamenewKey
- 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 areTraversal
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 theSupplier
.- Parameters:
key
- the key to retrievedefaultValue
- 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 containTraversal
instances.
-
getRaw
public Map<Object,List<Object>> getRaw(Object... exceptKeys)
Gets an immutable set of the parameters without evaluating them in the context of aTraverser
as is done ingetKeyValues(Traverser.Admin, Object...)
.- Parameters:
exceptKeys
- keys to not include in the returnedMap
-
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 theTraversal.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()
-
-