org.jmonks.batch.io.xml
Class XMLFileReader.XMLReaderRecord

java.lang.Object
  extended byorg.jmonks.batch.io.Record
      extended byorg.jmonks.batch.io.ReaderRecord
          extended byorg.jmonks.batch.io.xml.XMLFileReader.XMLReaderRecord
Enclosing class:
XMLFileReader

public class XMLFileReader.XMLReaderRecord
extends ReaderRecord

XMLReaderRecord implements ReaderRecord by maintaing the field names and values as a map and provides the methods with proper access privileges to read into and write from the record. It provides the additional method to conveniently read the data from the record.

Author:
Suresh Pragada

Method Summary
 ReaderRecord readComplexElement(java.lang.String elementName)
          Expectes the element as a nested/composite element and returns it as a reader record.
 java.lang.Object readField(java.lang.String fieldName)
          Reads the values associated with the given field name and returns.
 java.util.List readRepeatElement(java.lang.String elementName)
          Expectes the element as repeated element and returns it as a list.
 java.lang.String readSimpleElement(java.lang.String elementName)
          Expectes the element as a simple element and returns it as a string.
 java.lang.String toString()
           
 
Methods inherited from class org.jmonks.batch.io.Record
getRecordType
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

readField

public java.lang.Object readField(java.lang.String fieldName)
Reads the values associated with the given field name and returns. The return value will vary based on the element type in file. If it is a simple element it would be string, if it is a nested element it would reader record, it it is an element repeats multiple times it will be list. Use the other methods available on XMLReaderRecord for convenience.

Specified by:
readField in class ReaderRecord
Parameters:
fieldName - Name of the element.
Returns:
Returns the field value as object.

readSimpleElement

public java.lang.String readSimpleElement(java.lang.String elementName)
Expectes the element as a simple element and returns it as a string.

Parameters:
elementName - Name of the simple element.
Returns:
Returns the value associated with this element.

readComplexElement

public ReaderRecord readComplexElement(java.lang.String elementName)
Expectes the element as a nested/composite element and returns it as a reader record.

Parameters:
elementName - Name of the nested/composite element.
Returns:
Returns the value associated with this element.

readRepeatElement

public java.util.List readRepeatElement(java.lang.String elementName)
Expectes the element as repeated element and returns it as a list.

Parameters:
elementName - Name of the repeated element.
Returns:
Returns the value associated with this element.

toString

public java.lang.String toString()
See Also:
Object.toString()