|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.ephox.editlive.java2.config.ConfigItem
public class ConfigItem
Represents an element in the configuration file and provides simple access to the attributes and child items.
Note that this class should not normally be instantiated directly. Instead, use the ELJBean.getConfig()
method.
Constructor Summary | |
---|---|
ConfigItem(Element configElement)
Creates a new ConfigItem wrapping the specified element. |
Method Summary | |
---|---|
ConfigItem |
addChildItem(String childName)
Adds a child item to the configuration. |
boolean |
equals(Object obj)
Compares for equality. |
List<ConfigItem> |
getAllChildItems()
Get the list of all child ConfigItems. |
List<ConfigItem> |
getChildItems(String childName)
Get the list of child ConfigItems with the specified name. |
ConfigItem |
getFirstChildItem(String childName)
Gets the first child ConfigItem with the specified name. |
ConfigItem |
getFirstChildItemWithSetting(String childElementName,
String setting,
String expectedValue)
Retrieves the first child item with the given name, that has the given value for a setting. |
String |
getName()
Retrieves the name of this item. |
String |
getSetting(String name)
Gets the value of an attribute for this config item. |
boolean |
getSettingAsBoolean(String name,
boolean defaultValue)
Retrieve the value of a setting as a boolean. |
String |
getSettingFromFirstChildItem(String childName,
String settingName)
A short cut to retrieve the first child item with the name childName and return a particular setting from it. |
Map<String,String> |
getSettings()
Get a map containing all attribute name/value pairs for this item. |
int |
hashCode()
Generates a hashCode for this object. |
void |
setSetting(String settingName,
String settingValue)
Sets the value of an attribute of this item. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ConfigItem(Element configElement)
ELJBean.getConfig()
method.
configElement
- the element to wrap.Method Detail |
---|
public String getSetting(String name)
name
- the name of the attribute (case insensitive).
public List<ConfigItem> getChildItems(String childName)
childName
- the name of the child elements to retrieve (case insensitive).
public List<ConfigItem> getAllChildItems()
Each item in the list is an instance of ConfigItem, representing a child element in the configuration file. TextNodes, comments and other non-element nodes are excluded.
public ConfigItem getFirstChildItem(String childName)
childName
- the name of the child element to find (case insensitive).
public Map<String,String> getSettings()
Note that the key lookup in the map is case insensitive.
public boolean getSettingAsBoolean(String name, boolean defaultValue)
name
- the name of the setting to retrieve.defaultValue
- the default value to return if the setting is not specified in the configuration file.
Boolean.valueOf(String)
.public String getSettingFromFirstChildItem(String childName, String settingName)
childName
- the name of the child item.settingName
- the name of the setting to retrieve from the child.
public ConfigItem getFirstChildItemWithSetting(String childElementName, String setting, String expectedValue)
childElementName
- the name of the child element to find.setting
- the setting name to check for.expectedValue
- the setting value to check for.
public ConfigItem addChildItem(String childName)
childName
- the name of the child item to add.
public void setSetting(String settingName, String settingValue)
settingName
- the name of the setting to set.settingValue
- the value to set. This will replace any existing value.public String getName()
public boolean equals(Object obj)
equals
in class Object
public int hashCode()
hashCode
in class Object
|
Copyright (c) 2005-2012 Ephox Pty Ltd. All rights reserved. | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |