Java Code Examples for spoon.reflect.visitor.DefaultJavaPrettyPrinter

The following examples show how to use spoon.reflect.visitor.DefaultJavaPrettyPrinter. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: nopol   Source File:    License: GNU General Public License v2.0 6 votes vote down vote up
public SpoonedFile(File[] sourceFiles, NopolContext nopolContext) {
    this.nopolContext = nopolContext;
    this.sourceFiles = sourceFiles;
    this.projectClasspath = nopolContext.getProjectClasspath();

    factory = SpoonModelLibrary.newFactory();
    factory.getEnvironment().setLevel("OFF"); // no logs

    factory = SpoonModelLibrary.modelFor(factory, sourceFiles, projectClasspath());

    compiler = new DynamicClassCompiler(compilationClasspath(), nopolContext.getComplianceLevel());
    manager = new RuntimeProcessingManager(factory);
    compiledClasses = MetaMap.newHashMap();
    prettyPrinter = new DefaultJavaPrettyPrinter(spoonEnvironment());
Example 2
Source Project: astor   Source File:    License: GNU General Public License v2.0 5 votes vote down vote up
public void updateOutput(String output) {
	getEnvironment().setSourceOutputDirectory(new File(output));
	JavaOutputProcessor fileOutput = new JavaOutputProcessor(new DefaultJavaPrettyPrinter(getEnvironment()));

	this.javaPrinter = fileOutput;
Example 3
Source Project: gumtree-spoon-ast-diff   Source File:    License: Apache License 2.0 5 votes vote down vote up
private String partialElementPrint(CtElement element) {
	DefaultJavaPrettyPrinter print = new DefaultJavaPrettyPrinter(element.getFactory().getEnvironment()) {
		public DefaultJavaPrettyPrinter scan(CtElement e) {
			if (e != null && e.getMetadata("isMoved") == null) {
				return super.scan(e);
			return this;

	return print.getResult();
Example 4
Source Project: nopol   Source File:    License: GNU General Public License v2.0 4 votes vote down vote up
protected DefaultJavaPrettyPrinter prettyPrinter() {
    return prettyPrinter;