示例#1
0
  /**
   * Impl of the Context.put() method.
   *
   * @param key name of item to set
   * @param value object to set to key
   * @return old stored object
   */
  public Object put(String key, Object value) {
    /*
     *  first see if this is a vmpa
     */

    VMProxyArg vmpa = (VMProxyArg) vmproxyhash.get(key);

    if (vmpa != null) {
      return vmpa.setObject(wrappedContext, value);
    } else {
      if (localcontextscope) {
        /*
         *  if we have localcontextscope mode, then just
         *  put in the local context
         */

        return localcontext.put(key, value);
      } else {
        /*
         *  ok, how about the local context?
         */

        if (localcontext.containsKey(key)) {
          return localcontext.put(key, value);
        } else {
          /*
           * otherwise, let them push it into the 'global' context
           */

          return innerContext.put(key, value);
        }
      }
    }
  }
 /**
  * Put method also stores values in parent context
  *
  * @param key name of item to set
  * @param value object to set to key
  * @return old stored object
  */
 public Object put(String key, Object value) {
   /*
    * just put in the local context
    */
   return innerContext.put(key, value);
 }
 /**
  * @see
  *     org.apache.velocity.context.InternalWrapperContext#localPut(java.lang.String,java.lang.Object)
  */
 public Object localPut(final String key, final Object value) {
   return innerContext.put(key, value);
 }