org.millscript.millscript.functions
Class AbstractOutputFileFunction

java.lang.Object
  extended by org.millscript.millscript.functions.Function
      extended by org.millscript.millscript.functions.AbstractOutputFunction
          extended by org.millscript.millscript.functions.AbstractOutputFileFunction
Direct Known Subclasses:
DatafileFunction, HtmlFileFunction, HtmlFragmentFileFunction, ImageFileFunction, LinesFileFunction, NewPageFunction, PropertiesFileFunction, StringFileFunction, XmlFileFunction, XmlFragmentFileFunction, XsltFileFunction, XsltFragmentFileFunction

public abstract class AbstractOutputFileFunction
extends AbstractOutputFunction

This class provides the basic methods required for a function generating files in the script output.


Field Summary
 
Fields inherited from class org.millscript.millscript.functions.AbstractOutputFunction
config
 
Constructor Summary
protected AbstractOutputFileFunction(Package pack)
          Constructs a new abstract output file function for the specified package.
 
Method Summary
static boolean addNewPage(java.lang.String stem)
          Adds the specified stem as a unique page of script output.
abstract  java.lang.String getDefaultExtension()
          Returns the default extension for this type of file.
 Page newPage(org.millscript.commons.util.IList folder, java.lang.String name, java.lang.String extn)
          Returns a new Page for a file with the specified name and extension, to be made in the specified folder.
 Page newPage(java.lang.String name)
          Returns a new Page for a file with the specified name and default extension for this function, to be made in the current working output folder.
 Page newPage(java.lang.String name, java.lang.String extn)
          Returns a new Page for a file with the specified name and extension, to be made in the current working output folder.
 Page toPage(java.lang.Object obj)
          Returns a Page for the specified object.
 
Methods inherited from class org.millscript.millscript.functions.AbstractOutputFunction
getCurrentWorkingFolder, getCurrentWorkingFolderList, getWorkingFolder, makeCurrentWorkingFolder
 
Methods inherited from class org.millscript.millscript.functions.Function
apply, applyUpdater, checkNargs, checkNargsGT, checkUNargs, getName, modName, reportNargsError, reportNargsGTError, setName, toString, tryClone
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AbstractOutputFileFunction

protected AbstractOutputFileFunction(Package pack)
Constructs a new abstract output file function for the specified package.

Parameters:
pack - the package this function belongs to
Method Detail

addNewPage

public static final boolean addNewPage(java.lang.String stem)
Adds the specified stem as a unique page of script output. This method will return true if the stem doesn't already exist in the script output. Subsequent calls to this method with the same stem will return false.

Parameters:
stem - the new stem to try and add to the script output
Returns:
true if the stem does not already exist and false otherwise

getDefaultExtension

public abstract java.lang.String getDefaultExtension()
Returns the default extension for this type of file.

Returns:
the default extension for this type of file as a String

newPage

public final Page newPage(java.lang.String name)
Returns a new Page for a file with the specified name and default extension for this function, to be made in the current working output folder.

Parameters:
name - the new file name
Returns:
a Page for the specified output file

newPage

public final Page newPage(java.lang.String name,
                          java.lang.String extn)
Returns a new Page for a file with the specified name and extension, to be made in the current working output folder.

Parameters:
name - the new file name
extn - the new file name extension
Returns:
a Page for the specified output file

newPage

public final Page newPage(org.millscript.commons.util.IList folder,
                          java.lang.String name,
                          java.lang.String extn)
Returns a new Page for a file with the specified name and extension, to be made in the specified folder. If a page has already been made for the specified file, a new unique filename will be found and a Page object returned for this new filename.

Parameters:
folder - the folder for the new file
name - the new file name
extn - the new file name extension
Returns:
a Page for the specified output file

toPage

public final Page toPage(java.lang.Object obj)
Returns a Page for the specified object. If the object is already a Page it will be returned, otherwise the object is considered to be a filename.

Parameters:
obj - the object to convert to a Page
Returns:
a Page for the specified object


Copyright © 2001-2007 Open World Ltd. All Rights Reserved.