org.jmonks.batch.io.flat
Class DelimitedFlatFileRecordSpec

java.lang.Object
  extended byorg.jmonks.batch.io.RecordSpec
      extended byorg.jmonks.batch.io.flat.DelimitedFlatFileRecordSpec

public class DelimitedFlatFileRecordSpec
extends RecordSpec

DelimitedFlatFileRecordSpec represents record-spec element in the file spec belongs to the delimited flat file type. Along with the record-type attribute it looks for the two additional attributes delimiter and field-count. Attribute delimiter tells the value that divides or delimits the fields and attribute field-count tells the number of fields exists in the record. There should be only one record spec is allowed in this file spec. Here is a sample spec snippet...

      <file-spec file-type="delimited-flat">
          <record-spec record-type="detail" delimiter="|"  field-count="4">
              <!-- field specs will follow here -->
          </record-spec>
      </file-spec>
  

Since:
1.0
Version:
1.0
Author:
Suresh Pragada

Field Summary
static java.lang.String DELIMITER_ATTRIB_NAME
          Constant defines the delimiter attribute name which the value is "delimiter"
static java.lang.String FIELD_COUNT_ATTRIB_NAME
          Constant defines the field count attribute name which the value is "field-count"
 
Fields inherited from class org.jmonks.batch.io.RecordSpec
fieldSpecList, RECORD_SPEC_TAG_NAME, RECORD_TYPE_ATTRIB_NAME, recordType
 
Constructor Summary
protected DelimitedFlatFileRecordSpec(RecordType recordType)
          Constructs the record spec by accepting the record type.
 
Method Summary
static DelimitedFlatFileRecordSpec createDelimitedFlatFileRecordSpec(org.w3c.dom.Element recordSpecElement)
          Factory method to create the delimited flat record spec from the given DOM Element representing the record-spec element in the file spec.
 java.lang.String getDelimiter()
          Returns the delimiter which divides the fields in the record.
 int getFieldCount()
          Returns the number of fields exists in this record.
 java.lang.String toString()
           
 
Methods inherited from class org.jmonks.batch.io.RecordSpec
addFieldSpec, getFieldSpecs, getRecordType
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DELIMITER_ATTRIB_NAME

public static final java.lang.String DELIMITER_ATTRIB_NAME
Constant defines the delimiter attribute name which the value is "delimiter"

See Also:
Constant Field Values

FIELD_COUNT_ATTRIB_NAME

public static final java.lang.String FIELD_COUNT_ATTRIB_NAME
Constant defines the field count attribute name which the value is "field-count"

See Also:
Constant Field Values
Constructor Detail

DelimitedFlatFileRecordSpec

protected DelimitedFlatFileRecordSpec(RecordType recordType)
Constructs the record spec by accepting the record type.

Method Detail

getDelimiter

public java.lang.String getDelimiter()
Returns the delimiter which divides the fields in the record.


getFieldCount

public int getFieldCount()
Returns the number of fields exists in this record.


createDelimitedFlatFileRecordSpec

public static DelimitedFlatFileRecordSpec createDelimitedFlatFileRecordSpec(org.w3c.dom.Element recordSpecElement)
Factory method to create the delimited flat record spec from the given DOM Element representing the record-spec element in the file spec.

Parameters:
recordSpecElement - DOM Element representing the record spec.
Returns:
Returns the delimited flat file record spec.
Throws:
FileSpecException - If record-spec doesnt have the delimiter or record-type attribute or index value is repeated on more than one field spec.

toString

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