本文整理了Java中groovy.lang.Script.getMetaClass()
方法的一些代码示例,展示了Script.getMetaClass()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Script.getMetaClass()
方法的具体详情如下:
包路径:groovy.lang.Script
类名称:Script
方法名:getMetaClass
暂无
代码示例来源: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
MetaClass oldMetaClass = scriptObject.getMetaClass();
代码示例来源:origin: apache/tinkerpop
final MetaClass oldMetaClass = scriptObject.getMetaClass();
scriptObject.setMetaClass(new DelegatingMetaClass(oldMetaClass) {
@Override
代码示例来源:origin: org.codehaus.groovy/groovy-jsr223
MetaClass oldMetaClass = scriptObject.getMetaClass();
代码示例来源:origin: info.cukes/cucumber-groovy
private boolean isScript(Script script) {
return DefaultGroovyMethods.asBoolean(script.getMetaClass().respondsTo(script, "main"));
}
代码示例来源:origin: info.cukes/cucumber-groovy
private void runIfScript(Binding context, Script script) {
Class scriptClass = script.getMetaClass().getTheClass();
if (isScript(script) && !scripts.contains(scriptClass)) {
script.setBinding(context);
script.run();
scripts.add(scriptClass);
}
}
代码示例来源: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: 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.apache.tinkerpop/gremlin-groovy
final MetaClass oldMetaClass = scriptObject.getMetaClass();
scriptObject.setMetaClass(new DelegatingMetaClass(oldMetaClass) {
@Override
代码示例来源: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: com.tinkerpop/gremlin-groovy
});
final MetaClass oldMetaClass = scriptObject.getMetaClass();
scriptObject.setMetaClass(new DelegatingMetaClass(oldMetaClass) {
@Override
代码示例来源:origin: org.scijava/scripting-groovy
final MetaClass oldMetaClass = scriptObject.getMetaClass();
代码示例来源:origin: org.kohsuke.droovy/groovy
MetaClass oldMetaClass = scriptObject.getMetaClass();
代码示例来源:origin: org.codehaus.groovy/groovy-jdk14
MetaClass oldMetaClass = scriptObject.getMetaClass();
代码示例来源:origin: com.thinkaurelius.groovy-shaded-asm/groovy-shaded-asm
MetaClass oldMetaClass = scriptObject.getMetaClass();
代码示例来源:origin: zycgit/hasor
globalClosures.put(name, new MethodClosure(scriptObject, name));
MetaClass oldMetaClass = scriptObject.getMetaClass();
内容来源于网络,如有侵权,请联系作者删除!