org.jboss.jca.as.converters
Class AbstractParser

java.lang.Object
  extended by org.jboss.jca.as.converters.AbstractParser
Direct Known Subclasses:
LegacyCfParser, LegacyDsParser

public abstract class AbstractParser
extends Object

A AbstractParser.

Author:
Stefano Maestri, Jeff Zhang

Constructor Summary
AbstractParser()
           
 
Method Summary
protected  Boolean attributeAsBoolean(XMLStreamReader reader, String attributeName, Boolean defaultValue)
          convert an xml attribute in boolean value.
protected  Integer attributeAsInt(XMLStreamReader reader, String attributeName)
          convert an xml element in String value
protected  String attributeAsString(XMLStreamReader reader, String attributeName)
          convert an xml element in String value
protected  Boolean elementAsBoolean(XMLStreamReader reader)
          convert an xml element in boolean value.
protected  Integer elementAsInteger(XMLStreamReader reader)
          convert an xml element in Integer value
protected  Long elementAsLong(XMLStreamReader reader)
          convert an xml element in Long value
protected  String elementAsString(XMLStreamReader reader)
          convert an xml element in String value
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractParser

public AbstractParser()
Method Detail

elementAsBoolean

protected Boolean elementAsBoolean(XMLStreamReader reader)
                            throws XMLStreamException,
                                   ParserException
convert an xml element in boolean value. Empty elements results with true (tag presence is sufficient condition)

Parameters:
reader - the StAX reader
Returns:
the boolean representing element
Throws:
XMLStreamException - StAX exception
ParserException - in case of non valid boolean for given element value

attributeAsBoolean

protected Boolean attributeAsBoolean(XMLStreamReader reader,
                                     String attributeName,
                                     Boolean defaultValue)
                              throws XMLStreamException,
                                     ParserException
convert an xml attribute in boolean value. Empty elements results with false

Parameters:
reader - the StAX reader
attributeName - the name of the attribute
defaultValue - defaultValue
Returns:
the boolean representing element
Throws:
XMLStreamException - StAX exception
ParserException - in case of not valid boolena for given attribute

elementAsString

protected String elementAsString(XMLStreamReader reader)
                          throws XMLStreamException
convert an xml element in String value

Parameters:
reader - the StAX reader
Returns:
the string representing element
Throws:
XMLStreamException - StAX exception

attributeAsString

protected String attributeAsString(XMLStreamReader reader,
                                   String attributeName)
                            throws XMLStreamException
convert an xml element in String value

Parameters:
reader - the StAX reader
attributeName - the name of the attribute
Returns:
the string representing element
Throws:
XMLStreamException - StAX exception

attributeAsInt

protected Integer attributeAsInt(XMLStreamReader reader,
                                 String attributeName)
                          throws XMLStreamException
convert an xml element in String value

Parameters:
reader - the StAX reader
attributeName - the name of the attribute
Returns:
the string representing element
Throws:
XMLStreamException - StAX exception

elementAsInteger

protected Integer elementAsInteger(XMLStreamReader reader)
                            throws XMLStreamException,
                                   ParserException
convert an xml element in Integer value

Parameters:
reader - the StAX reader
Returns:
the integer representing element
Throws:
XMLStreamException - StAX exception
ParserException - in case it isn't a number

elementAsLong

protected Long elementAsLong(XMLStreamReader reader)
                      throws XMLStreamException,
                             ParserException
convert an xml element in Long value

Parameters:
reader - the StAX reader
Returns:
the long representing element
Throws:
XMLStreamException - StAX exception
ParserException - in case it isn't a number


Copyright © 2011 Red Hat Middleware LLC (http://www.jboss.com/)