Lines Matching refs:key

24  * store contains a list of string key-value pairs.
35 private static native String native_get(String key);
36 private static native String native_get(String key, String def);
37 private static native int native_get_int(String key, int def);
38 private static native long native_get_long(String key, long def);
39 private static native boolean native_get_boolean(String key, boolean def);
40 private static native void native_set(String key, String def);
44 * Get the value for the given key.
45 * @return an empty string if the key isn't found
46 * @throws IllegalArgumentException if the key exceeds 32 characters
48 public static String get(String key) {
49 if (key.length() > PROP_NAME_MAX) {
50 throw new IllegalArgumentException("key.length > " + PROP_NAME_MAX);
52 return native_get(key);
56 * Get the value for the given key.
57 * @return if the key isn't found, return def if it isn't null, or an empty string otherwise
58 * @throws IllegalArgumentException if the key exceeds 32 characters
60 public static String get(String key, String def) {
61 if (key.length() > PROP_NAME_MAX) {
62 throw new IllegalArgumentException("key.length > " + PROP_NAME_MAX);
64 return native_get(key, def);
68 * Get the value for the given key, and return as an integer.
69 * @param key the key to lookup
71 * @return the key parsed as an integer, or def if the key isn't found or
73 * @throws IllegalArgumentException if the key exceeds 32 characters
75 public static int getInt(String key, int def) {
76 if (key.length() > PROP_NAME_MAX) {
77 throw new IllegalArgumentException("key.length > " + PROP_NAME_MAX);
79 return native_get_int(key, def);
83 * Get the value for the given key, and return as a long.
84 * @param key the key to lookup
86 * @return the key parsed as a long, or def if the key isn't found or
88 * @throws IllegalArgumentException if the key exceeds 32 characters
90 public static long getLong(String key, long def) {
91 if (key.length() > PROP_NAME_MAX) {
92 throw new IllegalArgumentException("key.length > " + PROP_NAME_MAX);
94 return native_get_long(key, def);
98 * Get the value for the given key, returned as a boolean.
102 * If the key does not exist, or has any other value, then the default
104 * @param key the key to lookup
106 * @return the key parsed as a boolean, or def if the key isn't found or is
108 * @throws IllegalArgumentException if the key exceeds 32 characters
110 public static boolean getBoolean(String key, boolean def) {
111 if (key.length() > PROP_NAME_MAX) {
112 throw new IllegalArgumentException("key.length > " + PROP_NAME_MAX);
114 return native_get_boolean(key, def);
118 * Set the value for the given key.
119 * @throws IllegalArgumentException if the key exceeds 32 characters
122 public static void set(String key, String val) {
123 if (key.length() > PROP_NAME_MAX) {
124 throw new IllegalArgumentException("key.length > " + PROP_NAME_MAX);
130 native_set(key, val);