package com.brilliance.isc.esb.compiler;

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

public class JavaFileObjectFromString extends SimpleJavaFileObject {

    private final String code;
    public JavaFileObjectFromString(String classname, String code) {
        super(URI.create("string:///"+classname+Kind.SOURCE.extension), Kind.SOURCE);
        this.code = code;
    }

    @Override
    public CharSequence getCharContent(boolean b) throws IOException {
        return code;
    }
}
