Skip to content

Commit c8cc18a

Browse files
author
Achim Brandt
committed
changed Object to T
1 parent 6185771 commit c8cc18a

File tree

6 files changed

+65
-37
lines changed

6 files changed

+65
-37
lines changed

src/main/java/com/arangodb/ArangoDriver.java

Lines changed: 49 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,50 @@
2323
import java.util.List;
2424
import java.util.Map;
2525

26-
import com.arangodb.entity.*;
26+
import com.arangodb.entity.AdminLogEntity;
27+
import com.arangodb.entity.AqlFunctionsEntity;
28+
import com.arangodb.entity.ArangoUnixTime;
29+
import com.arangodb.entity.ArangoVersion;
30+
import com.arangodb.entity.BaseDocument;
31+
import com.arangodb.entity.BatchResponseEntity;
32+
import com.arangodb.entity.BooleanResultEntity;
33+
import com.arangodb.entity.CollectionEntity;
34+
import com.arangodb.entity.CollectionKeyOption;
35+
import com.arangodb.entity.CollectionOptions;
36+
import com.arangodb.entity.CollectionsEntity;
37+
import com.arangodb.entity.CursorEntity;
38+
import com.arangodb.entity.DatabaseEntity;
39+
import com.arangodb.entity.DefaultEntity;
40+
import com.arangodb.entity.DeletedEntity;
41+
import com.arangodb.entity.DocumentEntity;
42+
import com.arangodb.entity.DocumentResultEntity;
43+
import com.arangodb.entity.EdgeDefinitionEntity;
44+
import com.arangodb.entity.EdgeEntity;
45+
import com.arangodb.entity.Endpoint;
46+
import com.arangodb.entity.GraphEntity;
47+
import com.arangodb.entity.GraphsEntity;
48+
import com.arangodb.entity.ImportResultEntity;
49+
import com.arangodb.entity.IndexEntity;
50+
import com.arangodb.entity.IndexType;
51+
import com.arangodb.entity.IndexesEntity;
52+
import com.arangodb.entity.JobsEntity;
53+
import com.arangodb.entity.PlainEdgeEntity;
54+
import com.arangodb.entity.Policy;
55+
import com.arangodb.entity.ReplicationApplierConfigEntity;
56+
import com.arangodb.entity.ReplicationApplierStateEntity;
57+
import com.arangodb.entity.ReplicationInventoryEntity;
58+
import com.arangodb.entity.ReplicationLoggerConfigEntity;
59+
import com.arangodb.entity.ReplicationLoggerStateEntity;
60+
import com.arangodb.entity.ReplicationSyncEntity;
61+
import com.arangodb.entity.RestrictType;
62+
import com.arangodb.entity.ScalarExampleEntity;
63+
import com.arangodb.entity.SimpleByResultEntity;
64+
import com.arangodb.entity.StatisticsDescriptionEntity;
65+
import com.arangodb.entity.StatisticsEntity;
66+
import com.arangodb.entity.StringsResultEntity;
67+
import com.arangodb.entity.TransactionEntity;
68+
import com.arangodb.entity.TransactionResultEntity;
69+
import com.arangodb.entity.UserEntity;
2770
import com.arangodb.http.BatchHttpManager;
2871
import com.arangodb.http.BatchPart;
2972
import com.arangodb.http.HttpManager;
@@ -3657,7 +3700,7 @@ public GraphEntity graphDeleteEdgeDefinition(String graphName, String edgeCollec
36573700
* vertex document.
36583701
* @throws ArangoException
36593702
*/
3660-
public <T> DocumentEntity<T> graphGetVertex(String graphName, String collectionName, String key, Class<?> clazz)
3703+
public <T> DocumentEntity<T> graphGetVertex(String graphName, String collectionName, String key, Class<T> clazz)
36613704
throws ArangoException {
36623705
return graphDriver.getVertex(getDefaultDatabase(), graphName, collectionName, key, clazz, null, null);
36633706
}
@@ -3680,7 +3723,7 @@ public <T> DocumentEntity<T> graphGetVertex(
36803723
String graphName,
36813724
String collectionName,
36823725
String key,
3683-
Class<?> clazz,
3726+
Class<T> clazz,
36843727
Long ifNoneMatchRevision,
36853728
Long ifMatchRevision) throws ArangoException {
36863729
return graphDriver.getVertex(
@@ -3765,7 +3808,7 @@ public DeletedEntity graphDeleteVertex(
37653808
* @return DocumentEntity<T>
37663809
* @throws ArangoException
37673810
*/
3768-
public <T> DocumentEntity<T> graphReplaceVertex(String graphName, String collectionName, String key, Object vertex)
3811+
public <T> DocumentEntity<T> graphReplaceVertex(String graphName, String collectionName, String key, T vertex)
37693812
throws ArangoException {
37703813
return graphDriver.replaceVertex(getDefaultDatabase(), graphName, collectionName, key, vertex, null, null, null);
37713814
}
@@ -3790,7 +3833,7 @@ public <T> DocumentEntity<T> graphReplaceVertex(
37903833
String graphName,
37913834
String collectionName,
37923835
String key,
3793-
Object vertex,
3836+
T vertex,
37943837
Boolean waitForSync,
37953838
Long ifMatchRevision,
37963839
Long ifNoneMatchRevision) throws ArangoException {
@@ -4385,7 +4428,7 @@ public TransactionResultEntity executeTransaction(TransactionEntity transactionE
43854428
public <T> EdgeEntity<T> createEdge(
43864429
String databaseName,
43874430
String collectionName,
4388-
Object object,
4431+
T object,
43894432
String from,
43904433
String to,
43914434
Boolean createCollection,

src/main/java/com/arangodb/BaseArangoDriver.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
import java.util.Map;
2222
import java.util.regex.Pattern;
2323

24-
import com.arangodb.entity.BaseDocument;
2524
import com.arangodb.entity.BaseEntity;
2625
import com.arangodb.entity.DefaultEntity;
2726
import com.arangodb.entity.DocumentEntity;
@@ -178,7 +177,7 @@ protected ReplicationDumpHeader toReplicationDumpHeader(HttpResponseEntity res)
178177
*/
179178
protected <T extends BaseEntity> T createEntity(
180179
HttpResponseEntity res,
181-
Class<? extends BaseEntity> clazz,
180+
Class<T> clazz,
182181
Class<?>[] pclazz,
183182
boolean validate) throws ArangoException {
184183
if (res == null) {
@@ -302,7 +301,7 @@ protected <T extends BaseEntity> T createEntity(HttpResponseEntity res, Class<T>
302301

303302
protected <T extends BaseEntity> T createEntity(
304303
HttpResponseEntity res,
305-
Class<? extends BaseEntity> clazz,
304+
Class<T> clazz,
306305
Class<?>... pclazz) throws ArangoException {
307306
return createEntity(res, clazz, pclazz, true);
308307
}

src/main/java/com/arangodb/InternalEdgeDriver.java

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* Copyright 2004-2014 triAGENS GmbH, Cologne, Germany
2+
* Copyright 2004-2015 triAGENS GmbH, Cologne, Germany
33
* Licensed under the Apache License, Version 2.0 (the "License");
44
* you may not use this file except in compliance with the License.
55
* You may obtain a copy of the License at
@@ -16,31 +16,21 @@
1616
*
1717
* @author fbartels
1818
* @author gschwab
19-
* @author Copyright 2014, triAGENS GmbH, Cologne, Germany
19+
* @author a-brandt
20+
* @author Copyright 2015, triAGENS GmbH, Cologne, Germany
2021
*/
2122

2223
package com.arangodb;
2324

24-
import java.util.Collection;
25-
import java.util.List;
26-
27-
import com.arangodb.entity.CursorEntity;
28-
import com.arangodb.entity.DeletedEntity;
29-
import com.arangodb.entity.Direction;
30-
import com.arangodb.entity.DocumentEntity;
31-
import com.arangodb.entity.EdgeDefinitionEntity;
3225
import com.arangodb.entity.EdgeEntity;
33-
import com.arangodb.entity.FilterCondition;
34-
import com.arangodb.entity.GraphEntity;
35-
import com.arangodb.entity.GraphsEntity;
3626
import com.arangodb.impl.BaseDriverInterface;
3727

3828
public interface InternalEdgeDriver extends BaseDriverInterface {
3929

4030
<T> EdgeEntity<T> createEdge(
4131
String databaseName,
4232
String collectionName,
43-
Object object,
33+
T object,
4434
String from,
4535
String to,
4636
Boolean createCollection,

src/main/java/com/arangodb/InternalGraphDriver.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ <T> DocumentEntity<T> getVertex(
236236
String graphName,
237237
String collectionName,
238238
String key,
239-
Class<?> clazz,
239+
Class<T> clazz,
240240
Long ifMatchRevision,
241241
Long ifNoneMatchRevision) throws ArangoException;
242242

@@ -260,7 +260,7 @@ <T> DocumentEntity<T> replaceVertex(
260260
String graphName,
261261
String collectionName,
262262
String key,
263-
Object vertex,
263+
T vertex,
264264
Boolean waitForSync,
265265
Long ifMatchRevision,
266266
Long ifNoneMatchRevision) throws ArangoException;

src/main/java/com/arangodb/impl/InternalEdgeDriverImpl.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public class InternalEdgeDriverImpl extends BaseArangoDriverWithCursorImpl imple
4040
public <T> EdgeEntity<T> createEdge(
4141
String databaseName,
4242
String collectionName,
43-
Object object,
43+
T object,
4444
String from,
4545
String to,
4646
Boolean createCollection,
@@ -63,7 +63,7 @@ public <T> EdgeEntity<T> createEdge(
6363
body);
6464

6565
EdgeEntity<T> edgeEntity = createEntity(response, EdgeEntity.class);
66-
edgeEntity.setEntity((T) object);
66+
edgeEntity.setEntity(object);
6767
return edgeEntity;
6868
}
6969

src/main/java/com/arangodb/impl/InternalGraphDriverImpl.java

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@
3939
import com.arangodb.entity.GraphEntity;
4040
import com.arangodb.entity.GraphGetCollectionsResultEntity;
4141
import com.arangodb.entity.GraphsEntity;
42-
import com.arangodb.entity.marker.VertexEntity;
4342
import com.arangodb.http.HttpManager;
4443
import com.arangodb.http.HttpResponseEntity;
4544
import com.arangodb.util.MapBuilder;
@@ -119,7 +118,6 @@ public GraphEntity getGraph(String databaseName, String graphName) throws Arango
119118
createEndpointUrl(baseUrl, databaseName, "/_api/gharial", StringUtils.encodeUrl(graphName)),
120119
new MapBuilder().get(),
121120
null);
122-
GraphEntity g = createEntity(res, GraphEntity.class);
123121
return createEntity(res, GraphEntity.class);
124122

125123
}
@@ -341,7 +339,7 @@ public <T> DocumentEntity<T> createVertex(
341339
if (!res.isJsonResponse()) {
342340
throw new ArangoException("unknown error");
343341
}
344-
DocumentEntity<T> result = createEntity(res, VertexEntity.class, vertex.getClass());
342+
DocumentEntity<T> result = createEntity(res, DocumentEntity.class, vertex.getClass());
345343
result.setEntity(vertex);
346344
return result;
347345
}
@@ -352,7 +350,7 @@ public <T> DocumentEntity<T> getVertex(
352350
String graphName,
353351
String collectionName,
354352
String key,
355-
Class<?> clazz,
353+
Class<T> clazz,
356354
Long ifMatchRevision,
357355
Long ifNoneMatchRevision) throws ArangoException {
358356

@@ -369,8 +367,7 @@ public <T> DocumentEntity<T> getVertex(
369367
new MapBuilder().put("If-Match", ifMatchRevision, true).put("If-None-Match", ifNoneMatchRevision, true).get(),
370368
new MapBuilder().get());
371369

372-
return createEntity(res, VertexEntity.class, clazz);
373-
370+
return createEntity(res, DocumentEntity.class, clazz);
374371
}
375372

376373
@Override
@@ -379,7 +376,7 @@ public <T> DocumentEntity<T> replaceVertex(
379376
String graphName,
380377
String collectionName,
381378
String key,
382-
Object vertex,
379+
T vertex,
383380
Boolean waitForSync,
384381
Long ifMatchRevision,
385382
Long ifNoneMatchRevision) throws ArangoException {
@@ -398,8 +395,7 @@ public <T> DocumentEntity<T> replaceVertex(
398395
new MapBuilder().put("waitForSync", waitForSync).get(),
399396
EntityFactory.toJsonString(vertex));
400397

401-
return createEntity(res, VertexEntity.class, vertex.getClass());
402-
398+
return createEntity(res, DocumentEntity.class, vertex.getClass());
403399
}
404400

405401
@Override
@@ -428,7 +424,7 @@ public <T> DocumentEntity<T> updateVertex(
428424
new MapBuilder().put("keepNull", keepNull).put("waitForSync", waitForSync).get(),
429425
EntityFactory.toJsonString(vertex, keepNull != null && !keepNull));
430426

431-
return createEntity(res, VertexEntity.class, vertex.getClass());
427+
return createEntity(res, DocumentEntity.class, vertex.getClass());
432428
}
433429

434430
@Override

0 commit comments

Comments
 (0)