dochelper
Class FileRecord

java.lang.Object
  extended by dochelper.FileRecord
All Implemented Interfaces:
Record
Direct Known Subclasses:
XINSFunctionRecord

public class FileRecord
extends java.lang.Object
implements Record

The class FileRecord implements Record to represent a single file in a set of files to be processed by DocHelper. It is responsible for returning file contents when needed and converting the file into output document content through the execution of the render function. This class implements the DocumentSection interface in order to provide encapsulation of the output generated.

See Also:
Record, DocumentSection

Field Summary
private  java.io.File file
          The file this File Record represents.
private  java.lang.String name
          Reference Name for this instance.
protected  java.util.HashMap<java.lang.String,java.lang.String> params
          The parameters associated to this fileRecord.
 
Constructor Summary
FileRecord(java.io.File file, java.lang.String name)
          Creates a New Instance of a File Record.
 
Method Summary
 ResultNode execute(java.util.ArrayList<DocPattern> patterns)
          Renders a record using the specified Pattern list.
 java.io.File getFile()
          Return the file reference.
 java.lang.String getValue()
          Get the value of a File Record.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

file

private java.io.File file
The file this File Record represents.


params

protected java.util.HashMap<java.lang.String,java.lang.String> params
The parameters associated to this fileRecord.


name

private java.lang.String name
Reference Name for this instance. Used to fetch info when rendering or processing.

Constructor Detail

FileRecord

public FileRecord(java.io.File file,
                  java.lang.String name)
Creates a New Instance of a File Record. Set paramters relevant for this Record

Parameters:
file -
name -
Method Detail

getValue

public java.lang.String getValue()
Get the value of a File Record. For this implementation this is the actual contents of the file. TODO: Change so that once the file is read it is not reloaded unless content has changed.

Specified by:
getValue in interface Record
Returns:
String contents of the file.

execute

public ResultNode execute(java.util.ArrayList<DocPattern> patterns)
Renders a record using the specified Pattern list. This method will iterate through all patterns passed in if any, and execute the pattern passing the contents of the file. This means the pattern will search for the RegExp within the file contents.

Specified by:
execute in interface Record
Parameters:
patterns - ArrayList list of pattern that should be used during the rendering process for this record.
Returns:
ResultNode containing the result of pattern execution.

getFile

public java.io.File getFile()
Return the file reference.

Returns:

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object