org.exoplatform.social.common.xmlprocessor.model
Class Attributes

java.lang.Object
  extended by 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
Attributes()
           
 
Method Summary
 void clear()
          Clears all attributes
 String get(String key)
          Gets an attribute value by key.
 Iterator<String> getKeyIterator()
          Gets the KeySet iterator of attributes
 boolean hasKey(String key)
          Checks if these attributes contain an attribute with this key.
 void put(String key, String value)
          Sets a new attribute, or replace an existing one by key.
 void remove(String key)
          Removes an attribute by key.
 int size()
          Get the number of attributes in this set.
 String toString()
          Converts to string xml presentation of this attributes.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Attributes

public 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 key
value - 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

clear

public void clear()
Clears all attributes


toString

public String toString()
Converts to string xml presentation of this attributes.

Overrides:
toString in class Object
Returns:
a xml presentation string


Copyright © 2003-2013 eXo Platform SAS. All Rights Reserved.