groovy.lang.GroovyResourceLoader Java Examples

The following examples show how to use groovy.lang.GroovyResourceLoader. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: GroovyScriptEngine.java    From groovy with Apache License 2.0 6 votes vote down vote up
private void setResLoader() {
    final GroovyResourceLoader rl = getResourceLoader();
    setResourceLoader(className -> {
        String filename;
        for (String extension : getConfig().getScriptExtensions()) {
            filename = className.replace('.', File.separatorChar) + "." + extension;
            try {
                URLConnection dependentScriptConn = rc.getResourceConnection(filename);
                return dependentScriptConn.getURL();
            } catch (ResourceException e) {
                //TODO: maybe do something here?
            }
        }
        return rl.loadGroovySource(className);
    });
}
 
Example #2
Source File: ClassNodeCache.java    From netbeans with Apache License 2.0 4 votes vote down vote up
@Override
public GroovyResourceLoader getResourceLoader() {
    return resourceLoader;
}