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

Method getValue

src/bsh/LHS.java:146–184  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

144 }
145
146 public Object getValue() throws UtilEvalError
147 {
148 if ( type == VARIABLE )
149 return nameSpace.getVariable( varName );
150
151 if (type == FIELD)
152 try {
153 Object o = field.get( object );
154 return Primitive.wrap( o, field.getType() );
155 } catch(IllegalAccessException e2) {
156 throw new UtilEvalError("Can't read field: " + field);
157 }
158
159 if ( type == PROPERTY )
160 {
161 // return the raw type here... we don't know what it's supposed
162 // to be...
163 CollectionManager cm = CollectionManager.getCollectionManager();
164 if ( cm.isMap( object ) )
165 return cm.getFromMap( object/*map*/, propName );
166 else
167 try {
168 return Reflect.getObjectProperty(object, propName);
169 } catch(ReflectError e) {
170 Interpreter.debug(e.getMessage());
171 throw new UtilEvalError("No such property: " + propName);
172 }
173 }
174
175 if ( type == INDEX )
176 try {
177 return Reflect.getIndex(object, index);
178 }
179 catch(Exception e) {
180 throw new UtilEvalError("Array access: " + e);
181 }
182
183 throw new InterpreterError("LHS type");
184 }
185
186 /**
187 Assign a value to the LHS.

Callers 11

evalMethod · 0.95
putAllMethod · 0.45
evaluateConditionMethod · 0.45
invokeMethod · 0.45
evalMethod · 0.45
lhsUnaryOperationMethod · 0.45
unwrapVariableMethod · 0.45
evalMethod · 0.45
doSuffixMethod · 0.45
castObjectMethod · 0.45
evalMethod · 0.45

Calls 11

wrapMethod · 0.95
getCollectionManagerMethod · 0.95
isMapMethod · 0.95
getFromMapMethod · 0.95
getObjectPropertyMethod · 0.95
debugMethod · 0.95
getIndexMethod · 0.95
getVariableMethod · 0.80
getMethod · 0.65
getTypeMethod · 0.45
getMessageMethod · 0.45

Tested by 1

evalMethod · 0.36