co.uk.hjcs.canyon.parsing
Class FixedLengthFieldFlatFileProcessor

java.lang.Object
  extended by co.uk.hjcs.canyon.parsing.FixedLengthFieldFlatFileProcessor
All Implemented Interfaces:
FlatFileProcessor

public class FixedLengthFieldFlatFileProcessor
extends java.lang.Object
implements FlatFileProcessor

This class is responsible for the reading and creation of fixed length field text. It uses the field definitions it is given to determine how a line of text should be parsed or created. Any missing definitions are represented as blank spaces, or the padding character defined in the configuration.

Author:
HJC Solutions Ltd (http://canyon.hjcsolutions.co.uk)

Field Summary
 
Fields inherited from interface co.uk.hjcs.canyon.parsing.FlatFileProcessor
CLASS_ELEMENT_NAME, CLASS_ID_ELEMENT_NAME, CLASS_NAME_ATTRIBUTE, CLASS_TYPE_ATTRIBUTE_NAME, FIELD_ELEMENT_NAME, FIELD_NAME_ATTRIBUTE_NAME
 
Constructor Summary
FixedLengthFieldFlatFileProcessor(java.util.List<FieldDefinition> fields)
           
 
Method Summary
 java.lang.String createLine(FlatFileLine ffl)
          convert the FlatFileLine details into the construct that the flat file is exepcting.
 FlatFileLine createLine(java.lang.String lineData)
          Create a FlatFileLine object from a string of data
 FixedLengthFieldDefinition getField(java.lang.String fieldName)
          Retrieves the defintion of a field by name
 java.util.Set<FieldDefinition> getFields()
          Retrieves a Set of all the registered field definitions
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FixedLengthFieldFlatFileProcessor

public FixedLengthFieldFlatFileProcessor(java.util.List<FieldDefinition> fields)
Method Detail

createLine

public java.lang.String createLine(FlatFileLine ffl)
Description copied from interface: FlatFileProcessor
convert the FlatFileLine details into the construct that the flat file is exepcting. E.g creates the flat file line

Specified by:
createLine in interface FlatFileProcessor
Parameters:
ffl - - the FlatFileLine to be turned into a String
Returns:
- the output string representation of this flat file line

getField

public FixedLengthFieldDefinition getField(java.lang.String fieldName)
Description copied from interface: FlatFileProcessor
Retrieves the defintion of a field by name

Specified by:
getField in interface FlatFileProcessor
Parameters:
fieldName - - the name of the field
Returns:
- the field definition of the named field

getFields

public java.util.Set<FieldDefinition> getFields()
Description copied from interface: FlatFileProcessor
Retrieves a Set of all the registered field definitions

Specified by:
getFields in interface FlatFileProcessor
Returns:
- all the field definitions for the flat file line

createLine

public FlatFileLine createLine(java.lang.String lineData)
Description copied from interface: FlatFileProcessor
Create a FlatFileLine object from a string of data

Specified by:
createLine in interface FlatFileProcessor
Parameters:
lineData - - the data to be used to create the FlatFileLine object
Returns:
- the line resultset row for the lineData