Java 8 Compilable - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 Compilable class.

This code example shows how to use the following methods:compile
     */ 
    protected CompiledScript getCompiledScript(String content, Compilable engine) throws ScriptException
    { 
        // TODO: add caching 
 
        return engine.compile(content);
    } 
} 
4
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:compile
            // pre-compile script if we have it as text 
            if (reader != null) {
                ScriptEngine engine = this.scriptEngineFactory.getScriptEngine();
                if (engine instanceof Compilable) {
                    Compilable compilable = (Compilable) engine;
                    this.compiledScript = compilable.compile(scriptText);
                    LOG.debug("Using compiled script: {}", this.compiledScript);
                } 
            } 
        } catch (IOException e) {
            throw new ScriptEvaluationException("Cannot load " + scriptLanguage + " script from resource: " + scriptResource, e);
        } catch (ScriptException e) {
            throw new ScriptEvaluationException("Error compiling " + scriptLanguage + " script: " + scriptText, e);
        } finally { 
            IOHelper.close(reader);
        } 
    } 
 
    @Override 
    public String toString() {
4
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:compile
        if (scriptEngine == null)
            throw new InvalidRequestException(String.format("Invalid language '%s' for function '%s'", language, name));
 
        try 
        { 
            this.script = scriptEngine.compile(body);
        } 
        catch (RuntimeException | ScriptException e)
        { 
            logger.info("Failed to compile function '{}' for language {}: ", name, language, e);
            throw new InvalidRequestException( 
                    String.format("Failed to compile function '%s' for language %s: %s", name, language, e));
        } 
    } 
 
    public ByteBuffer execute(List<ByteBuffer> parameters) throws InvalidRequestException
    { 
        Object[] params = new Object[argTypes.size()]; 
        for (int i = 0; i < params.length; i++)
        { 
4
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:compile
        compiledScript = null;
        errorsInScript = null;
        try { 
            scriptSource.rereadFile();
            compileTimeStrategy.scriptCompileStart();
            compiledScript = engine.compile(scriptSource.getScript());
            compileTimeStrategy.scriptCompiled();
        } 
        catch (Throwable e) {
            errorsInScript = e;
            throw e;
        } 
    } 
 
    private static ScriptEngine findScriptEngine(String scriptEngineName) {
        final ScriptEngineManager manager = getScriptEngineManager();
        return checkNotNull(manager.getEngineByName(scriptEngineName), "name", scriptEngineName);
    } 
 
    private static ScriptEngine findScriptEngine(File scriptFile) {
4
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:compile
            if (engine == null) {
                throw new IllegalArgumentException("The script type is not supported for language: " + language);
            } 
            try { 
                Compilable compilableEngine = (Compilable) engine;
                compiledScript = compilableEngine.compile(script);
                if (Debug.verboseOn()) {
                    Debug.logVerbose("Compiled script [" + script + "] using engine " + engine.getClass().getName(), module);
                } 
            } catch (ClassCastException e) {
                if (Debug.verboseOn()) {
                    Debug.logVerbose("Script engine " + engine.getClass().getName() + " does not implement Compilable", module);
                } 
            } 
            if (compiledScript != null) {
                parsedScripts.putIfAbsent(cacheKey, compiledScript);
            } 
        } 
        return compiledScript;
    } 
3
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:compile
     */ 
    private void compileAndCache(String scriptId, String script) throws ScriptException
    { 
        if ( compiler_ != null )
        { 
            CompiledScript compiledScript = compiler_.compile(script);
            calloutCache_.put(scriptId, compiledScript);
        } 
    } 
     
    /** 
     * Invoked on start up to load all the stored callouts, compile 
     * and cache them. 
     *  
     * @throws IOException 
     */ 
    void onStart() throws IOExceptionString location = DatabaseDescriptor.getCalloutLocation();
    	if ( location == null )
3
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:compile
    public IExpression compile(String source) {
        if (source == null || source.length() == 0) {
            throw new ExpressionParseException("expression can't be empty!"); 
        } 
        try { 
            CompiledScript jsScript = compiler.compile(source);
            return new ScriptExpression(jsScript, source);
        } catch(Throwable t) {
            throw new ExpressionParseException(source, t);
        } 
    } 
     
} 
3
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:compile
        } 
        if (engine instanceof Compilable) {
            Compilable comp = (Compilable) engine;
            try { 
                try { 
                    return comp.compile(reader);
                } finally { 
                    reader.close();
                } 
            } catch (IOException e) {
                throw new ScriptException(e);
            } 
        } else {// TODO this will read sources twice the fist time - pass 
                // reader? 
            return new FakeCompiledScript(engine, this);
        } 
    } 
 
    // FIXME: make a proper test and remove. 
    public static void main(String[] args) throws Exception {
4
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:compile
        } 
        if (engine instanceof Compilable) {
            Compilable comp = (Compilable) engine;
            try { 
                try { 
                    return comp.compile(reader);
                } finally { 
                    reader.close();
                } 
            } catch (IOException e) {
                throw new ScriptException(e);
            } 
        } else {// TODO this will read sources twice the fist time - pass 
                // reader? 
            return new FakeCompiledScript(engine, this);
        } 
    } 
 
    // FIXME: make a proper test and remove. 
    public static void main(String[] args) throws Exception {
3
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
See Code Examples for Java 8 Compilable Methods: