MCPcopy Index your code
hub / github.com/beanshell/beanshell / apply

Method apply

bsf/src/bsh/util/BeanShellBSFEngine.java:130–175  ·  view source on GitHub ↗
(
		String source, int lineNo, int columnNo, Object funcBody, 
		Vector namesVec, Vector argsVec )

Source from the content-addressed store, hash-verified

128 upcoming release and would not require special support here.
129 */
130 public Object apply (
131 String source, int lineNo, int columnNo, Object funcBody,
132 Vector namesVec, Vector argsVec )
133 throws BSFException
134 {
135 if ( namesVec.size() != argsVec.size() )
136 throw new BSFException("number of params/names mismatch");
137 if ( !(funcBody instanceof String) )
138 throw new BSFException("apply: functino body must be a string");
139
140 String [] names = new String [ namesVec.size() ];
141 namesVec.copyInto(names);
142 Object [] args = new Object [ argsVec.size() ];
143 argsVec.copyInto(args);
144
145 try
146 {
147 if ( !installedApplyMethod )
148 {
149 interpreter.eval( bsfApplyMethod );
150 installedApplyMethod = true;
151 }
152
153 bsh.This global = (bsh.This)interpreter.get("global");
154 Object value = global.invokeMethod(
155 "_bsfApply", new Object [] { names, args, (String)funcBody } );
156 return Primitive.unwrap( value );
157
158 } catch ( InterpreterError e )
159 {
160 throw new BSFException(
161 "BeanShell interpreter internal error: "+e
162 + sourceInfo(source,lineNo,columnNo) );
163 } catch ( TargetError e2 )
164 {
165 throw new BSFException(
166 "The application script threw an exception: "
167 + e2.getTarget()
168 + sourceInfo(source,lineNo,columnNo) );
169 } catch ( EvalError e3 )
170 {
171 throw new BSFException(
172 "BeanShell script error: "+e3
173 + sourceInfo(source,lineNo,columnNo) );
174 }
175 }
176
177 public Object eval (
178 String source, int lineNo, int columnNo, Object expr)

Callers 1

mainMethod · 0.80

Calls 7

unwrapMethod · 0.95
sourceInfoMethod · 0.95
getTargetMethod · 0.80
evalMethod · 0.65
getMethod · 0.65
sizeMethod · 0.45
invokeMethodMethod · 0.45

Tested by 1

mainMethod · 0.64