org.finra.jtaf.core.parsing.helpers
Class AttributeHelper

java.lang.Object
  extended by org.finra.jtaf.core.parsing.helpers.AttributeHelper

public class AttributeHelper
extends Object

Helper class to fetch attributes of an element.


Constructor Summary
AttributeHelper(Element e)
          Collect the attributes, make sure their names are all cast to lowercase, and throw an exception if there are name collisions.
 
Method Summary
 boolean containsKey(String key)
          Search for the given key, ignoring case
 boolean containsValue(String value)
          Search for the given value
 Set<Map.Entry<String,String>> entrySet()
           
 Set<String> getCollisions()
           
 Map<String,String> getMap()
          Make sure you don't modify this return value
 String getOptionalString(String key)
          Search for the given key, ignoring case
 int getRequiredInteger(String key)
          Ensures that the attribute is a properly-formatted integer
 String getRequiredString(String key)
          Throws an exception if the requested attribute is undefined or an empty string
 String getStringOrDefault(String key, String defaultValue)
          If the requested attribute
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AttributeHelper

public AttributeHelper(Element e)
Collect the attributes, make sure their names are all cast to lowercase, and throw an exception if there are name collisions.

Parameters:
qName -
attributes -
Method Detail

getCollisions

public final Set<String> getCollisions()
Returns:
A copy of the collision set

entrySet

public Set<Map.Entry<String,String>> entrySet()
Returns:
The entrySet used internally

getMap

public final Map<String,String> getMap()
Make sure you don't modify this return value

Returns:
The map maintained internally

containsKey

public boolean containsKey(String key)
Search for the given key, ignoring case

Parameters:
key -
Returns:

containsValue

public boolean containsValue(String value)
Search for the given value

Parameters:
value -
Returns:

getRequiredString

public String getRequiredString(String key)
                         throws MissingAttributeException
Throws an exception if the requested attribute is undefined or an empty string

Parameters:
key -
Returns:
Throws:
MissingAttributeException

getOptionalString

public String getOptionalString(String key)
Search for the given key, ignoring case

Parameters:
key -
Returns:

getStringOrDefault

public final String getStringOrDefault(String key,
                                       String defaultValue)
If the requested attribute

Parameters:
key -
defaultValue -
Returns:

getRequiredInteger

public final int getRequiredInteger(String key)
                             throws MissingAttributeException,
                                    AttributeFormatException
Ensures that the attribute is a properly-formatted integer

Parameters:
key -
Returns:
Throws:
MissingAttributeException
AttributeFormatException


Copyright © 2014. All rights reserved.