All Downloads are FREE. Search and download functionalities are using the official Maven repository.

shz.core.tools.compile.StringBuilderJavaSource Maven / Gradle / Ivy

There is a newer version: 2024.0.2
Show newest version
package shz.core.tools.compile;

import javax.tools.SimpleJavaFileObject;
import java.net.URI;

public class StringBuilderJavaSource extends SimpleJavaFileObject {
    protected final StringBuilder code;

    public StringBuilderJavaSource(String name) {
        super(URI.create("string:///" + name.replace('.', '/') + Kind.SOURCE.extension), Kind.SOURCE);
        code = new StringBuilder();
    }

    @Override
    public CharSequence getCharContent(boolean ignoreEncodingErrors) {
        return code;
    }

    public void append(String str) {
        code.append(str).append('\n');
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy