package org.mdkt.compiler; import javax.tools.SimpleJavaFileObject; import java.io.IOException; import java.net.URI; /** * Created by trung on 5/3/15. */ public class SourceCode extends SimpleJavaFileObject { private String contents = null; public SourceCode(String className, String contents) throws Exception { super(URI.create("string:///" + className.replace('.', '/') + Kind.SOURCE.extension), Kind.SOURCE); this.contents = contents; } public CharSequence getCharContent(boolean ignoreEncodingErrors) throws IOException { return contents; } }