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