|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.openjump.io.PropertiesHandler
public class PropertiesHandler
Class that enables easy access for reading and writing properties files.
| Field Summary | |
|---|---|
protected java.util.Properties |
properties
|
protected java.lang.String |
propertiesFile
|
static java.lang.String |
propertiesFileEnding
|
| Constructor Summary | |
|---|---|
PropertiesHandler(java.lang.String propertiesFileName)
Constructor |
|
| Method Summary | |
|---|---|
boolean |
contains(java.lang.Object value)
|
boolean |
containsKey(java.lang.Object key)
|
boolean |
containsValue(java.lang.Object value)
|
java.util.Enumeration |
elements()
|
java.util.Map<java.lang.String,java.lang.Object> |
getAll()
get all properties as Map object (e.g. to feed into an other map...) |
java.lang.String |
getPropertiesFile()
|
java.lang.String |
getProperty(java.lang.String key)
|
java.lang.String |
getProperty(java.lang.String key,
java.lang.String defaultValue)
|
boolean |
getPropertyAsBoolean(java.lang.String key)
Gets the property value with the key key and parses it
to an boolean if possible. |
boolean |
getPropertyAsBoolean(java.lang.String key,
boolean defaultValue)
Gets the property value with the key key and parses it
to an boolean if possible. |
java.awt.Color |
getPropertyAsColor(java.lang.String key)
Gets the property value with the key key and parses it
to a Color if possible. |
java.awt.Color |
getPropertyAsColor(java.lang.String key,
java.awt.Color defaultValue)
Gets the property value with the key key and parses it
to a Color if possible. |
double |
getPropertyAsDouble(java.lang.String key)
Gets the property value with the key key and parses it
to a double if possible. |
double |
getPropertyAsDouble(java.lang.String key,
double defaultValue)
Gets the property value with the key key and parses it
to a double if possible. |
int |
getPropertyAsInt(java.lang.String key)
Gets the property value with the key key and parses it
to an int if possible. |
int |
getPropertyAsInt(java.lang.String key,
int defaultValue)
Gets the property value with the key key and parses it
to an int if possible. |
boolean |
isEmpty()
|
java.util.Enumeration |
keys()
|
java.util.Set |
keySet()
|
void |
load()
load the properties from the file |
void |
putAll(java.util.Map<java.lang.String,java.lang.Object> arg0)
|
java.lang.Object |
remove(java.lang.Object arg0)
|
java.lang.Object |
setProperty(java.lang.String key,
java.awt.Color value)
Sets a property key-value pair, replaces a pair with the same key! |
java.lang.Object |
setProperty(java.lang.String key,
java.lang.String value)
Sets a property key-value pair, replaces a pair with the same key! |
void |
store()
Stores the current properties map to the file. |
void |
store(java.lang.String comments)
Stores the current properties map to the file. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected java.lang.String propertiesFile
protected java.util.Properties properties
public static final java.lang.String propertiesFileEnding
| Constructor Detail |
|---|
public PropertiesHandler(java.lang.String propertiesFileName)
propertiesFileName - the file name (with out path!) of the properties file, that is to be read or written. It will automatically be placed in the config directory.PirolPlugInSettings.configDirectory()| Method Detail |
|---|
public boolean contains(java.lang.Object value)
Propertiespublic boolean containsKey(java.lang.Object key)
Propertiespublic boolean containsValue(java.lang.Object value)
Propertiespublic java.util.Enumeration elements()
Properties
public java.lang.String getProperty(java.lang.String key,
java.lang.String defaultValue)
Propertiespublic java.lang.String getProperty(java.lang.String key)
Propertiespublic boolean isEmpty()
Propertiespublic java.util.Enumeration keys()
Propertiespublic java.util.Set keySet()
Properties
public void load()
throws java.io.IOException
java.io.IOExceptionpublic void putAll(java.util.Map<java.lang.String,java.lang.Object> arg0)
Propertiespublic java.util.Map<java.lang.String,java.lang.Object> getAll()
public java.lang.Object remove(java.lang.Object arg0)
Properties
public java.lang.Object setProperty(java.lang.String key,
java.lang.String value)
key - the key for the pairvalue - the value
Properties
public java.lang.Object setProperty(java.lang.String key,
java.awt.Color value)
key - the key for the pairvalue - the value
Properties
public void store(java.lang.String comments)
throws java.io.IOException
comments - comments that will appear in the first lines of the file
java.io.IOException
public void store()
throws java.io.IOException
java.io.IOExceptionpublic int getPropertyAsInt(java.lang.String key)
key and parses it
to an int if possible. An exception will be thrown,
if this key is not found within the properties and if the value could not
be parsed as desired.
key - the key to get the value of
public int getPropertyAsInt(java.lang.String key,
int defaultValue)
key and parses it
to an int if possible.
If this key is not found within the properties the given default-Value will be returned.
An exception will be thrown, if the value is existent, but could not be parsed as desired.
key - the key to get the value ofdefaultValue - value to be filled in, if the given key wasn't found
public boolean getPropertyAsBoolean(java.lang.String key)
key and parses it
to an boolean if possible. An exception will be thrown,
if this key is not found within the properties and if the value could not
be parsed as desired.
key - the key to get the value of
public boolean getPropertyAsBoolean(java.lang.String key,
boolean defaultValue)
key and parses it
to an boolean if possible.
If this key is not found within the properties the given default-Value will be returned.
An exception will be thrown, if the value is existent, but could not be parsed as desired.
key - the key to get the value ofdefaultValue - value to be filled in, if the given key wasn't found
public double getPropertyAsDouble(java.lang.String key)
key and parses it
to a double if possible. An exception will be thrown,
if this key is not found within the properties and if the value could not
be parsed as desired.
key - the key to get the value of
public double getPropertyAsDouble(java.lang.String key,
double defaultValue)
key and parses it
to a double if possible.
If this key is not found within the properties the given default-Value will be returned.
An exception will be thrown, if the value is existent, but could not be parsed as desired.
key - the key to get the value ofdefaultValue - value to be filled in, if the given key wasn't found
public java.awt.Color getPropertyAsColor(java.lang.String key)
key and parses it
to a Color if possible. An exception will be thrown,
if this key is not found within the properties and if the value could not
be parsed as desired.
key - the key to get the value of
public java.awt.Color getPropertyAsColor(java.lang.String key,
java.awt.Color defaultValue)
key and parses it
to a Color if possible.
If this key is not found within the properties the given default-Value will be returned.
An exception will be thrown, if the value is existent, but could not be parsed as desired.
key - the key to get the value ofdefaultValue - value to be filled in, if the given key wasn't found
public java.lang.String getPropertiesFile()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||