public class Configuration extends Serializer
save(String, Configuration)
and load(String)
.data
Constructor and Description |
---|
Configuration()
Creates a new configuration.
|
Modifier and Type | Method and Description |
---|---|
java.awt.Color |
addColor(java.lang.String key,
java.awt.Color c)
Adds a color to the configuration.
|
Configuration |
addConfiguration(java.lang.String key,
Configuration cfg)
Adds a (sub) configuration to this configuration.
|
java.awt.Point |
addPoint(java.lang.String key,
java.awt.Point p)
Adds a point to the configuration.
|
java.awt.Rectangle |
addRectangle(java.lang.String key,
java.awt.Rectangle r)
Adds a rectangle to the configuration.
|
boolean |
areKeysOverrideable()
A configuration can override existing keys.
|
java.awt.Color |
getColor(java.lang.String key)
Gets a color.
|
java.awt.Color |
getColor(java.lang.String key,
java.awt.Color defValue)
Gets a color.
|
Configuration |
getConfiguration(java.lang.String key)
Gets a (sub) configuration for a given data key.
|
java.awt.Point |
getPoint(java.lang.String key)
Gets a point.
|
java.awt.Point |
getPoint(java.lang.String key,
java.awt.Point defValue)
Gets a point.
|
java.awt.Rectangle |
getRectangle(java.lang.String key)
Gets a rectangle.
|
java.awt.Rectangle |
getRectangle(java.lang.String key,
java.awt.Rectangle defValue)
Gets a rectangle.
|
static Configuration |
load(java.io.File file)
Loads a configuration file.
|
static Configuration |
load(java.lang.String filename)
Loads a configuration file.
|
static void |
save(java.io.File file,
Configuration cfg)
Saves a given configuration.
|
static void |
save(java.lang.String filename,
Configuration cfg)
Saves a given configuration.
|
addArray, addBoolean, addChar, addCollection, addData, addDouble, addFloat, addInt, addList, addObject, addSerializer, addString, checkKey, createObjectInputStream, createObjectOutputStream, equals, equals, freezeData, freezeData, getArray, getArray, getBoolean, getBoolean, getChar, getChar, getCollection, getCollection, getData, getData, getDouble, getDouble, getFloat, getFloat, getID, getInt, getInt, getList, getList, getName, getObject, getObject, getSerializer, getString, getString, keys, removeData, unfreezeData, unfreezeData
public final java.awt.Color addColor(java.lang.String key, java.awt.Color c) throws java.lang.IllegalArgumentException
key
- the data keyc
- the colorjava.lang.IllegalArgumentException
- public final java.awt.Color getColor(java.lang.String key)
key
- the data keynull
if the configuration does not contain a color with the given keypublic final java.awt.Color getColor(java.lang.String key, java.awt.Color defValue)
key
- the data keydefValue
- the default return valuepublic final java.awt.Point addPoint(java.lang.String key, java.awt.Point p) throws java.lang.IllegalArgumentException
key
- the data keyp
- the pointjava.lang.IllegalArgumentException
- public final java.awt.Point getPoint(java.lang.String key)
key
- the data keynull
if the configuration does not contain a point with the given keypublic final java.awt.Point getPoint(java.lang.String key, java.awt.Point defValue)
key
- the data keydefValue
- the default return valuepublic final java.awt.Rectangle addRectangle(java.lang.String key, java.awt.Rectangle r) throws java.lang.IllegalArgumentException
key
- the data keyr
- the rectanglejava.lang.IllegalArgumentException
- public final java.awt.Rectangle getRectangle(java.lang.String key)
key
- the data keynull
if the configuration does not contain a rectangle with the given keypublic final java.awt.Rectangle getRectangle(java.lang.String key, java.awt.Rectangle defValue)
key
- the data keydefValue
- the default return valuepublic final Configuration addConfiguration(java.lang.String key, Configuration cfg) throws java.lang.IllegalArgumentException
key
- the data keycfg
- the configurationjava.lang.IllegalArgumentException
- public final Configuration getConfiguration(java.lang.String key)
key
- the data keynull
if there is no configuration for the given keypublic boolean areKeysOverrideable()
areKeysOverrideable
in class Serializer
true
public static Configuration load(java.io.File file) throws java.lang.NullPointerException
file
- the configuration file (the file must have the extension ".cfg" otherwise it is added automatically)java.lang.NullPointerException
- public static Configuration load(java.lang.String filename) throws java.lang.IllegalArgumentException
filename
- the file name of the configuration file (the file name must have the extension ".cfg" otherwise it is added automatically)java.lang.IllegalArgumentException
- public static void save(java.io.File file, Configuration cfg) throws java.lang.NullPointerException, java.lang.IllegalArgumentException, java.io.IOException
file
- the configuration file (the file must have the extension ".cfg" otherwise it is added automatically)cfg
- the configurationjava.lang.IllegalArgumentException
- java.lang.IllegalArgumentException
- java.io.IOException
- java.lang.NullPointerException
public static void save(java.lang.String filename, Configuration cfg) throws java.lang.IllegalArgumentException, java.io.IOException
filename
- the file name of the configuration file (the file name must have the extension ".cfg" otherwise it is added automatically)cfg
- the configurationjava.lang.IllegalArgumentException
- java.io.IOException
-