net.sourceforge.jeuclid.elements.support.attributes
Class AbstractAttributeMap

java.lang.Object
  extended by net.sourceforge.jeuclid.elements.support.attributes.AbstractAttributeMap
All Implemented Interfaces:
AttributeMap
Direct Known Subclasses:
DOMAttributeMap, SAXAttributeMap

public abstract class AbstractAttributeMap
extends Object
implements AttributeMap

Generic class for reading and parsing attributes.

Version:
$Revision: 310 $
Author:
Max Berger

Constructor Summary
AbstractAttributeMap()
           
 
Method Summary
protected abstract  String getAttribute(String attrName)
          Override this method to get an attribute value without a namespace.
protected abstract  String getAttributeNS(String namespace, String attrName)
          Override this method to get an attribtue with a namespace.
 boolean getBoolean(String attrName, boolean defaultValue)
          retrieve the value of the attribute as boolean.
 String getString(String attrName)
          retrieve the value of the attribute as String.
 String getString(String attrName, String defaultValue)
          retrieve the value of the attribute as String.
 boolean hasAttribute(String attrName)
          return true if an attribute is present.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface net.sourceforge.jeuclid.elements.support.attributes.AttributeMap
getAsMap
 

Constructor Detail

AbstractAttributeMap

public AbstractAttributeMap()
Method Detail

getAttribute

protected abstract String getAttribute(String attrName)
Override this method to get an attribute value without a namespace.

Parameters:
attrName - name of the attribute
Returns:
value of the attribute

getAttributeNS

protected abstract String getAttributeNS(String namespace,
                                         String attrName)
Override this method to get an attribtue with a namespace.

Parameters:
namespace - the namespace
attrName - the attribtue name
Returns:
value of the attribute.

hasAttribute

public boolean hasAttribute(String attrName)
return true if an attribute is present.

Specified by:
hasAttribute in interface AttributeMap
Parameters:
attrName - name of the attribute to look for.
Returns:
true if attrName is present.

getString

public String getString(String attrName)
retrieve the value of the attribute as String.

Specified by:
getString in interface AttributeMap
Parameters:
attrName - name of the attribute
Returns:
the value of the attribute as String.

getString

public String getString(String attrName,
                        String defaultValue)
retrieve the value of the attribute as String.

Specified by:
getString in interface AttributeMap
Parameters:
attrName - name of the attribute
defaultValue - value to use if unset.
Returns:
the value of the attribute as String.

getBoolean

public boolean getBoolean(String attrName,
                          boolean defaultValue)
retrieve the value of the attribute as boolean.

Specified by:
getBoolean in interface AttributeMap
Parameters:
attrName - name of the attribute.
defaultValue - value to use if unset.
Returns:
a boolean value.


Copyright © 2002-2008 The JEuclid project. All Rights Reserved.