Modifier and Type | Method and Description |
---|---|
static boolean |
areEqual(Edge a,
Edge b) |
static boolean |
areEqual(Element a,
Object b)
A standard method for determining if two
Element objects are equal. |
static boolean |
areEqual(Property a,
Object b)
A standard method for determining if two
Property objects are equal. |
static boolean |
areEqual(VertexProperty a,
Object b)
A standard method for determining if two
VertexProperty objects are equal. |
static boolean |
areEqual(VertexProperty a,
VertexProperty b) |
static boolean |
areEqual(Vertex a,
Vertex b) |
static Map<String,Object> |
asMap(Object... keyValues)
Converts a set of key values to a Map.
|
static List<<any>> |
asPairs(Object... keyValues)
Convert a set of key values to a list of Pair objects.
|
static void |
attachProperties(Element element,
Object... propertyKeyValues)
Assign key/value pairs as properties to an
Element . |
static void |
attachProperties(Vertex vertex,
Object... propertyKeyValues)
Assign key/value pairs as properties to an
Vertex . |
static void |
attachProperties(Vertex vertex,
VertexProperty.Cardinality cardinality,
Object... propertyKeyValues)
Assign key/value pairs as properties to a
Vertex . |
static Optional<Object> |
getIdValue(Object... keyValues)
Extracts the value of the
T.id key from the list of arguments. |
static Set<String> |
getKeys(Object... keyValues)
Gets the list of keys from the key values.
|
static Optional<String> |
getLabelValue(Object... keyValues)
Extracts the value of the
T.label key from the list of arguments. |
static Object[] |
getProperties(Element element,
boolean includeId,
boolean includeLabel,
Set<String> propertiesToCopy)
Retrieve the properties associated with a particular element.
|
static int |
hashCode(Element element)
If two
Element instances are equal, then they must have the same hash codes. |
static int |
hashCode(Property property)
If two
Property instances are equal, then they must have the same hash codes. |
static boolean |
haveEqualIds(Element a,
Element b)
Simply tests if the value returned from
Element.id() are equal() . |
static boolean |
idExists(Object id,
Object... providedIds) |
static boolean |
keyExists(String key,
String... providedKeys) |
static void |
legalPropertyKeyValueArray(Object... propertyKeyValues)
|
static Map<String,Property> |
propertyMap(Element element,
String... propertyKeys) |
static Map<String,Object> |
propertyValueMap(Element element,
String... propertyKeys) |
static Optional<Object[]> |
remove(String keyToRemove,
Object... keyValues)
Remove a key from the set of key/value pairs.
|
static Optional<Object[]> |
remove(T accessor,
Object... keyValues)
Removes an accessor from the set of key/value pairs.
|
static Object[] |
replaceKey(Object[] keyValues,
Object oldKey,
Object newKey)
Replaces one key with a different key.
|
static <V> Optional<VertexProperty<V>> |
stageVertexProperty(Vertex vertex,
VertexProperty.Cardinality cardinality,
String key,
V value,
Object... keyValues)
This is a helper method for dealing with vertex property cardinality and typically used in
Vertex.property(org.apache.tinkerpop.gremlin.structure.VertexProperty.Cardinality, String, Object, Object...) . |
static Object[] |
upsert(Object[] keyValues,
Object key,
Object val)
Append a key/value pair to a list of existing key/values.
|
static void |
validateLabel(String label)
Determine whether the
Element label can be legally set. |
static void |
validateMixedElementIds(Class<? extends Element> clazz,
Object... ids)
Determine whether an array of ids are either all elements or ids of elements.
|
static void |
validateProperty(String key,
Object value)
Determines whether the property key/value for the specified thing can be legally set.
|
static Map<String,List<VertexProperty>> |
vertexPropertyMap(Vertex vertex,
String... propertyKeys) |
static Map<String,List> |
vertexPropertyValueMap(Vertex vertex,
String... propertyKeys) |
public static void validateLabel(String label) throws IllegalArgumentException
Element
label can be legally set. This is typically used as a pre-condition check.label
- the element labelIllegalArgumentException
- whether the label is legal and if not, a clear reason exception is providedpublic static void validateMixedElementIds(Class<? extends Element> clazz, Object... ids) throws IllegalArgumentException
clazz
- the class of the element for which the ids will bindids
- the ids that must be either elements or id objects, else
Graph.Exceptions.idArgsMustBeEitherIdOrElement()
is thrown.IllegalArgumentException
public static void validateProperty(String key, Object value) throws IllegalArgumentException
key
- the key of the propertyvalue
- the value of the propertyIllegalArgumentException
- whether the key/value pair is legal and if not, a clear reason exception
message is providedpublic static void legalPropertyKeyValueArray(Object... propertyKeyValues) throws IllegalArgumentException
String
or Element
objects.propertyKeyValues
- a list of key/value pairsIllegalArgumentException
- if something in the pairs is illegalpublic static Optional<Object> getIdValue(Object... keyValues)
T.id
key from the list of arguments.keyValues
- a list of key/value pairsT.id
NullPointerException
- if the value for the T.id
key is null
public static Optional<Object[]> remove(String keyToRemove, Object... keyValues)
keyToRemove
- the key to removekeyValues
- the list to remove the accessor frompublic static Optional<Object[]> remove(T accessor, Object... keyValues)
accessor
- to removekeyValues
- the list to remove the accessor frompublic static Object[] upsert(Object[] keyValues, Object key, Object val)
public static Object[] replaceKey(Object[] keyValues, Object oldKey, Object newKey)
keyValues
- the list of key/values to alteroldKey
- the key to replacenewKey
- the new keypublic static Map<String,Object> asMap(Object... keyValues)
public static List<<any>> asPairs(Object... keyValues)
public static Set<String> getKeys(Object... keyValues)
keyValues
- a list of key/values pairspublic static Optional<String> getLabelValue(Object... keyValues)
T.label
key from the list of arguments.keyValues
- a list of key/value pairsT.label
ClassCastException
- if the value of the label is not a String
NullPointerException
- if the value for the T.label
key is null
public static void attachProperties(Element element, Object... propertyKeyValues)
Element
. If the value of T.id
or
T.label
is in the set of pairs, then they are ignored.element
- the graph element to assign the propertyKeyValues
propertyKeyValues
- the key/value pairs to assign to the element
ClassCastException
- if the value of the key is not a String
IllegalArgumentException
- if the value of element
is nullpublic static void attachProperties(Vertex vertex, Object... propertyKeyValues)
Vertex
. If the value of T.id
or
T.label
is in the set of pairs, then they are ignored.
The VertexProperty.Cardinality
of the key is determined from the Graph.Features.VertexFeatures
.vertex
- the graph vertex to assign the propertyKeyValues
propertyKeyValues
- the key/value pairs to assign to the element
ClassCastException
- if the value of the key is not a String
IllegalArgumentException
- if the value of element
is nullpublic static void attachProperties(Vertex vertex, VertexProperty.Cardinality cardinality, Object... propertyKeyValues)
Vertex
.
If the value of T.id
or T.label
is in the set of pairs, then they are ignored.vertex
- the vertex to attach the properties tocardinality
- the cardinality of the key value pair settingspropertyKeyValues
- the key/value pairs to assign to the element
ClassCastException
- if the value of the key is not a String
IllegalArgumentException
- if the value of element
is nullpublic static <V> Optional<VertexProperty<V>> stageVertexProperty(Vertex vertex, VertexProperty.Cardinality cardinality, String key, V value, Object... keyValues)
Vertex.property(org.apache.tinkerpop.gremlin.structure.VertexProperty.Cardinality, String, Object, Object...)
.
If the cardinality is list, simply return Optional.empty()
.
If the cardinality is single, delete all existing properties of the provided key and return Optional.empty()
.
If the cardinality is set, find one that has the same key/value and attached the properties to it and return it. Else, if no equal value is found, return Optional.empty()
.V
- the type of the vertex property valuevertex
- the vertex to stage a vertex property forcardinality
- the cardinality of the vertex propertykey
- the key of the vertex propertyvalue
- the value of the vertex propertykeyValues
- the properties of vertex propertypublic static Object[] getProperties(Element element, boolean includeId, boolean includeLabel, Set<String> propertiesToCopy)
element
- the element to retrieve properties fromincludeId
- include Element.ID in the key/value listincludeLabel
- include Element.LABEL in the key/value listpropertiesToCopy
- the properties to include with an empty list meaning copy all propertiespublic static boolean areEqual(Element a, Object b)
Element
objects are equal. This method should be used by any
Object.equals(Object)
implementation to ensure consistent behavior. This method is used for Vertex, Edge, and VertexProperty.public static boolean areEqual(VertexProperty a, VertexProperty b)
public static boolean areEqual(VertexProperty a, Object b)
VertexProperty
objects are equal. This method should be used by any
Object.equals(Object)
implementation to ensure consistent behavior.a
- the first VertexProperty
b
- the second VertexProperty
public static boolean haveEqualIds(Element a, Element b)
Element.id()
are equal()
.public static int hashCode(Element element)
Element
instances are equal, then they must have the same hash codes. This methods ensures consistent hashCode values.element
- the element to get the hashCode forpublic static int hashCode(Property property)
Property
instances are equal, then they must have the same hash codes. This methods ensures consistent hashCode values.
For VertexProperty
use hashCode(org.apache.tinkerpop.gremlin.structure.Element)
.property
- the property to get the hashCode forpublic static boolean areEqual(Property a, Object b)
Property
objects are equal. This method should be used by any
Object.equals(Object)
implementation to ensure consistent behavior.public static Map<String,Object> propertyValueMap(Element element, String... propertyKeys)
public static Map<String,List> vertexPropertyValueMap(Vertex vertex, String... propertyKeys)
public static Map<String,List<VertexProperty>> vertexPropertyMap(Vertex vertex, String... propertyKeys)
Copyright © 2013–2019 Apache Software Foundation. All rights reserved.