本文整理了Java中groovy.lang.Script.getProperty()
方法的一些代码示例,展示了Script.getProperty()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Script.getProperty()
方法的具体详情如下:
包路径:groovy.lang.Script
类名称:Script
方法名:getProperty
暂无
代码示例来源:origin: jenkinsci/jenkins
@Override
public Object getProperty(String property) {
try {
return delegate.getProperty(property);
} catch (MissingPropertyException e) {
return super.getProperty(property);
}
}
代码示例来源:origin: org.codehaus.groovy/groovy
@Override
public Object getProperty(String property) {
try {
return metaClass.getProperty(delegate,property);
} catch (MissingPropertyException e) {
return super.getProperty(property);
}
}
代码示例来源:origin: spockframework/spock
@Override
public Object getProperty(String property) {
try {
return GroovyRuntimeUtil.getProperty($delegate, property);
} catch (MissingPropertyException e) {
return super.getProperty(property);
}
}
代码示例来源:origin: org.codehaus.groovy/groovy
@Override
public Object getProperty(final String property) {
try {
return InvokerHelper.getProperty(extension, property);
} catch (Exception e) {
return super.getProperty(property);
}
}
代码示例来源:origin: org.codehaus.groovy/groovy
/**
* Prints a newline to the current 'out' variable which should be a PrintWriter
* or at least have a println() method defined on it.
* If there is no 'out' property then print to standard out.
*/
public void println() {
Object object;
try {
object = getProperty("out");
} catch (MissingPropertyException e) {
System.out.println();
return;
}
InvokerHelper.invokeMethod(object, "println", ArgumentListExpression.EMPTY_ARRAY);
}
代码示例来源:origin: org.codehaus.groovy/groovy
/**
* Prints the value to the current 'out' variable which should be a PrintWriter
* or at least have a print() method defined on it.
* If there is no 'out' property then print to standard out.
*/
public void print(Object value) {
Object object;
try {
object = getProperty("out");
} catch (MissingPropertyException e) {
DefaultGroovyMethods.print(System.out,value);
return;
}
InvokerHelper.invokeMethod(object, "print", new Object[]{value});
}
代码示例来源:origin: org.codehaus.groovy/groovy
/**
* Prints the value and a newline to the current 'out' variable which should be a PrintWriter
* or at least have a println() method defined on it.
* If there is no 'out' property then print to standard out.
*/
public void println(Object value) {
Object object;
try {
object = getProperty("out");
} catch (MissingPropertyException e) {
DefaultGroovyMethods.println(System.out,value);
return;
}
InvokerHelper.invokeMethod(object, "println", new Object[]{value});
}
代码示例来源:origin: org.codehaus.groovy/groovy
/**
* Prints a formatted string using the specified format string and arguments.
*
* @param format the format to follow
* @param values an array of values to be formatted
*/
public void printf(String format, Object[] values) {
Object object;
try {
object = getProperty("out");
} catch (MissingPropertyException e) {
DefaultGroovyMethods.printf(System.out, format, values);
return;
}
InvokerHelper.invokeMethod(object, "printf", new Object[] { format, values });
}
代码示例来源:origin: org.codehaus.groovy/groovy
/**
* Prints a formatted string using the specified format string and argument.
*
* @param format the format to follow
* @param value the value to be formatted
*/
public void printf(String format, Object value) {
Object object;
try {
object = getProperty("out");
} catch (MissingPropertyException e) {
DefaultGroovyMethods.printf(System.out, format, value);
return;
}
InvokerHelper.invokeMethod(object, "printf", new Object[] { format, value });
}
代码示例来源:origin: org.codehaus.groovy/groovy
/**
* Invoke a method (or closure in the binding) defined.
*
* @param name method to call
* @param args arguments to pass to the method
* @return value
*/
public Object invokeMethod(String name, Object args) {
try {
return super.invokeMethod(name, args);
}
// if the method was not found in the current scope (the script's methods)
// let's try to see if there's a method closure with the same name in the binding
catch (MissingMethodException mme) {
try {
if (name.equals(mme.getMethod())) {
Object boundClosure = getProperty(name);
if (boundClosure instanceof Closure) {
return ((Closure) boundClosure).call((Object[])args);
} else {
throw mme;
}
} else {
throw mme;
}
} catch (MissingPropertyException mpe) {
throw mme;
}
}
}
代码示例来源:origin: org.codehaus.groovy/groovy
s.setProperty(lineCountName, ((BigInteger)s.getProperty(lineCountName)).add(BigInteger.ONE));
代码示例来源:origin: crashub/crash
@Override
public Object getProperty(String property) {
try {
return super.getProperty(property);
}
catch (MissingPropertyException e) {
return null;
}
}
}
代码示例来源:origin: groovy/groovy-core
public void testCreateScriptWithScriptClass() {
GroovyClassLoader classLoader = new GroovyClassLoader();
String controlProperty = "text";
String controlValue = "I am a script";
String code = controlProperty + " = '" + controlValue + "'";
GroovyCodeSource codeSource = new GroovyCodeSource(code, "testscript", "/groovy/shell");
Class scriptClass = classLoader.parseClass(codeSource, false);
Script script = InvokerHelper.createScript(scriptClass, new Binding(bindingVariables));
assertEquals(bindingVariables, script.getBinding().getVariables());
script.run();
assertEquals(controlValue, script.getProperty(controlProperty));
}
}
代码示例来源:origin: crashub/crash
@Override
public final Object getProperty(String property) {
if ("out".equals(property)) {
return ((InvocationContext<?>)context).getWriter();
} else if ("context".equals(property)) {
return context;
} else {
PipeLineClosure ret = Helper.resolveProperty(context, property);
if (ret != null) {
return ret;
}
try {
return super.getProperty(property);
}
catch (MissingPropertyException e) {
return null;
}
}
}
}
代码示例来源:origin: org.crashub/crash.shell
@Override
public Object getProperty(String property) {
try {
return super.getProperty(property);
}
catch (MissingPropertyException e) {
return null;
}
}
}
代码示例来源:origin: com.google.code.maven-play-plugin.org.playframework/play
@Override
public Object getProperty(String property) {
try {
if (property.equals("actionBridge")) {
return new ActionBridge(this);
}
return super.getProperty(property);
} catch (MissingPropertyException mpe) {
return null;
}
}
代码示例来源:origin: eu.mihosoft.vrl/vrl
@Override
protected void evaluationRequest(Script script) {
Object property = null;
if (getValueOptions() != null) {
if (getValueOptions().contains("xVarName")) {
property = script.getProperty("xVarName");
}
if (property != null) {
setxVarName((String) property);
}
}
}
代码示例来源:origin: eu.mihosoft.vrl/vrl
@Override
public Double run(Double x) {
getScript().setProperty(getXVarName(), x);
getScript().run();
return (Double) getScript().getProperty("result");
}
代码示例来源:origin: eu.mihosoft.vrl/vrl
@Override
public Double[] run(@ParamInfo(name="", style="array", options="") Double[] x) {
getScript().setProperty(getXVarName(), x);
getScript().run();
return (Double[]) getScript().getProperty("result");
}
代码示例来源:origin: eu.mihosoft.vrl/vrl
@Override
public Double run(Double x, Double y, Double z) {
getScript().setProperty(getXVarName(), x);
getScript().setProperty(getYVarName(), y);
getScript().setProperty(getZVarName(), z);
getScript().run();
return (Double) getScript().getProperty("result");
}
内容来源于网络,如有侵权,请联系作者删除!