KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > tools > ant > types > selectors > modifiedselector > Cache


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

18
19 package org.apache.tools.ant.types.selectors.modifiedselector;
20
21
22 import java.util.Iterator JavaDoc;
23
24
25 /**
26  * A Cache let the user store key-value-pairs in a permanent manner and access
27  * them.
28  * It is possible that a client uses get() before load() therefore the
29  * implementation must ensure that no error occurred because of the wrong
30  * <i>order</i>.
31  * The implementing class should implement a useful toString() method.
32  *
33  * @version 2003-09-13
34  * @since Ant 1.6
35  */

36 public interface Cache {
37
38     /**
39      * Checks its prerequisites.
40      * @return <i>true</i> if all is ok, otherwise <i>false</i>.
41      */

42     boolean isValid();
43
44     /** Deletes the cache. If file based the file has to be deleted also. */
45     void delete();
46
47     /** Loads the cache, must handle not existing cache. */
48     void load();
49
50     /** Saves modification of the cache. */
51     void save();
52
53     /**
54      * Returns a value for a given key from the cache.
55      * @param key the key
56      * @return the stored value
57      */

58     Object JavaDoc get(Object JavaDoc key);
59
60     /**
61      * Saves a key-value-pair in the cache.
62      * @param key the key
63      * @param value the value
64      */

65     void put(Object JavaDoc key, Object JavaDoc value);
66
67     /**
68      * Returns an iterator over the keys in the cache.
69      * @return An iterator over the keys.
70      */

71     Iterator JavaDoc iterator();
72 }
73
Popular Tags