shz.core.tools.compile.StringBuilderJavaSource Maven / Gradle / Ivy
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