org.jomc.tools
Class SourceFileProcessor.SourceFileEditor

Package class diagram package SourceFileProcessor.SourceFileEditor
java.lang.Object
  extended by org.jomc.util.LineEditor
      extended by org.jomc.util.SectionEditor
          extended by org.jomc.tools.SourceFileProcessor.SourceFileEditor
Enclosing class:
SourceFileProcessor

public class SourceFileProcessor.SourceFileEditor
extends SectionEditor

Extension to SectionEditor adding support for editing source code files.

Version:
$JOMC: SourceFileProcessor.java 4352 2012-03-01 11:19:48Z schulte2005 $
Author:
Christian Schulte
See Also:
edit(org.jomc.model.Specification, org.jomc.tools.model.SourceFileType, java.io.File), edit(org.jomc.model.Implementation, org.jomc.tools.model.SourceFileType, java.io.File)

Constructor Summary
SourceFileProcessor.SourceFileEditor()
          Creates a new SourceFileEditor instance.
SourceFileProcessor.SourceFileEditor(Implementation implementation)
          Deprecated. As of JOMC 1.2, please use method edit(org.jomc.model.Implementation, org.jomc.tools.model.SourceFileType, java.io.File). This constructor will be removed in version 2.0.
SourceFileProcessor.SourceFileEditor(Implementation implementation, LineEditor lineEditor)
          Deprecated. As of JOMC 1.2, please use method edit(org.jomc.model.Implementation, org.jomc.tools.model.SourceFileType, java.io.File). This constructor will be removed in version 2.0.
SourceFileProcessor.SourceFileEditor(Implementation implementation, LineEditor lineEditor, String lineSeparator)
          Deprecated. As of JOMC 1.2, please use method edit(org.jomc.model.Implementation, org.jomc.tools.model.SourceFileType, java.io.File). This constructor will be removed in version 2.0.
SourceFileProcessor.SourceFileEditor(Implementation implementation, String lineSeparator)
          Deprecated. As of JOMC 1.2, please use method edit(org.jomc.model.Implementation, org.jomc.tools.model.SourceFileType, java.io.File). This constructor will be removed in version 2.0.
SourceFileProcessor.SourceFileEditor(LineEditor editor)
          Creates a new SourceFileEditor instance taking an editor to chain.
SourceFileProcessor.SourceFileEditor(LineEditor editor, String lineSeparator)
          Creates a new SourceFileEditor instance taking an editor to chain and a string to use for separating lines.
SourceFileProcessor.SourceFileEditor(Specification specification)
          Deprecated. As of JOMC 1.2, please use method edit(org.jomc.model.Specification, org.jomc.tools.model.SourceFileType, java.io.File). This constructor will be removed in version 2.0.
SourceFileProcessor.SourceFileEditor(Specification specification, LineEditor lineEditor)
          Deprecated. As of JOMC 1.2, please use method edit(org.jomc.model.Specification, org.jomc.tools.model.SourceFileType, java.io.File). This constructor will be removed in version 2.0.
SourceFileProcessor.SourceFileEditor(Specification specification, LineEditor lineEditor, String lineSeparator)
          Deprecated. As of JOMC 1.2, please use method edit(org.jomc.model.Specification, org.jomc.tools.model.SourceFileType, java.io.File). This constructor will be removed in version 2.0.
SourceFileProcessor.SourceFileEditor(Specification specification, String lineSeparator)
          Deprecated. As of JOMC 1.2, please use method edit(org.jomc.model.Specification, org.jomc.tools.model.SourceFileType, java.io.File). This constructor will be removed in version 2.0.
SourceFileProcessor.SourceFileEditor(String lineSeparator)
          Creates a new SourceFileEditor instance taking a string to use for separating lines.
 
Method Summary
 void edit(Implementation implementation, SourceFileType sourceFileType, File sourcesDirectory)
          Edits a source file of a given implementation.
 void edit(Specification specification, SourceFileType sourceFileType, File sourcesDirectory)
          Edits a source file of a given specification.
protected  void editSection(Section s)
           This method searches the model of the source file for a section matching s and updates properties headContent and tailContent of s according to the templates declared in the model as returned by method getSourceFileType.
 List<Section> getAddedSections()
          Deprecated. As of JOMC 1.2, deprecated without replacement. This method will be removed in version 2.0.
protected  String getOutput(Section section)
           This method creates any sections declared in the model of the source file as returned by method getSourceFileType prior to rendering the output of the editor.
protected  SourceFileType getSourceFileType()
          Deprecated. As of JOMC 1.2, deprecated without replacement. This method will be removed in version 2.0.
 List<Section> getUnknownSections()
          Deprecated. As of JOMC 1.2, deprecated without replacement. This method will be removed in version 2.0.
protected  VelocityContext getVelocityContext()
          Deprecated. As of JOMC 1.2, deprecated without replacement. This method will be removed in version 2.0.
 
Methods inherited from class org.jomc.util.SectionEditor
editLine, getSection, isSectionFinished, isSectionPresent
 
Methods inherited from class org.jomc.util.LineEditor
edit, getLineNumber, getLineSeparator
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SourceFileProcessor.SourceFileEditor

public SourceFileProcessor.SourceFileEditor()
Creates a new SourceFileEditor instance.

Since:
1.2

SourceFileProcessor.SourceFileEditor

public SourceFileProcessor.SourceFileEditor(String lineSeparator)
Creates a new SourceFileEditor instance taking a string to use for separating lines.

Parameters:
lineSeparator - String to use for separating lines.
Since:
1.2

SourceFileProcessor.SourceFileEditor

public SourceFileProcessor.SourceFileEditor(LineEditor editor)
Creates a new SourceFileEditor instance taking an editor to chain.

Parameters:
editor - The editor to chain.
Since:
1.2

SourceFileProcessor.SourceFileEditor

public SourceFileProcessor.SourceFileEditor(LineEditor editor,
                                            String lineSeparator)
Creates a new SourceFileEditor instance taking an editor to chain and a string to use for separating lines.

Parameters:
editor - The editor to chain.
lineSeparator - String to use for separating lines.
Since:
1.2

SourceFileProcessor.SourceFileEditor

@Deprecated
public SourceFileProcessor.SourceFileEditor(Specification specification)
Deprecated. As of JOMC 1.2, please use method edit(org.jomc.model.Specification, org.jomc.tools.model.SourceFileType, java.io.File). This constructor will be removed in version 2.0.

Creates a new SourceFileEditor taking a Specification to edit source code of.

Parameters:
specification - The specification to edit source code of.

SourceFileProcessor.SourceFileEditor

@Deprecated
public SourceFileProcessor.SourceFileEditor(Specification specification,
                                                       String lineSeparator)
Deprecated. As of JOMC 1.2, please use method edit(org.jomc.model.Specification, org.jomc.tools.model.SourceFileType, java.io.File). This constructor will be removed in version 2.0.

Creates a new SourceFileEditor taking a Specification to edit source code of and a line separator.

Parameters:
specification - The specification to edit source code of.
lineSeparator - The line separator of the editor.

SourceFileProcessor.SourceFileEditor

@Deprecated
public SourceFileProcessor.SourceFileEditor(Specification specification,
                                                       LineEditor lineEditor)
Deprecated. As of JOMC 1.2, please use method edit(org.jomc.model.Specification, org.jomc.tools.model.SourceFileType, java.io.File). This constructor will be removed in version 2.0.

Creates a new SourceFileEditor taking a Specification to edit source code of and an editor to chain.

Parameters:
specification - The specification backing the editor.
lineEditor - The editor to chain.

SourceFileProcessor.SourceFileEditor

@Deprecated
public SourceFileProcessor.SourceFileEditor(Specification specification,
                                                       LineEditor lineEditor,
                                                       String lineSeparator)
Deprecated. As of JOMC 1.2, please use method edit(org.jomc.model.Specification, org.jomc.tools.model.SourceFileType, java.io.File). This constructor will be removed in version 2.0.

Creates a new SourceFileEditor taking a Specification to edit source code of, an editor to chain and a line separator.

Parameters:
specification - The specification backing the editor.
lineEditor - The editor to chain.
lineSeparator - The line separator of the editor.

SourceFileProcessor.SourceFileEditor

@Deprecated
public SourceFileProcessor.SourceFileEditor(Implementation implementation)
Deprecated. As of JOMC 1.2, please use method edit(org.jomc.model.Implementation, org.jomc.tools.model.SourceFileType, java.io.File). This constructor will be removed in version 2.0.

Creates a new SourceFileEditor taking an Implementation to edit source code of.

Parameters:
implementation - The implementation to edit source code of.

SourceFileProcessor.SourceFileEditor

@Deprecated
public SourceFileProcessor.SourceFileEditor(Implementation implementation,
                                                       String lineSeparator)
Deprecated. As of JOMC 1.2, please use method edit(org.jomc.model.Implementation, org.jomc.tools.model.SourceFileType, java.io.File). This constructor will be removed in version 2.0.

Creates a new SourceFileEditor taking an Implementation to edit source code of and a line separator.

Parameters:
implementation - The implementation to edit source code of.
lineSeparator - The line separator of the editor.

SourceFileProcessor.SourceFileEditor

@Deprecated
public SourceFileProcessor.SourceFileEditor(Implementation implementation,
                                                       LineEditor lineEditor)
Deprecated. As of JOMC 1.2, please use method edit(org.jomc.model.Implementation, org.jomc.tools.model.SourceFileType, java.io.File). This constructor will be removed in version 2.0.

Creates a new SourceFileEditor taking an Implementation to edit source code of and an editor to chain.

Parameters:
implementation - The implementation to edit source code of.
lineEditor - The editor to chain.

SourceFileProcessor.SourceFileEditor

@Deprecated
public SourceFileProcessor.SourceFileEditor(Implementation implementation,
                                                       LineEditor lineEditor,
                                                       String lineSeparator)
Deprecated. As of JOMC 1.2, please use method edit(org.jomc.model.Implementation, org.jomc.tools.model.SourceFileType, java.io.File). This constructor will be removed in version 2.0.

Creates a new SourceFileEditor taking an Implementation to edit source code of, an editor to chain and a line separator.

Parameters:
implementation - The implementation to edit source code of.
lineEditor - The editor to chain.
lineSeparator - The line separator of the editor.
Method Detail

edit

public final void edit(Specification specification,
                       SourceFileType sourceFileType,
                       File sourcesDirectory)
                throws IOException
Edits a source file of a given specification.

Parameters:
specification - The specification to edit a source file of.
sourceFileType - The model of the source file to edit.
sourcesDirectory - The directory holding the source file to edit.
Throws:
NullPointerException - if specification, sourceFileType or sourcesDirectory is null.
IOException - if editing fails.
Since:
1.2

edit

public final void edit(Implementation implementation,
                       SourceFileType sourceFileType,
                       File sourcesDirectory)
                throws IOException
Edits a source file of a given implementation.

Parameters:
implementation - The implementation to edit a source file of.
sourceFileType - The model of the source file to edit.
sourcesDirectory - The directory holding the source file to edit.
Throws:
NullPointerException - if implementation, sourceFileType or sourcesDirectory is null.
IOException - if editing fails.
Since:
1.2

getAddedSections

@Deprecated
public List<Section> getAddedSections()
Deprecated. As of JOMC 1.2, deprecated without replacement. This method will be removed in version 2.0.

Gets a list of sections added to the input.

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

Returns:
A list of sections added to the input.

getUnknownSections

@Deprecated
public List<Section> getUnknownSections()
Deprecated. As of JOMC 1.2, deprecated without replacement. This method will be removed in version 2.0.

Gets a list of sections without corresponding model entry.

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

Returns:
A list of sections without corresponding model entry.

getSourceFileType

@Deprecated
protected SourceFileType getSourceFileType()
Deprecated. As of JOMC 1.2, deprecated without replacement. This method will be removed in version 2.0.

Gets the currently edited source code file.

Returns:
The currently edited source code file.

getVelocityContext

@Deprecated
protected VelocityContext getVelocityContext()
Deprecated. As of JOMC 1.2, deprecated without replacement. This method will be removed in version 2.0.

Gets a new velocity context used for merging templates.

Returns:
A new velocity context used for merging templates.

getOutput

protected String getOutput(Section section)
                    throws IOException

This method creates any sections declared in the model of the source file as returned by method getSourceFileType prior to rendering the output of the editor.

Overrides:
getOutput in class SectionEditor
Parameters:
section - The section to start rendering the editor's output with.
Throws:
IOException
See Also:
createSection(java.lang.String, java.lang.String, org.jomc.tools.model.SourceSectionType)

editSection

protected void editSection(Section s)
                    throws IOException

This method searches the model of the source file for a section matching s and updates properties headContent and tailContent of s according to the templates declared in the model as returned by method getSourceFileType.

Overrides:
editSection in class SectionEditor
Parameters:
s - The section to edit.
Throws:
IOException


Copyright © 2005-2012 The JOMC Project. All Rights Reserved.Get JOMC at SourceForge.net. Fast, secure and Free Open Source software downloads
Please note that this documentation is maintained by non-native english speaking authors. As such, you may encounter phrases or wordings which seem imprecise or may even have a totally different meaning to native english speaking readers than what the individual author was trying to express. If you are a native english speaking reader and find any such phrases or wordings we kindly ask you to send an email to the corresponding author and help us improve this documentation in order to avoid misunderstandings. You will find the authors' email addresses at the top of each class. Please accept our apologies for any inconvenience caused.