2 * Copyright © 2010 Mike Beattie <mike@ethernal.org>
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * General Public License for more details.
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
19 package org.altusmetrum.altoslib_11;
25 public abstract class AltosPreferencesBackend {
27 public abstract String getString(String key, String def);
28 public abstract void putString(String key, String value);
30 public abstract int getInt(String key, int def);
31 public abstract void putInt(String key, int value);
33 public abstract double getDouble(String key, double def);
34 public abstract void putDouble(String key, double value);
36 public abstract boolean getBoolean(String key, boolean def);
37 public abstract void putBoolean(String key, boolean value);
39 public abstract byte[] getBytes(String key, byte[] def);
40 public abstract void putBytes(String key, byte[] value);
42 public AltosJson getJson(String key) {
43 String value = getString(key, null);
48 return AltosJson.fromString(value);
49 } catch (IllegalArgumentException ie) {
54 public void putJson(String key, AltosJson j) {
55 putString(key, j.toString());
58 public abstract boolean nodeExists(String key);
59 public abstract AltosPreferencesBackend node(String key);
61 public abstract String[] keys();
62 public abstract void remove(String key);
64 public abstract void flush();
66 public abstract File homeDirectory();
68 public abstract void debug(String format, Object ... arguments);