API Overview API Index Package Overview Direct link to this page
JavaOnTracks 0.1.2
  net.jot.prefs. JOTPreferenceInterface View Javadoc
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

/*
------------------------------------
JavaOnTracks          Thibaut Colar
tcolar-jot AT colar DOT net
Artistic Licence 2.0
http://www.javaontracks.net
------------------------------------
 */
package net.jot.prefs;

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;

/**
 * Main interface for reading a preference file (implementaion takes care of the format)
 * Preferences are key/values
 * ie: xml file, property file etc ...
 * @author Thibaut Colar http://jot.colar.net/
 *
 */
public interface JOTPreferenceInterface {
	/**
	 * Loads the prefrence from this input/file into memory (cache)
	 * @param input
	 * @throws IOException
	 */
	public void loadFrom(InputStream input) throws IOException;
	
	/**
	 * Saves the preference from the cache into an output/file
	 * @param output
	 * @throws IOException
	 */
	public void saveTo(OutputStream output) throws IOException;
	
	/**
	 * Loads a String value
	 * Returns null if the value is not defined
	 * @param key
	 * @return
	 */
	public String getString(String key);
	
	/**
	 * Loads a boolean value (true or false 1 or 0) etc.. depends of implementation
	 * Returns null if not defined or not a boolean
	 * @param key
	 * @return
	 */
	public Boolean getBoolean(String key);
	
	/**
	 * Loads a String value
	 * Returns 'defaultValue' if not defined or not a boolean
	 * @param key
	 * @param defaultValue
	 * @return
	 */
	public String getDefaultedString(String key, String defaultValue);
	
	/**
	 * Loads a boolean value (true or false 1 or 0) etc.. depends of implementation
	 * Returns 'defaultValue' if not defined or not a boolean
	 * @param key
	 * @param defaultValue
	 * @return
	 */
	public Boolean getDefaultedBoolean(String key, Boolean defaultValue);

	/**
	 * Sets a string value
	 * @param key
	 * @param value
	 */
	public void setString(String key, String value);

	/**
	 * Sets a boolean value
	 * @param key
	 * @param value
	 */
	public void setBoolean(String key, Boolean value);
	
}

Generated By: JavaOnTracks Doclet 0.1.5     ©Thibaut Colar