1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23 package javax.jdo.datastore;
24
25
26 /**
27 * Implementations of this interface can be used to obtain
28 * sequences. The behavior with regard to the transaction and
29 * rollover behavior are defined in the metadata.
30 *
31 * @version 2.0
32 * @since 2.0
33 */
34 public interface Sequence {
35
36 /**
37 * Returns the fully qualified name of the <code>Sequence</code>.
38 * @return the name of the sequence
39 */
40 String getName ();
41
42 /**
43 * Returns the next sequence value as an Object. If the next
44 * sequence value is not available, throw JDODataStoreException.
45 * @return the next value
46 */
47 Object next ();
48
49 /**
50 * Provides a hint to the implementation that the application
51 * will need <code>additional</code> sequence value objects in
52 * short order. There is no externally visible behavior of this
53 * method. It is used to potentially improve the efficiency of
54 * the algorithm of obtaining additional sequence value objects.
55 * @param additional the number of additional values to allocate
56 */
57 void allocate (int additional);
58
59 /**
60 * Returns the current sequence value object if it is
61 * available. It is intended to return a sequence value object
62 * previously used. If the current sequence value is not available,
63 * throw JDODataStoreException.
64 * @return the current value
65 */
66 Object current ();
67
68 /**
69 * Returns the next sequence value as a long. If the next
70 * sequence value is not available or is not numeric, throw
71 * JDODataStoreException.
72 * @return the next value
73 */
74 long nextValue();
75
76 /**
77 * Returns the current sequence value as a long. If the current
78 * sequence value is not available or is not numeric, throw
79 * JDODataStoreException.
80 * @return the current value
81 */
82 long currentValue();
83 }