/// <summary> /// Gets the value for the specified key in the <code>ENGINE_SCOPE</code> of the /// protected <code>context</code> field. /// </summary> /// <returns> The value for the specified key. /// </returns> /// <exception cref="NullPointerException"> if key is null. </exception> /// <exception cref="IllegalArgumentException"> if key is empty. </exception> public virtual object Get(string key) { IBindings nn = GetBindings(ScriptContext_Fields.ENGINE_SCOPE); if (nn != null) { return(nn.Get(key)); } return(null); }
/// <summary> /// Gets the value of an attribute in a given scope. /// </summary> /// <param name="name"> The name of the attribute to retrieve. </param> /// <param name="scope"> The scope in which to retrieve the attribute. </param> /// <returns> The value of the attribute. Returns <code>null</code> is the name /// does not exist in the given scope. /// </returns> /// <exception cref="IllegalArgumentException"> /// if the name is empty or if the value of scope is invalid. </exception> /// <exception cref="NullPointerException"> if the name is null. </exception> public virtual object GetAttribute(string name, int scope) { switch (scope) { case ScriptContext_Fields.ENGINE_SCOPE: return(engineScope.Get(name)); case ScriptContext_Fields.GLOBAL_SCOPE: if (globalScope != null) { return(globalScope.Get(name)); } return(null); default: throw new System.ArgumentException("Illegal scope value."); } }
/// <summary> /// Dedicated implementation which does not fall back on the <seealso cref="#calculateBindingMap()"/> for performance reasons /// </summary> public virtual object Get(string key) { object result = null; if (wrappedBindings.ContainsKey(key)) { result = wrappedBindings.Get(key); } else { if (key is string) { ITypedValue resolvedValue = variableContext.Resolve((string)key); result = Unpack(resolvedValue); } } return(result); }
public virtual object Get(string key) { object result = null; if (wrappedBindings.ContainsKey((string)key)) { result = wrappedBindings.Get((string)key); } else { foreach (IResolver scriptResolver in scriptResolvers) { if (scriptResolver.ContainsKey(key)) { result = scriptResolver.Get(key); } } } return(result); }
public Object Get(String key) { return(globalScope.Get(key)); }