public class JavaOutputProcessor extends AbstractProcessor<CtNamedElement> implements FileGenerator<CtNamedElement>
Constructor and Description |
---|
JavaOutputProcessor()
usedful for testing
|
JavaOutputProcessor(File outputDirectory,
PrettyPrinter printer)
Deprecated.
The outputDirectory should be get from the environment given to the pretty printer
(see
Environment.setSourceOutputDirectory(File) . You should use the constructor with only one parameter. |
JavaOutputProcessor(PrettyPrinter printer) |
Modifier and Type | Method and Description |
---|---|
void |
createJavaFile(CtType<?> element)
Creates the Java file associated to the given element.
|
List<File> |
getCreatedFiles()
Gets the created files.
|
Environment |
getEnvironment()
Gets the environment of this processor.
|
Map<String,Map<Integer,Integer>> |
getLineNumberMappings() |
File |
getOutputDirectory()
Gets the root directory where files are created.
|
PrettyPrinter |
getPrinter() |
TraversalStrategy |
getTraversalStrategy()
Gets the model's traversal strategy for this processor (default is
TraversalStrategy.POST_ORDER ). |
void |
init()
This method is upcalled to initialize the processor before each
processing round.
|
boolean |
isToBeProcessed(CtNamedElement candidate)
Tells if this element is to be processed (returns
true in
the default implementation). |
void |
process(CtNamedElement nameElement)
Creates a source file for each processed top-level type and pretty prints
its contents.
|
void |
setOutputDirectory(File directory)
Sets the root directory where files should be created.
|
addProcessedElementType, clearProcessedElementType, getFactory, getProcessedElementTypes, initProperties, interrupt, loadProperties, process, processingDone, removeProcessedElementType, setFactory
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getProcessedElementTypes, initProperties, interrupt, process, processingDone
getFactory, setFactory
public JavaOutputProcessor(PrettyPrinter printer)
printer
- the PrettyPrinter to use for written the files@Deprecated public JavaOutputProcessor(File outputDirectory, PrettyPrinter printer)
Environment.setSourceOutputDirectory(File)
. You should use the constructor with only one parameter.outputDirectory
- the root output directoryprinter
- the PrettyPrinter to use for written the filespublic JavaOutputProcessor()
public Environment getEnvironment()
Processor
getEnvironment
in interface Processor<CtNamedElement>
getEnvironment
in class AbstractProcessor<CtNamedElement>
public PrettyPrinter getPrinter()
public List<File> getCreatedFiles()
FileGenerator
getCreatedFiles
in interface FileGenerator<CtNamedElement>
public File getOutputDirectory()
FileGenerator
getOutputDirectory
in interface FileGenerator<CtNamedElement>
public void init()
Processor
init
in interface Processor<CtNamedElement>
init
in class AbstractProcessor<CtNamedElement>
public void createJavaFile(CtType<?> element)
public boolean isToBeProcessed(CtNamedElement candidate)
Processor
true
in
the default implementation).isToBeProcessed
in interface Processor<CtNamedElement>
isToBeProcessed
in class AbstractProcessor<CtNamedElement>
candidate
- the candidateProcessor.process(CtElement)
public void process(CtNamedElement nameElement)
process
in interface Processor<CtNamedElement>
nameElement
- the element that is currently being scannedpublic void setOutputDirectory(File directory)
FileGenerator
setOutputDirectory
in interface FileGenerator<CtNamedElement>
public TraversalStrategy getTraversalStrategy()
Processor
TraversalStrategy.POST_ORDER
). Programmers should override this
method to return another strategy if needed.getTraversalStrategy
in interface Processor<CtNamedElement>
getTraversalStrategy
in class AbstractProcessor<CtNamedElement>
Copyright © 2007–2018 Inria. All rights reserved.