Class Attributes
- java.lang.Object
-
- org.exoplatform.social.common.xmlprocessor.model.Attributes
-
public class Attributes extends Object
The attributes of an Node.
Attributes are treated as a map: there can be only one value associated with an attribute key.
Attribute key and value comparisons are done case insensitively, and keys are normalised to lower-case.- Author:
- Ly Minh Phuong - http://phuonglm.net
-
-
Constructor Summary
Constructors Constructor Description Attributes()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclear()Clears all attributesStringget(String key)Gets an attribute value by key.Iterator<String>getKeyIterator()Gets the KeySet iterator of attributesbooleanhasKey(String key)Checks if these attributes contain an attribute with this key.voidput(String key, String value)Sets a new attribute, or replace an existing one by key.voidremove(String key)Removes an attribute by key.intsize()Get the number of attributes in this set.StringtoString()Converts to string xml presentation of this attributes.
-
-
-
Method Detail
-
get
public String get(String key)
Gets an attribute value by key.- Parameters:
key- the attribute key- Returns:
- the attribute value if set; or empty string if not set.
- See Also:
hasKey(String)
-
put
public void put(String key, String value)
Sets a new attribute, or replace an existing one by key.- Parameters:
key- attribute keyvalue- attribute value
-
remove
public void remove(String key)
Removes an attribute by key.- Parameters:
key- attribute key to remove
-
hasKey
public boolean hasKey(String key)
Checks if these attributes contain an attribute with this key.- Parameters:
key- key to be checked- Returns:
- true if key exists, false otherwise
-
size
public int size()
Get the number of attributes in this set.- Returns:
- size
-
getKeyIterator
public Iterator<String> getKeyIterator()
Gets the KeySet iterator of attributes- Returns:
- iterator of keys
-
clear
public void clear()
Clears all attributes
-
-