org.teatrove.tea.util
Class AbstractCompiler.AbstractUnit

java.lang.Object
  extended by org.teatrove.tea.compiler.CompilationUnit
      extended by org.teatrove.tea.util.AbstractCompiler.AbstractUnit
All Implemented Interfaces:
EventListener, ErrorListener
Direct Known Subclasses:
FileCompiler.FileUnit
Enclosing class:
AbstractCompiler

public abstract class AbstractCompiler.AbstractUnit
extends CompilationUnit


Field Summary
protected  File mDestDir
           
protected  File mDestFile
           
protected  String mDotPath
           
protected  String mSourceFileName
           
protected  String mSourceFilePath
           
 
Constructor Summary
protected AbstractCompiler.AbstractUnit(String name, Compiler compiler)
           
 
Method Summary
protected  String getClassName()
           
protected  String getClassName(String innerClass)
           
 File getDestinationFile()
           
protected  long getDestinationLastModified()
           
protected abstract  long getLastModified()
           
 OutputStream getOutputStream()
           
 Reader getReader()
           
 String getSourceFileName()
           
 String getTargetPackage()
          Return the package name that this CompilationUnit should be compiled into.
protected abstract  InputStream getTemplateSource(String templateSourceName)
           
 void resetOutputStream()
          Reset the output stream cleaning up or removing any files created as part of the output stream.
 boolean shouldCompile()
           
protected  boolean shouldCompile(long timestamp)
           
 
Methods inherited from class org.teatrove.tea.compiler.CompilationUnit
compileError, getCompiler, getErrorCount, getImportedPackages, getName, getParseTree, getRuntimeContext, getShortName, setParseTree, signatureEquals
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

mSourceFilePath

protected String mSourceFilePath

mSourceFileName

protected String mSourceFileName

mDotPath

protected String mDotPath

mDestDir

protected File mDestDir

mDestFile

protected File mDestFile
Constructor Detail

AbstractCompiler.AbstractUnit

protected AbstractCompiler.AbstractUnit(String name,
                                        Compiler compiler)
Method Detail

getTargetPackage

public String getTargetPackage()
Description copied from class: CompilationUnit
Return the package name that this CompilationUnit should be compiled into. Default implementation returns null, or no package.

Overrides:
getTargetPackage in class CompilationUnit

getSourceFileName

public String getSourceFileName()
Specified by:
getSourceFileName in class CompilationUnit

getReader

public Reader getReader()
                 throws IOException
Specified by:
getReader in class CompilationUnit
Returns:
A new source file reader.
Throws:
IOException

shouldCompile

public boolean shouldCompile()
Overrides:
shouldCompile in class CompilationUnit
Returns:
true if the CompilationUnit should be compiled. Default is true.

shouldCompile

protected boolean shouldCompile(long timestamp)

getLastModified

protected abstract long getLastModified()

getDestinationLastModified

protected long getDestinationLastModified()

getDestinationFile

public File getDestinationFile()
Returns:
the file that gets written by the compiler.

getOutputStream

public OutputStream getOutputStream()
                             throws IOException
Specified by:
getOutputStream in class CompilationUnit
Returns:
An OutputStream to write compiled code to. Returning null is disables code generation for this CompilationUnit.
Throws:
IOException

resetOutputStream

public void resetOutputStream()
Description copied from class: CompilationUnit
Reset the output stream cleaning up or removing any files created as part of the output stream. This is generally used when an exception occurs during code generation to the output stream.

Specified by:
resetOutputStream in class CompilationUnit

getClassName

protected String getClassName()

getClassName

protected String getClassName(String innerClass)

getTemplateSource

protected abstract InputStream getTemplateSource(String templateSourceName)
                                          throws IOException
Throws:
IOException


Copyright © 1997-2012 TeaTrove.org. All Rights Reserved.