18
18
import com .tinkerpop .frames .annotations .AnnotationHandler ;
19
19
import com .tinkerpop .frames .annotations .DomainAnnotationHandler ;
20
20
import com .tinkerpop .frames .annotations .IncidenceAnnotationHandler ;
21
+ import com .tinkerpop .frames .annotations .InitialAnnotationHandler ;
21
22
import com .tinkerpop .frames .annotations .PropertyAnnotationHandler ;
22
23
import com .tinkerpop .frames .annotations .RangeAnnotationHandler ;
24
+ import com .tinkerpop .frames .annotations .TerminalAnnotationHandler ;
23
25
import com .tinkerpop .frames .annotations .gremlin .GremlinGroovyAnnotationHandler ;
24
26
import com .tinkerpop .frames .structures .FramedEdgeIterable ;
25
27
import com .tinkerpop .frames .structures .FramedVertexIterable ;
@@ -68,6 +70,8 @@ public FramedGraph(final T baseGraph) {
68
70
registerAnnotationHandler (new IncidenceAnnotationHandler ());
69
71
registerAnnotationHandler (new DomainAnnotationHandler ());
70
72
registerAnnotationHandler (new RangeAnnotationHandler ());
73
+ registerAnnotationHandler (new InitialAnnotationHandler ());
74
+ registerAnnotationHandler (new TerminalAnnotationHandler ());
71
75
registerAnnotationHandler (new GremlinGroovyAnnotationHandler ());
72
76
}
73
77
@@ -116,6 +120,9 @@ public <F> F frame(final Vertex vertex, final Class<F> kind) {
116
120
* the default type of the annotated interface
117
121
* @return a proxy objects backed by an edge and interpreted from the
118
122
* perspective of the annotate interface or null if the edge paramenter was null
123
+ *
124
+ * @deprecated Use {@link #frame(Edge, Class)}, in combination with {@link Initial}
125
+ * and {@link Terminal}.
119
126
*/
120
127
public <F > F frame (final Edge edge , final Direction direction ,
121
128
final Class <F > kind ) {
@@ -135,6 +142,23 @@ public <F> F frame(final Edge edge, final Direction direction,
135
142
resolvedTypes .toArray (new Class [resolvedTypes .size ()]),
136
143
new FramedElement (this , edge , direction ));
137
144
}
145
+
146
+ /**
147
+ * A helper method for framing an edge. Note that all framed edges implement
148
+ * {@link EdgeFrame} to allow access to the underlying element.
149
+ *
150
+ * @param edge
151
+ * the edge to frame
152
+ * @param kind
153
+ * the default annotated interface to frame the edges as
154
+ * @param <F>
155
+ * the default type of the annotated interface
156
+ * @return a proxy objects backed by an edge and interpreted from the
157
+ * perspective of the annotate interface or null if the edge paramenter was null
158
+ */
159
+ public <F > F frame (final Edge edge , final Class <F > kind ) {
160
+ return frame (edge , Direction .OUT , kind );
161
+ }
138
162
139
163
/**
140
164
* A helper method for framing an iterable of vertices.
@@ -166,11 +190,33 @@ public <F> Iterable<F> frameVertices(final Iterable<Vertex> vertices,
166
190
* the default type of the annotated interface
167
191
* @return an iterable of proxy objects backed by an edge and interpreted
168
192
* from the perspective of the annotate interface
193
+ *
194
+ * @deprecated Use {@link #frameEdges(Iterable, Class)}, in combination with {@link Initial}
195
+ * and {@link Terminal}.
169
196
*/
170
197
public <F > Iterable <F > frameEdges (final Iterable <Edge > edges ,
171
198
final Direction direction , final Class <F > kind ) {
172
199
return new FramedEdgeIterable <F >(this , edges , direction , kind );
173
200
}
201
+
202
+ /**
203
+ * A helper method for framing an iterable of edges.
204
+ *
205
+ * @param edges
206
+ * the edges to frame
207
+ * @param direction
208
+ * the direction of the edges
209
+ * @param kind
210
+ * the default annotated interface to frame the edges as
211
+ * @param <F>
212
+ * the default type of the annotated interface
213
+ * @return an iterable of proxy objects backed by an edge and interpreted
214
+ * from the perspective of the annotate interface
215
+ */
216
+ public <F > Iterable <F > frameEdges (final Iterable <Edge > edges ,
217
+ final Class <F > kind ) {
218
+ return new FramedEdgeIterable <F >(this , edges , kind );
219
+ }
174
220
175
221
public Vertex getVertex (final Object id ) {
176
222
return config .getConfiguredGraph ().getVertex (id );
@@ -233,11 +279,32 @@ public Edge getEdge(final Object id) {
233
279
* the default type of the annotated interface
234
280
* @return a proxy object backed by the edge and interpreted from the
235
281
* perspective of the annotate interface
282
+ *
283
+ * @deprecated Use {@link #getEdges(Object, Class)}, in combination with {@link Initial}
284
+ * and {@link Terminal}.
236
285
*/
237
286
public <F > F getEdge (final Object id , final Direction direction ,
238
287
final Class <F > kind ) {
239
288
return this .frame (getEdge (id ), direction , kind );
240
289
}
290
+
291
+ /**
292
+ * Frame an edge according to a particular kind of annotated interface.
293
+ *
294
+ * @param id
295
+ * the id of the edge
296
+ * @param direction
297
+ * the direction of the edge
298
+ * @param kind
299
+ * the default annotated interface to frame the edge as
300
+ * @param <F>
301
+ * the default type of the annotated interface
302
+ * @return a proxy object backed by the edge and interpreted from the
303
+ * perspective of the annotate interface
304
+ */
305
+ public <F > F getEdge (final Object id , final Class <F > kind ) {
306
+ return this .frame (getEdge (id ), kind );
307
+ }
241
308
242
309
public Edge addEdge (final Object id , final Vertex outVertex ,
243
310
final Vertex inVertex , final String label ) {
@@ -263,6 +330,9 @@ public Edge addEdge(final Object id, final Vertex outVertex,
263
330
* the default type of the annotated interface
264
331
* @return a proxy object backed by the edge and interpreted from the
265
332
* perspective of the annotate interface
333
+ *
334
+ * @deprecated Use {@link #addEdge(Object, Vertex, Vertex, String, Class)},
335
+ * in combination with {@link Initial} and {@link Terminal}.
266
336
*/
267
337
public <F > F addEdge (final Object id , final Vertex outVertex ,
268
338
final Vertex inVertex , final String label ,
@@ -273,6 +343,12 @@ public <F> F addEdge(final Object id, final Vertex outVertex,
273
343
}
274
344
return this .frame (edge , direction , kind );
275
345
}
346
+
347
+ public <F > F addEdge (final Object id , final Vertex outVertex ,
348
+ final Vertex inVertex , final String label ,
349
+ final Class <F > kind ) {
350
+ return addEdge (id , outVertex , inVertex , label , Direction .OUT , kind );
351
+ }
276
352
277
353
public void removeVertex (final Vertex vertex ) {
278
354
config .getConfiguredGraph ().removeVertex (vertex );
@@ -333,12 +409,37 @@ public Iterable<Edge> getEdges(final String key, final Object value) {
333
409
* the default type of the annotated interface
334
410
* @return an iterable of proxy objects backed by the edges and interpreted
335
411
* from the perspective of the annotate interface
412
+ *
413
+ * @deprecated Use {@link #getEdges(String, Object, Class)}, in combination with
414
+ * {@link Initial} and {@link Terminal}.
336
415
*/
337
416
public <F > Iterable <F > getEdges (final String key , final Object value ,
338
417
final Direction direction , final Class <F > kind ) {
339
418
return new FramedEdgeIterable <F >(this , config .getConfiguredGraph ().getEdges (key ,
340
419
value ), direction , kind );
341
420
}
421
+
422
+ /**
423
+ * Frame edges according to a particular kind of annotated interface.
424
+ *
425
+ * @param key
426
+ * the key of the edges to get
427
+ * @param value
428
+ * the value of the edges to get
429
+ * @param direction
430
+ * the direction of the edges
431
+ * @param kind
432
+ * the default annotated interface to frame the edges as
433
+ * @param <F>
434
+ * the default type of the annotated interface
435
+ * @return an iterable of proxy objects backed by the edges and interpreted
436
+ * from the perspective of the annotate interface
437
+ */
438
+ public <F > Iterable <F > getEdges (final String key , final Object value ,
439
+ final Class <F > kind ) {
440
+ return new FramedEdgeIterable <F >(this , config .getConfiguredGraph ().getEdges (key ,
441
+ value ), kind );
442
+ }
342
443
343
444
public Features getFeatures () {
344
445
Features features = config .getConfiguredGraph ().getFeatures ().copyFeatures ();
0 commit comments