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

Method set

src/bsh/Interpreter.java:876–895  ·  view source on GitHub ↗

Assign the value to the name. name may evaluate to anything assignable. e.g. a variable or field.

( String name, Object value )

Source from the content-addressed store, hash-verified

874 name may evaluate to anything assignable. e.g. a variable or field.
875 */
876 public void set( String name, Object value )
877 throws EvalError
878 {
879 // map null to Primtive.NULL coming in...
880 if ( value == null )
881 value = Primitive.NULL;
882
883 CallStack callstack = new CallStack();
884 try {
885 if ( Name.isCompound( name ) )
886 {
887 LHS lhs = globalNameSpace.getNameResolver( name ).toLHS(
888 callstack, this );
889 lhs.assign( value, false );
890 } else // optimization for common case
891 globalNameSpace.setVariable( name, value, false );
892 } catch ( UtilEvalError e ) {
893 throw e.toEvalError( SimpleNode.JAVACODE, callstack );
894 }
895 }
896
897 /**
898 Unchecked set for internal use

Calls 6

isCompoundMethod · 0.95
assignMethod · 0.95
getNameResolverMethod · 0.80
toLHSMethod · 0.45
setVariableMethod · 0.45
toEvalErrorMethod · 0.45