org.jmonks.batch.io.flat
Class FixedWidthFlatFileFieldSpec

java.lang.Object
  extended byorg.jmonks.batch.io.FieldSpec
      extended byorg.jmonks.batch.io.flat.FixedWidthFlatFileFieldSpec

public class FixedWidthFlatFileFieldSpec
extends FieldSpec

FixedWidthFlatFileFieldSpec represents field-spec element in the record spec belongs to the fixed width flat file type. Along with the field-name attribute it looks for the start-pos and end-pos attributes in the field-spec element to retrieve the field from the record. Field name on field-spec should be unique across the record-spec. Position value starts with "1" in the record and the start-pos and end-pos values are inclusive. Here is a sample spec snippet...

      <file-spec file-type="fixed-width-flat">
          <record-spec record-type="detail" starts-with="5">
              <field-spec field-name="consumer-id" start-pos="2" end-pos="11"/>    
              <field-spec field-name="consumer-name" start-pos="12" end-pos="31"/>    
          </record-spec>
      </file-spec>
  

Since:
1.0
Version:
1.0
Author:
Suresh Pragada

Field Summary
static java.lang.String END_POSITION_ATTRIB_NAME
          Constant defines the end position attribute name.
static java.lang.String START_POSITION_ATTRIB_NAME
          Constant defines the start position attribute name.
 
Fields inherited from class org.jmonks.batch.io.FieldSpec
FIELD_NAME_ATTRIB_NAME, FIELD_SPEC_TAG_NAME, fieldName
 
Constructor Summary
protected FixedWidthFlatFileFieldSpec(java.lang.String fieldName)
          Creates a new instance of FixedWidthFlatFileFieldSpec by using field name.
 
Method Summary
static FixedWidthFlatFileFieldSpec createFixedWidthFlatFileFieldSpec(org.w3c.dom.Element fieldSpecElement)
          Factory method to create the FixedWidthFlatFileFieldSpec instance from the given DOM Element representing the filed-spec element in record spec.
 int getEndPosition()
          Gets the ending position of the field.
 int getFieldWidth()
          Gets the field width.
 int getStartPosition()
          Gets the starting position of the field.
 java.lang.String toString()
           
 
Methods inherited from class org.jmonks.batch.io.FieldSpec
getFieldName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

START_POSITION_ATTRIB_NAME

public static final java.lang.String START_POSITION_ATTRIB_NAME
Constant defines the start position attribute name.

See Also:
Constant Field Values

END_POSITION_ATTRIB_NAME

public static final java.lang.String END_POSITION_ATTRIB_NAME
Constant defines the end position attribute name.

See Also:
Constant Field Values
Constructor Detail

FixedWidthFlatFileFieldSpec

protected FixedWidthFlatFileFieldSpec(java.lang.String fieldName)
Creates a new instance of FixedWidthFlatFileFieldSpec by using field name.

Method Detail

getStartPosition

public int getStartPosition()
Gets the starting position of the field.


getEndPosition

public int getEndPosition()
Gets the ending position of the field.


getFieldWidth

public int getFieldWidth()
Gets the field width.


createFixedWidthFlatFileFieldSpec

public static FixedWidthFlatFileFieldSpec createFixedWidthFlatFileFieldSpec(org.w3c.dom.Element fieldSpecElement)
Factory method to create the FixedWidthFlatFileFieldSpec instance from the given DOM Element representing the filed-spec element in record spec.

Parameters:
fieldSpecElement - DOM Element representing the field-spec element.
Returns:
Returns the FixedWidthFlatFileFieldSpec instance.
Throws:
FileSpecException - If field-spec field-name values are not unique across record-spec.

toString

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