|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.knime.core.node.config.base.AbstractConfigEntry
org.knime.core.node.config.base.ConfigBase
org.knime.core.node.config.Config
public abstract class Config
Supports a mechanism to save settings by their type and a key. Furthermore,
it provides a method to recursively add new sub Config objects
to this Config object, which then results in a tree-like structure.
This class inherits all types from its super class ConfigBase and in addition
DataCell, DataType, RowKey, and Config objects. For these supported elements,
methods to add either a single or an array or retrieve them back by throwing
an InvalidSettingsException or passing a default valid in
advance have been implemented.
| Nested Class Summary | |
|---|---|
(package private) static interface |
Config.DataCellEntry
Interface for all registered DataCell objects. |
| Constructor Summary | |
|---|---|
protected |
Config(String key)
Creates a new, empty config object with the given key. |
| Method Summary | |
|---|---|
protected void |
addConfig(Config config)
Appends the given Config to this Config which has to directly derived from this class. |
Config |
addConfig(String key)
Creates a new Config with the given key and returns it. |
void |
addDataCell(String key,
DataCell cell)
Adds this DataCell object to the Config by the given key. |
void |
addDataCellArray(String key,
DataCell... values)
Adds an array of DataCell objects to this Config. |
void |
addDataType(String key,
DataType type)
Adds this DataType object value to the Config by the given key. |
void |
addDataTypeArray(String key,
DataType... values)
Adds an array of DataType objects to this Config. |
void |
addEntry(AbstractConfigEntry entry)
Adds the given Config entry to this Config. |
void |
addRowKey(String key,
RowKey rowKey)
Adds this RowKey object to this Config by the given key. |
void |
addRowKeyArray(String key,
RowKey... rowKey)
Adds this RowKey array to this Config by the given key. |
Config |
getConfig(String key)
Retrieves Config by key. |
DataCell |
getDataCell(String key)
Return DataCell for key. |
DataCell |
getDataCell(String key,
DataCell def)
Return a DataCell which can be null, or the default value if the key is not available. |
DataCell[] |
getDataCellArray(String key)
Return DataCell array. |
DataCell[] |
getDataCellArray(String key,
DataCell... def)
Return DataCell array which can be null for key, or the default array if the key is not available. |
DataType |
getDataType(String key)
Return DataType for key. |
DataType |
getDataType(String key,
DataType def)
Return a DataType elements or null for key, or the default value if not available. |
DataType[] |
getDataTypeArray(String key)
Returns an array of DataType objects which can be null. |
DataType[] |
getDataTypeArray(String key,
DataType... v)
Returns the array of DataType objects for the given key or if not available the given array. |
abstract Config |
getInstance(String key)
Creates a new Config of this type. |
RowKey |
getRowKey(String key)
Return RowKey for key. |
RowKey |
getRowKey(String key,
RowKey def)
Return a RowKey which can be null, or the default value if
the key is not available. |
RowKey[] |
getRowKeyArray(String key)
Return RowKey array for the given key. |
RowKey[] |
getRowKeyArray(String key,
RowKey... def)
Return a RowKey array which can be null, or the default
value if the key is not available. |
void |
load(InputStream is)
Read config entries from an XML file into this object. |
protected static Config |
loadFromXML(Config config,
InputStream in)
Reads Config from XML into a new Config object. |
protected static Config |
readFromFile(ObjectInputStream ois)
Creates new Config from the given file using the serialized object stream. |
String |
toString()
String summary of this object including key, type, and value. |
| Methods inherited from class org.knime.core.node.config.base.ConfigBase |
|---|
addBoolean, addBooleanArray, addByte, addByteArray, addChar, addCharArray, addConfigBase, addConfigBase, addDouble, addDoubleArray, addFloat, addFloatArray, addInt, addIntArray, addLong, addLongArray, addShort, addShortArray, addString, addStringArray, children, containsKey, copyTo, get, getBoolean, getBoolean, getBooleanArray, getBooleanArray, getByte, getByte, getByteArray, getByteArray, getChar, getChar, getCharArray, getCharArray, getChildAt, getChildCount, getConfigBase, getDouble, getDouble, getDoubleArray, getDoubleArray, getEntry, getFloat, getFloat, getFloatArray, getFloatArray, getIndex, getInt, getInt, getIntArray, getIntArray, getLong, getLong, getLongArray, getLongArray, getShort, getShort, getShortArray, getShortArray, getString, getString, getStringArray, getStringArray, hasIdenticalValue, isLeaf, iterator, keySet, loadFromXML, put, saveToXML, toString, toStringValue, writeToFile |
| Methods inherited from class org.knime.core.node.config.base.AbstractConfigEntry |
|---|
equals, getAllowsChildren, getKey, getParent, getType, hashCode, isIdentical, setParent |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface org.knime.core.node.config.ConfigRO |
|---|
iterator |
| Methods inherited from interface org.knime.core.node.config.base.ConfigBaseRO |
|---|
containsKey, copyTo, getBoolean, getBoolean, getBooleanArray, getBooleanArray, getByte, getByte, getByteArray, getByteArray, getChar, getChar, getCharArray, getCharArray, getConfigBase, getDouble, getDouble, getDoubleArray, getDoubleArray, getFloat, getFloat, getFloatArray, getFloatArray, getInt, getInt, getIntArray, getIntArray, getKey, getLong, getLong, getLongArray, getLongArray, getShort, getShort, getShortArray, getShortArray, getString, getString, getStringArray, getStringArray, keySet, saveToXML |
| Methods inherited from interface javax.swing.tree.TreeNode |
|---|
children, getAllowsChildren, getChildAt, getChildCount, getIndex, getParent, isLeaf |
| Methods inherited from interface org.knime.core.node.config.base.ConfigBaseWO |
|---|
addBoolean, addBooleanArray, addByte, addByteArray, addChar, addCharArray, addConfigBase, addDouble, addDoubleArray, addFloat, addFloatArray, addInt, addIntArray, addLong, addLongArray, addShort, addShortArray, addString, addStringArray, getKey |
| Constructor Detail |
|---|
protected Config(String key)
key - The key for this Config.| Method Detail |
|---|
public abstract Config getInstance(String key)
getInstance in class ConfigBasekey - The new Config's key.
public final Config addConfig(String key)
addConfig in interface ConfigWOkey - An identifier.
protected final void addConfig(Config config)
config - The Config to append.
NullPointerException - If config is null.
IllegalArgumentException - If config is not instance
of this class.
public final Config getConfig(String key)
throws InvalidSettingsException
getConfig in interface ConfigROkey - The key.
InvalidSettingsException - If the key is not available.
public void addDataCell(String key,
DataCell cell)
addDataCell in interface ConfigWOkey - The key.cell - The DataCell to add.
public void addDataType(String key,
DataType type)
addDataType in interface ConfigWOkey - The key.type - The DataType object to add.
public DataCell getDataCell(String key)
throws InvalidSettingsException
getDataCell in interface ConfigROkey - The key.
InvalidSettingsException - If the key is not available.
public DataType getDataType(String key)
throws InvalidSettingsException
getDataType in interface ConfigROkey - The key.
InvalidSettingsException - If the key is not available.
public DataCell getDataCell(String key,
DataCell def)
getDataCell in interface ConfigROkey - The key.def - The default value, returned id the key is not available.
public DataType getDataType(String key,
DataType def)
getDataType in interface ConfigROkey - The key.def - Returned if no value available for the given key.
public DataCell[] getDataCellArray(String key)
throws InvalidSettingsException
getDataCellArray in interface ConfigROkey - The key.
InvalidSettingsException - If the the key is not available.
public DataCell[] getDataCellArray(String key,
DataCell... def)
getDataCellArray in interface ConfigROkey - The key.def - The default array returned if the key is not available.
public RowKey getRowKey(String key)
throws InvalidSettingsException
RowKey for key.
getRowKey in interface ConfigROkey - the identifier used to store the RowKey before
RowKey
InvalidSettingsException - if the key is not available
public RowKey getRowKey(String key,
RowKey def)
RowKey which can be null, or the default value if
the key is not available.
getRowKey in interface ConfigROkey - identifier used to store the RowKey beforedef - default value, returned if the key is not available
RowKey
public void addRowKey(String key,
RowKey rowKey)
RowKey object to this Config by the given key.
The row key can be null.
addRowKey in interface ConfigWOkey - identifier used to store and the load the RowKeyrowKey - value to store
public RowKey[] getRowKeyArray(String key)
throws InvalidSettingsException
RowKey array for the given key.
getRowKeyArray in interface ConfigROkey - the identifier used to store the RowKey array
before
RowKey array
InvalidSettingsException - if the key is not available
public RowKey[] getRowKeyArray(String key,
RowKey... def)
RowKey array which can be null, or the default
value if the key is not available.
getRowKeyArray in interface ConfigROkey - identifier used to store the RowKey array beforedef - default value, returned if the key is not available
RowKey array
public void addRowKeyArray(String key,
RowKey... rowKey)
RowKey array to this Config by the given key.
The row key array can be null.
addRowKeyArray in interface ConfigWOkey - identifier used to store and the load the RowKey
arrayrowKey - array to store
public DataType[] getDataTypeArray(String key)
throws InvalidSettingsException
getDataTypeArray in interface ConfigROkey - The key.
InvalidSettingsException - The the object is not available for the
given key.
public DataType[] getDataTypeArray(String key,
DataType... v)
getDataTypeArray in interface ConfigROkey - The key.v - The default array, returned if no entry available for the key.
public void addDataCellArray(String key,
DataCell... values)
addDataCellArray in interface ConfigWOkey - The key.values - The data cells, elements can be null.
public void addDataTypeArray(String key,
DataType... values)
addDataTypeArray in interface ConfigWOkey - The key.values - The data types, elements can be null.public void addEntry(AbstractConfigEntry entry)
addEntry in class ConfigBaseentry - The Config entry to add.public String toString()
toString in class ConfigBaseObject.toString()
protected static Config readFromFile(ObjectInputStream ois)
throws IOException
ois - Read Config from this stream.
IOException - Problem opening the file or content is not a Config.
protected static Config loadFromXML(Config config,
InputStream in)
throws IOException
config - Depending on the readRoot, we write into this Config and
return it.in - The stream to read XML Config from.
IOException - If the Config could not be load from stream.
public void load(InputStream is)
throws IOException
load in class ConfigBaseis - The XML inputstream storing the configuration to read
IOException - If the stream could not be read.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||