/** * Adds a source file to the unit. */ public SourceUnit addSource(URL url) { return addSource(new SourceUnit(url, configuration, classLoader, getErrorCollector())); }
/** * Adds a source file to the unit. */ public SourceUnit addSource(File file) { return addSource(new SourceUnit(file, configuration, classLoader, getErrorCollector())); }
public SourceUnit addSource(String name, String scriptText) { return addSource(new SourceUnit(name, scriptText, configuration, classLoader, getErrorCollector())); }
/** * Adds a InputStream source to the unit. */ public SourceUnit addSource(String name, InputStream stream) { ReaderSource source = new InputStreamReaderSource(stream, configuration); return addSource(new SourceUnit(name, source, configuration, classLoader, getErrorCollector())); }
/** * A convenience routine to create a standalone SourceUnit on a String * with defaults for almost everything that is configurable. */ public static SourceUnit create(String name, String source, int tolerance) { CompilerConfiguration configuration = new CompilerConfiguration(); configuration.setTolerance(tolerance); return new SourceUnit(name, source, configuration, null, new ErrorCollector(configuration)); }
/** * A convenience routine to create a standalone SourceUnit on a String * with defaults for almost everything that is configurable. */ public static SourceUnit create(String name, String source) { CompilerConfiguration configuration = new CompilerConfiguration(); configuration.setTolerance(1); return new SourceUnit(name, source, configuration, null, new ErrorCollector(configuration)); }
/** * Compiles a string of code. */ public void compile( String name, String code ) throws CompilationFailedException { CompilationUnit unit = new CompilationUnit( configuration ); unit.addSource( new SourceUnit(name, code, configuration, unit.getClassLoader(), unit.getErrorCollector()) ); unit.compile(); }
CompilationUnit cu = new CompilationUnit(loader); CompilerConfiguration config = new CompilerConfiguration(); SourceUnit su = new SourceUnit(name + "wrapper", "", config, loader, new ErrorCollector(config)); cu.addSource(su); cu.compile(Phases.CONVERSION);
/** * Adds a source file to the unit. */ public SourceUnit addSource(File file) { return addSource(new SourceUnit(file, configuration, classLoader, getErrorCollector())); }
/** * Adds a source file to the unit. */ public SourceUnit addSource(File file) { return addSource(new SourceUnit(file, configuration, classLoader, getErrorCollector())); }
/** * Adds a source file to the unit. */ public SourceUnit addSource(File file) { return addSource(new SourceUnit(file, configuration, classLoader, getErrorCollector())); }
/** * Adds a source file to the unit. */ public SourceUnit addSource(File file) { return addSource(new SourceUnit(file, configuration, classLoader, getErrorCollector())); }
/** * Adds a source file to the unit. */ public SourceUnit addSource(URL url) { return addSource(new SourceUnit(url, configuration, classLoader, getErrorCollector())); }
/** * Adds a source file to the unit. */ public SourceUnit addSource(URL url) { return addSource(new SourceUnit(url, configuration, classLoader, getErrorCollector())); }
/** * Adds a source file to the unit. */ public SourceUnit addSource(URL url) { return addSource(new SourceUnit(url, configuration, classLoader, getErrorCollector())); }
/** * Adds a InputStream source to the unit. */ public SourceUnit addSource(String name, InputStream stream) { ReaderSource source = new InputStreamReaderSource(stream, configuration); return addSource(new SourceUnit(name, source, configuration, classLoader, getErrorCollector())); }
/** * Adds a InputStream source to the unit. */ public SourceUnit addSource(String name, InputStream stream) { ReaderSource source = new InputStreamReaderSource(stream, configuration); return addSource(new SourceUnit(name, source, configuration, classLoader, getErrorCollector())); }
/** * A convenience routine to create a standalone SourceUnit on a String * with defaults for almost everything that is configurable. */ public static SourceUnit create(String name, String source, int tolerance) { CompilerConfiguration configuration = new CompilerConfiguration(); configuration.setTolerance(tolerance); return new SourceUnit(name, source, configuration, null, new ErrorCollector(configuration)); }
/** * Compiles a string of code. */ public void compile( String name, String code ) throws CompilationFailedException { CompilationUnit unit = new CompilationUnit( configuration ); unit.addSource( new SourceUnit(name, code, configuration, unit.getClassLoader(), unit.getErrorCollector()) ); unit.compile(); }
/** * Compiles a string of code. */ public void compile( String name, String code ) throws CompilationFailedException { CompilationUnit unit = new CompilationUnit( configuration ); unit.addSource( new SourceUnit(name, code, configuration, unit.getClassLoader(), unit.getErrorCollector()) ); unit.compile(); }