Skip to main content
summaryrefslogtreecommitdiffstats
blob: 64f0bd3ccb9971f52103c97391ad870e0f1d3723 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
/*******************************************************************************
 * Copyright (c) 2004, 2007 Boeing.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     Boeing - initial API and implementation
 *******************************************************************************/
package org.eclipse.osee.framework.jdk.core.type;

import java.io.InputStream;
import java.io.OutputStream;
import java.util.Set;

/**
 * @author Roberto E. Escobar
 */
public interface IPropertyStore {

   /**
    * Returns the value of the given key .
    * 
    * @param key the key
    * @return the value, or <code>null</code> if none
    */
   public String get(String key);

   /**
    * Returns the value, an array of strings, of the given key.
    * 
    * @param key the key
    * @return the array of string, or <code>null</code> if none
    */
   public String[] getArray(String key);

   /**
    * Convert the value of the given key to a boolean and return it.
    * 
    * @param key the key
    * @return the boolean value, or <code>false</code> if none
    */
   public boolean getBoolean(String key);

   /**
    * Convert the value of the given key to a double and return it.
    * 
    * @param key the key
    * @return the value converted to double, or throws <code>NumberFormatException</code> if none
    * @exception NumberFormatException if the string value does not contain a parsable number.
    * @see java.lang.Double#valueOf(java.lang.String)
    */
   public double getDouble(String key) throws NumberFormatException;

   /**
    * Convert the value of the given key to a float and return it.
    * 
    * @param key the key
    * @return the value converted to float, or throws <code>NumberFormatException</code> if none
    * @exception NumberFormatException if the string value does not contain a parsable number.
    * @see java.lang.Float#valueOf(java.lang.String)
    */
   public float getFloat(String key) throws NumberFormatException;

   /**
    * Convert the value of the given key to a int and return it.
    * 
    * @param key the key
    * @return the value converted to int, or throws <code>NumberFormatException</code> if none
    * @exception NumberFormatException if the string value does not contain a parsable number.
    * @see java.lang.Integer#valueOf(java.lang.String)
    */
   public int getInt(String key) throws NumberFormatException;

   /**
    * Convert the value of the given key to a long and return it.
    * 
    * @param key the key
    * @return the value converted to long, or throws <code>NumberFormatException</code> if none
    * @exception NumberFormatException if the string value does not contain a parsable number.
    * @see java.lang.Long#valueOf(java.lang.String)
    */
   public long getLong(String key) throws NumberFormatException;

   /**
    * Convert the value of the given key to a IPropertyStore and return it.
    * 
    * @param key the key
    * @return the value converted to a PropertyStore, or null if key was is not found
    */
   public IPropertyStore getPropertyStore(String key);

   /**
    * Adds the pair <code>key/value</code>.
    * 
    * @param key the key.
    * @param value the value to be associated with the <code>key</code>
    */
   public void put(String key, String[] value);

   /**
    * Converts the double <code>value</code> to a string and adds the pair <code>key/value</code>.
    * 
    * @param key the key.
    * @param value the value to be associated with the <code>key</code>
    */
   public void put(String key, double value);

   /**
    * Converts the float <code>value</code> to a string and adds the pair <code>key/value</code>.
    * 
    * @param key the key.
    * @param value the value to be associated with the <code>key</code>
    */
   public void put(String key, float value);

   /**
    * Converts the integer <code>value</code> to a string and adds the pair <code>key/value</code>.
    * 
    * @param key the key.
    * @param value the value to be associated with the <code>key</code>
    */
   public void put(String key, int value);

   /**
    * Converts the long <code>value</code> to a string and adds the pair <code>key/value</code>.
    * 
    * @param key the key.
    * @param value the value to be associated with the <code>key</code>
    */
   public void put(String key, long value);

   /**
    * Adds the pair <code>key/value</code>.
    * 
    * @param key the key.
    * @param value the value to be associated with the <code>key</code>
    */
   public void put(String key, String value);

   /**
    * Converts the boolean <code>value</code> to a string and adds the pair <code>key/value</code>.
    * 
    * @param key the key.
    * @param value the value to be associated with the <code>key</code>
    */
   public void put(String key, boolean value);

   /**
    * Returns the property store's id
    * 
    * @return The Property Store's id
    */
   public String getId();

   /**
    * Save a property store to an outputStream.
    * 
    * @param outputStream the outputStream to write to.
    */
   public void save(OutputStream outputStream) throws Exception;

   /**
    * Loads a property store from an inputStream.
    * 
    * @param inputStream to read property store values from.
    */
   public void load(InputStream inputStream) throws Exception;

   /**
    * Get keys referencing primitive type items
    * 
    * @return primitive type item keys
    */
   public Set<String> keySet();

   /**
    * @return whether the propertyStore is empty
    */
   public boolean isEmpty();

   /**
    * Get keys referencing arrayItems
    * 
    * @return array item keys
    */
   public Set<String> arrayKeySet();

   /**
    * Get keys referencing inner property store items
    * 
    * @return array item keys
    */
   public Set<String> innerStoresKeySet();
}

Back to the top