本文整理了Java中groovy.lang.Script.setMetaClass()
方法的一些代码示例,展示了Script.setMetaClass()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Script.setMetaClass()
方法的具体详情如下:
包路径:groovy.lang.Script
类名称:Script
方法名:setMetaClass
暂无
代码示例来源:origin: org.codehaus.groovy/groovy
public void setProperty(String property, Object newValue) {
if ("binding".equals(property))
setBinding((Binding) newValue);
else if("metaClass".equals(property))
setMetaClass((MetaClass)newValue);
else
binding.setVariable(property, newValue);
}
代码示例来源:origin: org.codehaus.groovy/groovy
public Object build(Script script) {
// this used to be synchronized, but we also used to remove the
// metaclass. Since adding the metaclass is now a side effect, we
// don't need to ensure the meta-class won't be observed and don't
// need to hide the side effect.
MetaClass scriptMetaClass = script.getMetaClass();
script.setMetaClass(new FactoryInterceptorMetaClass(scriptMetaClass, this));
script.setBinding(this);
Object oldScriptName = getProxyBuilder().getVariables().get(SCRIPT_CLASS_NAME);
try {
getProxyBuilder().setVariable(SCRIPT_CLASS_NAME, script.getClass().getName());
return script.run();
} finally {
if(oldScriptName != null) {
getProxyBuilder().setVariable(SCRIPT_CLASS_NAME, oldScriptName);
} else {
getProxyBuilder().getVariables().remove(SCRIPT_CLASS_NAME);
}
}
}
代码示例来源:origin: apache/groovy
scriptObject.setMetaClass(new DelegatingMetaClass(oldMetaClass) {
@Override
public Object invokeMethod(Object object, String name, Object args) {
代码示例来源:origin: apache/tinkerpop
scriptObject.setMetaClass(new DelegatingMetaClass(oldMetaClass) {
@Override
public Object invokeMethod(final Object object, final String name, final Object args) {
代码示例来源:origin: org.codehaus.groovy/groovy-jsr223
scriptObject.setMetaClass(new DelegatingMetaClass(oldMetaClass) {
@Override
public Object invokeMethod(Object object, String name, Object args) {
代码示例来源:origin: org.kohsuke.droovy/groovy
public void setProperty(String property, Object newValue) {
if ("binding".equals(property))
setBinding((Binding) newValue);
else if("metaClass".equals(property))
setMetaClass((MetaClass)newValue);
else
binding.setVariable(property, newValue);
}
代码示例来源:origin: org.codehaus.groovy/groovy-jdk14
public void setProperty(String property, Object newValue) {
if ("binding".equals(property))
setBinding((Binding) newValue);
else if("metaClass".equals(property))
setMetaClass((MetaClass)newValue);
else
binding.setVariable(property, newValue);
}
代码示例来源:origin: org.codehaus.groovy/groovy-all-minimal
public void setProperty(String property, Object newValue) {
if ("binding".equals(property))
setBinding((Binding) newValue);
else if("metaClass".equals(property))
setMetaClass((MetaClass)newValue);
else
binding.setVariable(property, newValue);
}
代码示例来源:origin: com.thinkaurelius.groovy-shaded-asm/groovy-shaded-asm
public void setProperty(String property, Object newValue) {
if ("binding".equals(property))
setBinding((Binding) newValue);
else if("metaClass".equals(property))
setMetaClass((MetaClass)newValue);
else
binding.setVariable(property, newValue);
}
代码示例来源:origin: org.codehaus.groovy/groovy-all-minimal
public Object build(Script script) {
synchronized (script) {
MetaClass scriptMetaClass = script.getMetaClass();
try {
script.setMetaClass(new FactoryInterceptorMetaClass(scriptMetaClass, this));
script.setBinding(this);
return script.run();
} finally {
script.setMetaClass(scriptMetaClass);
}
}
}
代码示例来源:origin: org.codehaus.groovy/groovy-jdk14
public Object build(Script script) {
// this used to be synchronized, but we also used to remove the
// metaclass. Since adding the metaclass is now a side effect, we
// don't need to ensure the meta-class won't be observed and don't
// need to hide the side effect.
MetaClass scriptMetaClass = script.getMetaClass();
script.setMetaClass(new FactoryInterceptorMetaClass(scriptMetaClass, this));
script.setBinding(this);
return script.run();
}
代码示例来源:origin: org.kohsuke.droovy/groovy
public Object build(Script script) {
// this used to be synchronized, but we also used to remove the
// metaclass. Since adding the metaclass is now a side effect, we
// don't need to ensure the meta-class won't be observed and don't
// need to hide the side effect.
MetaClass scriptMetaClass = script.getMetaClass();
script.setMetaClass(new FactoryInterceptorMetaClass(scriptMetaClass, this));
script.setBinding(this);
return script.run();
}
代码示例来源:origin: com.thinkaurelius.groovy-shaded-asm/groovy-shaded-asm
public Object build(Script script) {
// this used to be synchronized, but we also used to remove the
// metaclass. Since adding the metaclass is now a side effect, we
// don't need to ensure the meta-class won't be observed and don't
// need to hide the side effect.
MetaClass scriptMetaClass = script.getMetaClass();
script.setMetaClass(new FactoryInterceptorMetaClass(scriptMetaClass, this));
script.setBinding(this);
Object oldScriptName = getProxyBuilder().getVariables().get(SCRIPT_CLASS_NAME);
try {
getProxyBuilder().setVariable(SCRIPT_CLASS_NAME, script.getClass().getName());
return script.run();
} finally {
if(oldScriptName != null) {
getProxyBuilder().setVariable(SCRIPT_CLASS_NAME, oldScriptName);
} else {
getProxyBuilder().getVariables().remove(SCRIPT_CLASS_NAME);
}
}
}
代码示例来源:origin: org.apache.tinkerpop/gremlin-groovy
scriptObject.setMetaClass(new DelegatingMetaClass(oldMetaClass) {
@Override
public Object invokeMethod(final Object object, final String name, final Object args) {
代码示例来源:origin: org.scijava/scripting-groovy
scriptObject.setMetaClass(new DelegatingMetaClass(oldMetaClass) {
代码示例来源:origin: com.tinkerpop/gremlin-groovy
scriptObject.setMetaClass(new DelegatingMetaClass(oldMetaClass) {
@Override
public Object invokeMethod(Object object, String name, Object args) {
代码示例来源:origin: org.kohsuke.droovy/groovy
scriptObject.setMetaClass(new DelegatingMetaClass(oldMetaClass) {
@Override
public Object invokeMethod(Object object, String name, Object args) {
代码示例来源:origin: org.codehaus.groovy/groovy-jdk14
scriptObject.setMetaClass(new DelegatingMetaClass(oldMetaClass) {
@Override
public Object invokeMethod(Object object, String name, Object args) {
代码示例来源:origin: com.thinkaurelius.groovy-shaded-asm/groovy-shaded-asm
scriptObject.setMetaClass(new DelegatingMetaClass(oldMetaClass) {
@Override
public Object invokeMethod(Object object, String name, Object args) {
代码示例来源:origin: zycgit/hasor
scriptObject.setMetaClass(new DelegatingMetaClass(oldMetaClass) {
@Override
public Object invokeMethod(Object object, String name, Object args) {
内容来源于网络,如有侵权,请联系作者删除!