示例#1
0
        /**
         *      Returns OgnlRuntime.NotFound if the property does not exist.
         */
        public object getPossibleProperty(IDictionary context, object target, string name)          // throws OgnlException
        {
            object      result;
            OgnlContext ognlContext = (OgnlContext)context;

            if (context [("_compile")] != null)
            {
                Getter getter = getGetter(ognlContext, target, name);

                if (getter != NotFoundGetter)
                {
                    result = getter.get(ognlContext, target, name);
                }
                else
                {
                    try
                    {
                        result = OgnlRuntime.getFieldValue(ognlContext, target, name, true);
                    }
                    catch (Exception ex)
                    {
                        throw new OgnlException(name, ex);
                    }
                }
            }
            else
            {
                result = base.getPossibleProperty(context, target, name);
            }
            return(result);
        }
示例#2
0
        ///<summary>
        /// Returns OgnlRuntime.NotFound if the property does not exist.
        ///</summary>
        public object getPossibleProperty(IDictionary context, object target, string name)          // throws OgnlException
        {
            object      result;
            OgnlContext ognlContext = (OgnlContext)context;

            try
            {
                if ((result = OgnlRuntime.getMethodValue(ognlContext, target, name, true)) == OgnlRuntime.NotFound)
                {
                    result = OgnlRuntime.getFieldValue(ognlContext, target, name, true);
                }
            }
            catch (OgnlException ex)
            {
                throw ex;
            }
            catch (Exception ex)
            {
                throw new OgnlException(name, ex);
            }
            return(result);
        }