KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > javax > jdo > datastore > Sequence


1 /*
2  * Copyright 2005 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16
17 /*
18  * Sequence.java
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 JavaDoc 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 JavaDoc 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 JavaDoc 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 }
Popular Tags