co.uk.hjcs.canyon.parsing
Class DelimitedFieldFlatFileProcessor

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

public class DelimitedFieldFlatFileProcessor
extends java.lang.Object
implements FlatFileProcessor

This class is responsible for the reading and creation of delimited 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 empty fields.

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

Field Summary
static java.lang.String DELIMITER_ATTRIBUTE_NAME
           
static java.lang.String POSITION_ATTRIBUTE_NAME
           
 
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
DelimitedFieldFlatFileProcessor(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
 DelimitedFieldDefinition 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
 

Field Detail

DELIMITER_ATTRIBUTE_NAME

public static final java.lang.String DELIMITER_ATTRIBUTE_NAME
See Also:
Constant Field Values

POSITION_ATTRIBUTE_NAME

public static final java.lang.String POSITION_ATTRIBUTE_NAME
See Also:
Constant Field Values
Constructor Detail

DelimitedFieldFlatFileProcessor

public DelimitedFieldFlatFileProcessor(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 DelimitedFieldDefinition 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