ProgramixGenericLib v5.0.1

com.programix.saxplus
Interface AttributeGroup


public interface AttributeGroup

The group of attributes found in the starting tag for an element. The methods below which take a name parameter use the 'simple name' that would be returned by the getName() of NameDetail [the 'simple name' is what you probably expect the name of the attribute to be!].

For the vast majority of code, the getValueMap() method will be the most useful as ValueMap has many handy ways of accessing and interpreting the data (including suppling default values for optional items).

Author:
Paul Hyde

Method Summary
 Attribute get(int index)
          Returns the attribute with the specified index.
 Attribute get(String name)
          Returns the attribute with the specified name.
 int getSize()
          Returns the number of attributes present.
 ValueMap getValueMap()
          Returns all of the attributes conveniently accessible from a ValueMap.
 boolean hasAttribute(String name)
          Returns true if there is an attribute present with the specified simple name.
 

Method Detail

getValueMap

ValueMap getValueMap()
Returns all of the attributes conveniently accessible from a ValueMap. The key into this ValueMap is the simple name returned from the getName() method of NameDetail [the simple name is what you probably expect the name of the attribute to be!]. The value of the key-value pair is actually a Value.


getSize

int getSize()
Returns the number of attributes present.


hasAttribute

boolean hasAttribute(String name)
Returns true if there is an attribute present with the specified simple name. If an attribute is optional and you know the default value that you want to use when the attribute is not present, you can use this simple approach (instead of this method):
 AttributeGroup ag = //...
 String s = ag.getValueMap().getString("attrName", "defaultValue");
 


get

Attribute get(String name)
Returns the attribute with the specified name. If no attribute with that name is present, null is returned.


get

Attribute get(int index)
              throws ArrayIndexOutOfBoundsException
Returns the attribute with the specified index. If less than 0 or greater than (size - 1), an exception is thrown.

Throws:
ArrayIndexOutOfBoundsException

ProgramixGenericLib v5.0.1

Copyright © 2001-2009 Programix Incorporated. All rights reserved. ProgramixGenericLib is free and is OSI Certified Open Source Software under the BSD license.