org.anadix.html
Class Attributes

java.lang.Object
  extended by org.anadix.html.Attributes

public class Attributes
extends Object

Class representing set of element's attributes. Contains both the attributes contained in tag and contained in style.

Version:
$Id: $
Author:
tomason

Constructor Summary
Attributes(Properties attributes)
          Constructor
 
Method Summary
 String getAttribute(String key)
          Gets the attribute by name
 String getAttribute(String key, String defaultValue)
          Gets the attribute by name
 Collection<String> getAvaliableAttributes()
          Gets names of all attributes
 boolean hasAttribute(String key)
          Determines whether attribute with given name is defined
static Properties parseStyle(String style)
          Parses the style into list of key - value pairs
 String toString()
          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Attributes

public Attributes(Properties attributes)
Constructor

Parameters:
attributes - list of key - value pairs
Method Detail

getAttribute

public String getAttribute(String key)
Gets the attribute by name

Parameters:
key - name of the attribute to get
Returns:
value of the attribute or null if attribute is not defined

getAttribute

public String getAttribute(String key,
                           String defaultValue)
Gets the attribute by name

Parameters:
key - name of the attribute to get
defaultValue - default value to use if attribute is not defined
Returns:
value of the attribute or defaultValue if attribute is not defined

hasAttribute

public boolean hasAttribute(String key)
Determines whether attribute with given name is defined

Parameters:
key - name of the attribute
Returns:
true if attribute is defined false otherwise

getAvaliableAttributes

public Collection<String> getAvaliableAttributes()
Gets names of all attributes

Returns:
Collection of attribute names

parseStyle

public static Properties parseStyle(String style)
Parses the style into list of key - value pairs

Parameters:
style - String representation of style
Returns:
list of key - value pairs

toString

public String toString()

Overrides:
toString in class Object


Copyright © 2011. All Rights Reserved.