public Object invokeMethod(String name, Object args) { return this.metaClass.invokeMethod(this, name, args); }
@Override public Object getProperty(String property) { try { return delegate.getProperty(property); } catch (MissingPropertyException e) { return super.getProperty(property); } }
public void setProperty(String property, Object newValue) { this.metaClass.setProperty(this, property, newValue); }
/** * When a method argument is only a closure it is a set of bean definitions. * @param callable the closure argument * @return this {@code GroovyBeanDefinitionReader} instance */ protected GroovyBeanDefinitionReader invokeBeanDefiningClosure(Closure callable) { callable.setDelegate(this); callable.call(); finalizeDeferredProperties(); return this; }
/** * compiles the Groovy source code * * @param sFilterCode * @return * @throws org.codehaus.groovy.control.CompilationFailedException * */ public Class compileGroovy(String sFilterCode) throws org.codehaus.groovy.control.CompilationFailedException { GroovyClassLoader loader = new GroovyClassLoader(); return loader.parseClass(sFilterCode); }
/** * @return a new GroovyClassLoader */ GroovyClassLoader getGroovyClassLoader() { return new GroovyClassLoader(); }
/** * Can be used to customize the environment in which the script runs. */ protected GroovyShell createShell() { return new GroovyShell(loader, bindings); }
@Override public void setVariable(String name, Object value) { if (currentBeanDefinition != null) { applyPropertyToBeanDefinition(name, value); } else { super.setVariable(name, value); } } };
@Override public Object invokeMethod(String name, Object args) { try { return delegate.invokeMethod(name,args); } catch (MissingMethodException mme) { return super.invokeMethod(name, args); } }
@Override public void setProperty(String property, Object newValue) { try { delegate.setProperty(property,newValue); } catch (MissingPropertyException e) { super.setProperty(property,newValue); } } }
/** * Sets the binding (the variables available in the scope of the BeanBuilder) * @param b The Binding instance */ public void setBinding(Binding b) { this.binding = b.getVariables(); }
public GroovyHookScript bind(String name, Object o) { bindings.setProperty(name,o); return this; }
@Override public void customize(GroovyObject goo) { DelegatingMetaClass dmc = new DelegatingMetaClass(goo.getMetaClass()) { @Override public Object invokeMethod(Object arg0, String mName, Object[] arg2) { if (mName.contains("Missing")) { throw new IllegalStateException("Gotcha"); } else { return super.invokeMethod(arg0, mName, arg2); } } }; dmc.initialize(); goo.setMetaClass(dmc); } }
public Object invokeMethod(String name, Object args) { return this.metaClass.invokeMethod(this, name, args); }
public void setProperty(String property, Object newValue) { if (newValue instanceof BeanDefinition) { registerBeanDefinition(property, (BeanDefinition) newValue); } else { this.metaClass.setProperty(this, property, newValue); } }
/** * Build a {@link GroovyClassLoader} for the given {@code ClassLoader}. * @param classLoader the ClassLoader to build a GroovyClassLoader for * @since 4.3.3 */ protected GroovyClassLoader buildGroovyClassLoader(@Nullable ClassLoader classLoader) { return (this.compilerConfiguration != null ? new GroovyClassLoader(classLoader, this.compilerConfiguration) : new GroovyClassLoader(classLoader)); }
public Object invokeMethod(String name, Object args) { return this.metaClass.invokeMethod(this, name, args); }
/** * @return a new GroovyClassLoader */ GroovyClassLoader getGroovyClassLoader() { return new GroovyClassLoader(); }
public Object invokeMethod(String name, Object args) { return this.metaClass.invokeMethod(this, name, args); }