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 Details

    • Attributes

      public Attributes()
  • Method Details

    • 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:
    • 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 of keys
    • 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