Package de.mhus.lib.core.config
Class DirConfig
-
- All Implemented Interfaces:
IFlatConfig,ILog,IProperties,IReadProperties,MNlsProvider,Nls,Serializable,Iterable<Map.Entry<String,Object>>,Map<String,Object>
public class DirConfig extends PropertiesConfig
- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class de.mhus.lib.core.config.PropertiesConfig
changed, name, properties
-
Fields inherited from class de.mhus.lib.core.directory.WritableResourceNode
MOVE_DOWN, MOVE_FIRST, MOVE_LAST, MOVE_UP
-
Fields inherited from class de.mhus.lib.core.directory.ResourceNode
compiledCache, compiler
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description IConfigcreateConfig(String key)Create a new config and append it at the end of the list.FilegetDirectory()StringgetName()Return a name of this config element could also be null.IConfiggetNode(String key)Returns a inner configuration by the name.List<String>getNodeKeys()Return all possible, existing inner configuration names.List<IConfig>getNodes()Return all inner configurations ignoring the name.List<IConfig>getNodes(String key)Return all inner configurations by the given name.IConfiggetParent()return the parent config if possible.List<String>getPropertyKeys()Return all existing keys.booleanisEditable()Overwrite this function and return true if the property set can be edited.intmoveConfig(IConfig config, int newPos)Move the position of the configuration in the hole set of configurations.voidremoveConfig(IConfig config)Remove a config element from the set.-
Methods inherited from class de.mhus.lib.core.config.PropertiesConfig
clear, configRemoved, getInputStream, getProperty, getUrl, isConfigChanged, isProperty, readConfig, removeProperty, setProperty, writeConfig
-
Methods inherited from class de.mhus.lib.core.config.IConfig
getRenditionProperties, getRenditions, hasContent, isValid
-
Methods inherited from class de.mhus.lib.core.directory.WritableResourceNode
setString
-
Methods inherited from class de.mhus.lib.core.directory.ResourceNode
containsValue, dump, entrySet, getExtracted, getExtracted, getExtracted, getInputStream, getNodeByPath, getRenditionProperties, keys, size, values
-
Methods inherited from class de.mhus.lib.core.AbstractProperties
containsKey, get, getBoolean, getBoolean, getCalendar, getDate, getDouble, getFloat, getFormatted, getInt, getLong, getNumber, getString, getString, isEmpty, iterator, keySet, put, putAll, putReadProperties, remove, setBoolean, setCalendar, setDate, setDouble, setFloat, setInt, setLong, setNumber, toMap
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Methods inherited from interface java.util.Map
compute, computeIfAbsent, computeIfPresent, equals, forEach, getOrDefault, hashCode, merge, putIfAbsent, remove, replace, replace, replaceAll
-
-
-
-
Constructor Detail
-
DirConfig
public DirConfig(File dir)
-
-
Method Detail
-
getPropertyKeys
public List<String> getPropertyKeys()
Description copied from class:ResourceNodeReturn all existing keys. A property key is unique.- Overrides:
getPropertyKeysin classPropertiesConfig- Returns:
- all keys
-
getNode
public IConfig getNode(String key)
Description copied from class:ResourceNodeReturns a inner configuration by the name. Inner configurations are not unique. If more then one configurations exists it will return the first one. if no configuration exists it returns null.- Overrides:
getNodein classPropertiesConfig- Returns:
- the node with the name
-
getNodes
public List<IConfig> getNodes(String key)
Description copied from class:ResourceNodeReturn all inner configurations by the given name. The order is like in the configuration file. This never returns null.- Overrides:
getNodesin classPropertiesConfig- Returns:
- all nodes with the name
-
getNodes
public List<IConfig> getNodes()
Description copied from class:ResourceNodeReturn all inner configurations ignoring the name. The order is like in the configuration file. This never returns null.- Overrides:
getNodesin classPropertiesConfig- Returns:
- all nodes
-
getNodeKeys
public List<String> getNodeKeys()
Description copied from class:ResourceNodeReturn all possible, existing inner configuration names.- Overrides:
getNodeKeysin classPropertiesConfig- Returns:
- keys from nodes
-
getName
public String getName()
Description copied from class:ResourceNodeReturn a name of this config element could also be null. The name most time is the name of a sub config.- Overrides:
getNamein classPropertiesConfig- Returns:
- node of this node
-
createConfig
public IConfig createConfig(String key) throws de.mhus.lib.errors.MException
Description copied from class:WritableResourceNodeCreate a new config and append it at the end of the list. After creation the element is already at the end of the list.- Overrides:
createConfigin classPropertiesConfig- Returns:
- new config node
- Throws:
de.mhus.lib.errors.MException- if editing is not possible
-
moveConfig
public int moveConfig(IConfig config, int newPos) throws de.mhus.lib.errors.MException
Description copied from class:WritableResourceNodeMove the position of the configuration in the hole set of configurations. If the config is not part of the set it will throw an exception. The first position is 0.- Overrides:
moveConfigin classPropertiesConfig- Parameters:
config- The config object which you want to movenewPos- Absolute new position or one of the move operators MOVE_UP, MOVE_DOWN, MOVE_FIRST, MOVE_LAST- Returns:
- The new pos of the config
- Throws:
de.mhus.lib.errors.MException- if editing is not possible or the position is out of range
-
removeConfig
public void removeConfig(IConfig config) throws de.mhus.lib.errors.MException
Description copied from class:WritableResourceNodeRemove a config element from the set. If the config element is not part of the set it will not throw an error.- Overrides:
removeConfigin classPropertiesConfig- Parameters:
config- The config object which should be removed.- Throws:
de.mhus.lib.errors.MException- if editing is not possible
-
getParent
public IConfig getParent()
Description copied from class:ResourceNodereturn the parent config if possible.- Overrides:
getParentin classPropertiesConfig- Returns:
- parent node
-
isEditable
public boolean isEditable()
Description copied from class:AbstractPropertiesOverwrite this function and return true if the property set can be edited.- Specified by:
isEditablein interfaceIProperties- Overrides:
isEditablein classPropertiesConfig- Returns:
- if is editable
-
getDirectory
public File getDirectory()
-
-