KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > st > ata > util > AList


1
2 package st.ata.util;
3
4 import java.io.InputStream JavaDoc;
5 import java.util.Date JavaDoc;
6 import java.util.Iterator JavaDoc;
7
8 // Tested by: none (interface)
9

10 /** Map from string keys to values. The mapping is "strongly types",
11  * e.g., a value saved as an "int" cannot be retrieved as a "long" or
12  * a "string". Throws {@link ClassCastException} if a type error
13  * occurs, {@link java.util.NoSuchElementException} if the key is not
14  * in the table. */

15
16 public interface AList {
17     public static final int F_ARRAY = 128;
18     public static final int F_ARRAY_ARRAY = 256;
19     public static final int T_ALIST = 1;
20     public static final int T_DATE = 2;
21     public static final int T_INT = 3;
22     public static final int T_LONG = 4;
23     public static final int T_STRING = 5;
24     public static final int T_INPUTSTREAM = 6;
25     public static final int T_OBJECT = 7;
26     public static final int T_UNDEFINED = 0;
27
28     /** Returns an iterator of {@link String} containing all keys in
29      * this list */

30     public Iterator JavaDoc getKeys();
31
32     public boolean containsKey(String JavaDoc key);
33
34     public Object JavaDoc getObject(String JavaDoc key);
35     public void putObject(String JavaDoc key, Object JavaDoc val);
36     public Object JavaDoc clone();
37     public void remove(String JavaDoc key);
38     /** Returns an array of {@link String} containing all keys in
39      * this list */

40
41     public String JavaDoc[] getKeyArray();
42     public int getInt(String JavaDoc key);
43
44     public long getLong(String JavaDoc key);
45
46     public String JavaDoc getString(String JavaDoc key);
47
48     public AList getAList(String JavaDoc key);
49
50     public Date JavaDoc getDate(String JavaDoc key);
51
52     public InputStream JavaDoc getInputStream(String JavaDoc key);
53
54     public int[] getIntArray(String JavaDoc key);
55
56     public long[] getLongArray(String JavaDoc key);
57
58     public String JavaDoc[] getStringArray(String JavaDoc key);
59
60     public AList[] getAListArray(String JavaDoc key);
61
62     public Date JavaDoc[] getDateArray(String JavaDoc key);
63
64     public InputStream JavaDoc[] getInputStreamArray(String JavaDoc key);
65
66     public String JavaDoc[][] getStringArrayArray(String JavaDoc key);
67
68     public void putInt(String JavaDoc key, int value);
69
70     public void putLong(String JavaDoc key, long value);
71
72     public void putString(String JavaDoc key, String JavaDoc value);
73
74     public void putAList(String JavaDoc key, AList value);
75
76     public void putDate(String JavaDoc key, Date JavaDoc value);
77
78     public void putInputStream(String JavaDoc key, InputStream JavaDoc value);
79
80     public void putIntArray(String JavaDoc key, int[] value);
81
82     public void putLongArray(String JavaDoc key, long[] value);
83
84     public void putStringArray(String JavaDoc key, String JavaDoc[] value);
85
86     public void putAListArray(String JavaDoc key, AList[] value);
87
88     public void putDateArray(String JavaDoc key, Date JavaDoc[] value);
89
90     public void putInputStreamArray(String JavaDoc key, InputStream JavaDoc[] value);
91
92     public void putStringArrayArray(String JavaDoc key, String JavaDoc[][] value);
93
94     /** Return the type of the value associated with a key. Returns
95      * one of either {@link #T_UNDEFINED}, if the key is not in the
96      * table, or {@link #T_ALIST}, {@link #T_DATE}, {@link #T_INT},
97      * {@link #T_LONG}, {@link #T_STRING}, {@link #T_STRING},
98      * {@link #T_INPUTSTREAM} or {@link #F_ARRAY}
99      * bitwise-ored with any of those. */

100     public int getType(String JavaDoc key);
101
102
103     /**
104      * Closes the object and releases any resources
105      * (for example, InputStreams) held by it.
106      */

107     public void close();
108
109     public AList newAList();
110
111     public void clear();
112
113     /**
114      * Copy the iterator's keys from one AList to another.
115      *
116      * @param keys Iterator of String keys
117      * @param other source AList
118      */

119     public void copyKeysFrom(Iterator JavaDoc keys, AList other);
120 }
121
Popular Tags