public final class ConfigSerializationUtils extends Object
ConfigWO
or
ConfigRO
objects, this also includes NodeSettingsRO
and NodeSettingsWO
.Modifier and Type | Method and Description |
---|---|
static void |
addEnum(ConfigWO writeO,
String key,
Enum<?> enumToAdd)
Adds the value returned by
Enum.name() as string to the given ConfigWO . |
static void |
addEnumSet(ConfigWO writeO,
String key,
EnumSet<?> enumsToAdd)
Adds the values returned by
Enum.name() as a string array to the given ConfigWO . |
static <T extends Enum<T>> |
getEnum(ConfigRO reado,
String key,
Class<T> clazz)
Reads an enum of type
T under the given key. |
static <T extends Enum<T>> |
getEnum(ConfigRO reado,
String key,
T defaultEnum)
Reads an enum of type
T under the given key or returns the default if the key does not exist or the
stored value is null or not compatible with the enum names defined by the enum type T . |
static <T extends Enum<T>> |
getEnumSet(ConfigRO reado,
String key,
Class<T> clazz)
Reads an
EnumSet of type T under the given key. |
public static <T extends Enum<T>> T getEnum(ConfigRO reado, String key, T defaultEnum)
T
under the given key or returns the default if the key does not exist or the
stored value is null
or not compatible with the enum names defined by the enum type T
.
This is i.e. the reverse method of addEnum(ConfigWO, String, Enum)
.T
- the enum typereado
- to read the enum fromkey
- the keydefaultEnum
- default valueNullPointerException
- if any of the given attributes is null
public static <T extends Enum<T>> T getEnum(ConfigRO reado, String key, Class<T> clazz) throws InvalidSettingsException
T
under the given key. This is i.e. the reverse method of
addEnum(ConfigWO, String, Enum)
.T
- the enum typereado
- to read the enum fromkey
- the keyclazz
- class of the enumInvalidSettingsException
- if there exists no entry for the given key or the value is null
or
not compatible with the enum names defined by the enum type T
.NullPointerException
- if any of the given attributes is null
public static <T extends Enum<T>> EnumSet<T> getEnumSet(ConfigRO reado, String key, Class<T> clazz) throws InvalidSettingsException
EnumSet
of type T
under the given key. This is i.e. the reverse method of
addEnumSet(ConfigWO, String, EnumSet)
.T
- the enum typereado
- to read the enum fromkey
- the keyclazz
- the enum classInvalidSettingsException
- if the key is not set or if any string backed in the model is not a valid name
of the given enum type T
NullPointerException
- if any of the given attributes is null
public static void addEnum(ConfigWO writeO, String key, Enum<?> enumToAdd)
Enum.name()
as string to the given ConfigWO
.writeO
- to write the enum tokey
- under which the enum should be writtenenumToAdd
- to writeNullPointerException
- if any of the given attributes is null
public static void addEnumSet(ConfigWO writeO, String key, EnumSet<?> enumsToAdd)
Enum.name()
as a string array to the given ConfigWO
.writeO
- to write the enum tokey
- under which the enum should be writtenenumsToAdd
- to writeNullPointerException
- if any of the given attributes is null
KNIME GmbH, Konstanz, Germany
You may not modify, publish, transmit, transfer or sell, reproduce, create derivative works from, distribute, perform, display, or in any way exploit any of the content, in whole or in part, except as otherwise expressly permitted in writing by the copyright owner or as specified in the license file distributed with this product.