Skip to content
This repository was archived by the owner on Sep 17, 2025. It is now read-only.

Commit 2491801

Browse files
committed
static factory methods
1 parent 2961db8 commit 2491801

File tree

5 files changed

+17
-22
lines changed

5 files changed

+17
-22
lines changed

src/main/java/com/arangodb/tinkerpop/gremlin/jsr223/ArangoDBGremlinPlugin.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,19 +48,19 @@ public class ArangoDBGremlinPlugin extends AbstractGremlinPlugin {
4848
// structure
4949
ArangoDBEdge.class,
5050
ArangoDBElement.class,
51+
ArangoDBGraph.class,
52+
ArangoDBGraphVariables.class,
5153
ArangoDBPersistentElement.class,
5254
ArangoDBProperty.class,
5355
ArangoDBSimpleElement.class,
5456
ArangoDBVertex.class,
5557
ArangoDBVertexProperty.class,
56-
ArangoDBGraph.class,
57-
ArangoDBGraphVariables.class,
5858

5959
// persistence
6060
AdbValue.class,
6161
EdgeData.class,
62-
PropertyData.class,
6362
PersistentData.class,
63+
PropertyData.class,
6464
SimplePropertyData.class,
6565
VertexData.class,
6666
VertexPropertyData.class

src/main/java/com/arangodb/tinkerpop/gremlin/persistence/EdgeData.java

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,7 @@ public class EdgeData extends SimplePropertyData implements PersistentData {
3939
@InternalTo
4040
private String to;
4141

42-
public EdgeData() {
43-
}
44-
45-
// FIXME: static factory method
46-
public EdgeData(
42+
public static EdgeData of(
4743
String label,
4844
String key,
4945
String from,
@@ -54,10 +50,15 @@ public EdgeData(
5450
Objects.requireNonNull(from, "from");
5551
Objects.requireNonNull(to, "to");
5652

57-
this.label = label;
58-
this.key = key;
59-
this.from = from;
60-
this.to = to;
53+
EdgeData data = new EdgeData();
54+
data.label = label;
55+
data.key = key;
56+
data.from = from;
57+
data.to = to;
58+
return data;
59+
}
60+
61+
public EdgeData() {
6162
}
6263

6364
@Override

src/main/java/com/arangodb/tinkerpop/gremlin/persistence/VertexPropertyData.java

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,19 +36,14 @@ public class VertexPropertyData extends SimplePropertyData {
3636
@JsonProperty("id") String id,
3737
@JsonProperty("value") Object value,
3838
@JsonProperty("valueType") String valueType
39-
// @JsonProperty("properties") Map<String, AdbValue> properties
4039
) {
41-
// super(properties);
4240
this.id = id;
4341
this.value = value;
4442
this.valueType = valueType;
4543
}
4644

47-
// FIXME: static factory method
48-
public VertexPropertyData(String id, Object value) {
49-
this.id = id;
50-
this.value = value;
51-
valueType = (value != null ? value.getClass() : Void.class).getCanonicalName();
45+
public static VertexPropertyData of(String id, Object value) {
46+
return new VertexPropertyData(id, value, (value != null ? value.getClass() : Void.class).getCanonicalName());
5247
}
5348

5449
public String getId() {

src/main/java/com/arangodb/tinkerpop/gremlin/structure/ArangoDBEdge.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919

2020
package com.arangodb.tinkerpop.gremlin.structure;
2121

22-
import com.arangodb.tinkerpop.gremlin.persistence.AdbValue;
2322
import com.arangodb.tinkerpop.gremlin.persistence.EdgeData;
2423
import org.apache.tinkerpop.gremlin.structure.*;
2524
import org.apache.tinkerpop.gremlin.structure.util.StringFactory;
@@ -33,7 +32,7 @@
3332
public class ArangoDBEdge extends ArangoDBSimpleElement<EdgeData> implements Edge, ArangoDBPersistentElement {
3433

3534
public static ArangoDBEdge of(final String id, final String label, final String outVertexId, final String inVertexId, ArangoDBGraph graph) {
36-
return new ArangoDBEdge(graph, new EdgeData(extractLabel(id, label).orElse(DEFAULT_LABEL), extractKey(id), outVertexId, inVertexId));
35+
return new ArangoDBEdge(graph, EdgeData.of(extractLabel(id, label).orElse(DEFAULT_LABEL), extractKey(id), outVertexId, inVertexId));
3736
}
3837

3938
public ArangoDBEdge(ArangoDBGraph graph, EdgeData data) {

src/main/java/com/arangodb/tinkerpop/gremlin/structure/ArangoDBVertex.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ public <V> VertexProperty<V> property(
6666
})
6767
.orElseGet(() -> UUID.randomUUID().toString());
6868

69-
VertexPropertyData prop = new VertexPropertyData(idValue, value);
69+
VertexPropertyData prop = VertexPropertyData.of(idValue, value);
7070
data.add(key, prop);
7171

7272
ArangoDBVertexProperty<V> vertexProperty = new ArangoDBVertexProperty<>(key, prop, this);

0 commit comments

Comments
 (0)