22
22
23
23
import com .arangodb .ArangoCursor ;
24
24
import com .arangodb .ArangoIterator ;
25
+ import com .arangodb .entity .CursorEntity ;
25
26
import com .arangodb .entity .CursorStats ;
26
27
import com .arangodb .entity .CursorWarning ;
27
28
import com .arangodb .internal .ArangoCursorExecute ;
28
- import com .arangodb .internal .InternalArangoDatabase ;
29
- import com .arangodb .internal .cursor .entity .InternalCursorEntity ;
30
- import com .fasterxml .jackson .databind .JsonNode ;
31
29
32
30
import java .util .Collection ;
33
31
import java .util .Iterator ;
@@ -41,18 +39,18 @@ public class ArangoCursorImpl<T> implements ArangoCursor<T> {
41
39
protected final ArangoCursorIterator <T > iterator ;
42
40
private final Class <T > type ;
43
41
private final String id ;
44
- private final ArangoCursorExecute execute ;
42
+ private final ArangoCursorExecute < T > execute ;
45
43
private final boolean pontentialDirtyRead ;
46
44
private final boolean allowRetry ;
47
45
48
- public ArangoCursorImpl (final InternalArangoDatabase db , final ArangoCursorExecute execute ,
49
- final Class <T > type , final InternalCursorEntity result ) {
46
+ public ArangoCursorImpl (final ArangoCursorExecute < T > execute ,
47
+ final Class <T > type , final CursorEntity < T > result ) {
50
48
super ();
51
49
this .execute = execute ;
52
50
this .type = type ;
53
51
id = result .getId ();
54
- pontentialDirtyRead = result .isPontentialDirtyRead ();
55
- iterator = new ArangoCursorIterator <>(id , type , execute , db , result );
52
+ pontentialDirtyRead = result .isPotentialDirtyRead ();
53
+ iterator = new ArangoCursorIterator <>(id , execute , result );
56
54
this .allowRetry = result .getNextBatchId () != null ;
57
55
}
58
56
@@ -85,13 +83,13 @@ public Integer getCount() {
85
83
86
84
@ Override
87
85
public CursorStats getStats () {
88
- final InternalCursorEntity .Extras extra = iterator .result .getExtra ();
86
+ final CursorEntity .Extras extra = iterator .result .getExtra ();
89
87
return extra != null ? extra .getStats () : null ;
90
88
}
91
89
92
90
@ Override
93
91
public Collection <CursorWarning > getWarnings () {
94
- final InternalCursorEntity .Extras extra = iterator .result .getExtra ();
92
+ final CursorEntity .Extras extra = iterator .result .getExtra ();
95
93
return extra != null ? extra .getWarnings () : null ;
96
94
}
97
95
@@ -121,24 +119,20 @@ public String getNextBatchId() {
121
119
return iterator .result .getNextBatchId ();
122
120
}
123
121
124
- protected ArangoCursorExecute getExecute () {
122
+ protected ArangoCursorExecute < T > getExecute () {
125
123
return execute ;
126
124
}
127
125
128
126
protected static class ArangoCursorIterator <T > implements ArangoIterator <T > {
129
127
private final String cursorId ;
130
- private final Class <T > type ;
131
- private final InternalArangoDatabase db ;
132
- private final ArangoCursorExecute execute ;
133
- private InternalCursorEntity result ;
134
- private Iterator <JsonNode > arrayIterator ;
135
-
136
- protected ArangoCursorIterator (final String cursorId , final Class <T > type , final ArangoCursorExecute execute ,
137
- final InternalArangoDatabase db , final InternalCursorEntity result ) {
128
+ private final ArangoCursorExecute <T > execute ;
129
+ private CursorEntity <T > result ;
130
+ private Iterator <T > arrayIterator ;
131
+
132
+ protected ArangoCursorIterator (final String cursorId , final ArangoCursorExecute <T > execute ,
133
+ final CursorEntity <T > result ) {
138
134
this .cursorId = cursorId ;
139
- this .type = type ;
140
135
this .execute = execute ;
141
- this .db = db ;
142
136
this .result = result ;
143
137
arrayIterator = result .getResult ().iterator ();
144
138
}
@@ -157,13 +151,8 @@ public T next() {
157
151
if (!hasNext ()) {
158
152
throw new NoSuchElementException ();
159
153
}
160
- return deserialize (db .getSerde ().serialize (arrayIterator .next ()), type );
161
- }
162
-
163
- private <R > R deserialize (final byte [] result , final Class <R > type ) {
164
- return db .getSerde ().deserializeUserData (result , type );
154
+ return arrayIterator .next ();
165
155
}
166
-
167
156
}
168
157
169
158
}
0 commit comments