public interface Property<V>
Property
denotes a key/value pair associated with an Edge
. A property is much like a Java8
Optional
in that a property can be not present (i.e. empty). The key of a property is always a
String and the value of a property is an arbitrary Java object. Each underlying graph engine will typically have
constraints on what Java objects are allowed to be used as values.Modifier and Type | Interface and Description |
---|---|
static class |
Property.Exceptions
Common exceptions to use with a property.
|
Modifier and Type | Method and Description |
---|---|
Element |
element()
Get the element that this property is associated with.
|
static <V> Property<V> |
empty()
Create an empty property that is not present.
|
default void |
ifPresent(Consumer<? super V> consumer)
If the property is present, the consume the value as specified by the
Consumer . |
boolean |
isPresent()
Whether the property is empty or not.
|
String |
key()
The key of the property.
|
default V |
orElse(V otherValue)
If the value is present, return the value, else return the provided value.
|
default V |
orElseGet(Supplier<? extends V> valueSupplier)
If the value is present, return the value, else generate a value given the
Supplier . |
default <E extends Throwable> |
orElseThrow(Supplier<? extends E> exceptionSupplier)
If the value is present, return the value, else throw the exception generated by the
Supplier . |
void |
remove()
Remove the property from the associated element.
|
V |
value()
The value of the property.
|
String key()
V value() throws NoSuchElementException
NoSuchElementException
- thrown if the property is emptyboolean isPresent()
default void ifPresent(Consumer<? super V> consumer)
Consumer
.consumer
- The consumer to process the existing value.default V orElse(V otherValue)
otherValue
- The value to return if the property is not presentdefault V orElseGet(Supplier<? extends V> valueSupplier)
Supplier
.valueSupplier
- The supplier to use to generate a value if the property is not presentdefault <E extends Throwable> V orElseThrow(Supplier<? extends E> exceptionSupplier) throws E extends Throwable
Supplier
.E
- The exception typeexceptionSupplier
- The supplier to generate an exception if the property is not presentE
- if the property is not present, the exception is thrownE extends Throwable
Element element()
Vertex
, Edge
, or VertexProperty
).void remove()
static <V> Property<V> empty()
V
- The value class of the empty propertyCopyright © 2013–2021 Apache Software Foundation. All rights reserved.