org.jomc.tools
Class SourceFileProcessor

Package class diagram package SourceFileProcessor
java.lang.Object
  extended by org.jomc.tools.JomcTool
      extended by org.jomc.tools.SourceFileProcessor

public class SourceFileProcessor
extends JomcTool

Processes source code files.

Use cases

Version:
$Id: SourceFileProcessor.java 1562 2010-03-07 01:06:40Z schulte2005 $
Author:
Christian Schulte

Nested Class Summary
 class SourceFileProcessor.SourceFileEditor
          Extension to SectionEditor adding support for editing source code files.
 
Nested classes/interfaces inherited from class org.jomc.tools.JomcTool
JomcTool.Listener
 
Constructor Summary
SourceFileProcessor()
          Creates a new SourceFileProcessor instance.
SourceFileProcessor(SourceFileProcessor tool)
          Creates a new SourceFileProcessor instance taking a SourceFileProcessor instance to initialize the instance with.
 
Method Summary
 char getIndentationCharacter()
          Gets the indentation character.
 SourceFileProcessor.SourceFileEditor getSourceFileEditor(org.jomc.model.Implementation implementation)
          Gets a new editor for editing the source file of a given implementation.
 SourceFileProcessor.SourceFileEditor getSourceFileEditor(org.jomc.model.Specification specification)
          Gets a new editor for editing the source file of a given specification.
 SourceFilesType getSourceFilesType()
          Gets the source files model of the instance.
 SourceFileType getSourceFileType(org.jomc.model.Implementation implementation)
          Gets the model of an implementation source file.
 SourceFileType getSourceFileType(org.jomc.model.Specification specification)
          Gets the model of a specification source file.
 org.apache.velocity.VelocityContext getVelocityContext()
          Gets the velocity context used for merging templates.
 int getWhitespacesPerIndent()
          Gets the number of whitespace characters per indentation level.
 void manageSourceFiles(File sourcesDirectory)
          Manages the source files of the modules of the instance.
 void manageSourceFiles(org.jomc.model.Implementation implementation, File sourcesDirectory)
          Manages the source file of a given implementation of the modules of the instance.
 void manageSourceFiles(org.jomc.model.Module module, File sourcesDirectory)
          Manages the source files of a given module of the modules of the instance.
 void manageSourceFiles(org.jomc.model.Specification specification, File sourcesDirectory)
          Manages the source file of a given specification of the modules of the instance.
 void setIndentationCharacter(char value)
          Sets the indentation character.
 void setWhitespacesPerIndent(int value)
          Sets the number of whitespace characters per indentation level.
 
Methods inherited from class org.jomc.tools.JomcTool
getDefaultLogLevel, getDisplayLanguage, getInputEncoding, getJavaClasspathLocation, getJavaClasspathLocation, getJavadocComment, getJavaGetterMethodName, getJavaGetterMethodName, getJavaGetterMethodName, getJavaInterfaceNames, getJavaModifierName, getJavaModifierName, getJavaModifierName, getJavaPackageName, getJavaPackageName, getJavaPackageName, getJavaString, getJavaTypeName, getJavaTypeName, getJavaTypeName, getJavaTypeName, getJavaTypeName, getJavaTypeName, getListeners, getLogLevel, getLongDate, getLongDateTime, getLongTime, getModules, getOutputEncoding, getProfile, getShortDate, getShortDateTime, getShortTime, getTemplateEncoding, getVelocityEngine, getVelocityTemplate, getYears, isJavaDefaultPackage, isJavaDefaultPackage, isJavaPrimitiveType, isLoggable, log, setDefaultLogLevel, setInputEncoding, setLogLevel, setModules, setOutputEncoding, setProfile, setTemplateEncoding, setVelocityEngine
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SourceFileProcessor

public SourceFileProcessor()
Creates a new SourceFileProcessor instance.


SourceFileProcessor

public SourceFileProcessor(SourceFileProcessor tool)
                    throws IOException
Creates a new SourceFileProcessor instance taking a SourceFileProcessor instance to initialize the instance with.

Parameters:
tool - The instance to initialize the new instance with,
Throws:
NullPointerException - if tool is null.
IOException - if copying tool fails.
Method Detail

getWhitespacesPerIndent

public int getWhitespacesPerIndent()
Gets the number of whitespace characters per indentation level.

Returns:
The number of whitespace characters per indentation level.

setWhitespacesPerIndent

public void setWhitespacesPerIndent(int value)
Sets the number of whitespace characters per indentation level.

Parameters:
value - The new number of whitespace characters per indentation level.

getIndentationCharacter

public char getIndentationCharacter()
Gets the indentation character.

Returns:
The indentation character.

setIndentationCharacter

public void setIndentationCharacter(char value)
Sets the indentation character.

Parameters:
value - The new indentation character.

getSourceFilesType

public SourceFilesType getSourceFilesType()
Gets the source files model of the instance.

This accessor method returns a reference to the live object, not a snapshot. Therefore any modification you make to the returned object will be present inside the object. This is why there is no set method.

Returns:
The source files model of the instance.
See Also:
getSourceFileType(org.jomc.model.Specification), getSourceFileType(org.jomc.model.Implementation)

getSourceFileType

public SourceFileType getSourceFileType(org.jomc.model.Specification specification)
Gets the model of a specification source file.

Parameters:
specification - The specification to get a source file model for.
Returns:
The source file model for specification.
Throws:
NullPointerException - if specification is null.
See Also:
getSourceFilesType()

getSourceFileType

public SourceFileType getSourceFileType(org.jomc.model.Implementation implementation)
Gets the model of an implementation source file.

Parameters:
implementation - The implementation to get a source file model for.
Returns:
The source file model for implementation.
Throws:
NullPointerException - if implementation is null.
See Also:
getSourceFilesType()

manageSourceFiles

public void manageSourceFiles(File sourcesDirectory)
                       throws IOException
Manages the source files of the modules of the instance.

Parameters:
sourcesDirectory - The directory holding the source files to manage.
Throws:
NullPointerException - if sourcesDirectory is null.
IOException - if managing source files fails.
See Also:
manageSourceFiles(org.jomc.model.Module, java.io.File)

manageSourceFiles

public void manageSourceFiles(org.jomc.model.Module module,
                              File sourcesDirectory)
                       throws IOException
Manages the source files of a given module of the modules of the instance.

Parameters:
module - The module to process.
sourcesDirectory - The directory holding the source files to manage.
Throws:
NullPointerException - if module or sourcesDirectory is null.
IOException - if managing source files fails.
See Also:
manageSourceFiles(org.jomc.model.Specification, java.io.File), manageSourceFiles(org.jomc.model.Implementation, java.io.File)

manageSourceFiles

public void manageSourceFiles(org.jomc.model.Specification specification,
                              File sourcesDirectory)
                       throws IOException
Manages the source file of a given specification of the modules of the instance.

Parameters:
specification - The specification to process.
sourcesDirectory - The directory holding the source files to manage.
Throws:
NullPointerException - if specification or sourcesDirectory is null.
IOException - if managing source files fails.
See Also:
getSourceFileEditor(org.jomc.model.Specification)

manageSourceFiles

public void manageSourceFiles(org.jomc.model.Implementation implementation,
                              File sourcesDirectory)
                       throws IOException
Manages the source file of a given implementation of the modules of the instance.

Parameters:
implementation - The implementation to process.
sourcesDirectory - The directory holding the source files to manage.
Throws:
NullPointerException - if implementation or sourcesDirectory is null.
IOException - if managing source files fails.
See Also:
getSourceFileEditor(org.jomc.model.Implementation)

getSourceFileEditor

public SourceFileProcessor.SourceFileEditor getSourceFileEditor(org.jomc.model.Specification specification)
Gets a new editor for editing the source file of a given specification.

Parameters:
specification - The specification whose source file to edit.
Returns:
A new editor for editing the source file of specification.
Throws:
NullPointerException - if specification is null.

getSourceFileEditor

public SourceFileProcessor.SourceFileEditor getSourceFileEditor(org.jomc.model.Implementation implementation)
Gets a new editor for editing the source file of a given implementation.

Parameters:
implementation - The implementation whose source file to edit.
Returns:
A new editor for editing the source file of implementation.
Throws:
NullPointerException - if implementation is null.

getVelocityContext

public org.apache.velocity.VelocityContext getVelocityContext()
Gets the velocity context used for merging templates.

Overrides:
getVelocityContext in class JomcTool
Returns:
The velocity context used for merging templates.


Copyright © 2005-2010 The JOMC Project. All Rights Reserved.