Get() public method

Get a Tree. If a tree for the given expression is present in the cache, it is taken from there; otherwise, the expression string is parsed and the resulting tree is added to the cache.
public Get ( string expression ) : ESS.FW.Bpm.Engine.Impl.Juel.Tree
expression string expression string
return ESS.FW.Bpm.Engine.Impl.Juel.Tree
示例#1
0
        /// <summary>
        /// Create a new method expression.
        /// The expression must be an lvalue expression or literal text.
        /// The expected return type may be <code>null</code>, meaning "don't care".
        /// If it is an lvalue expression, the parameter types must not be <code>null</code>.
        /// If it is literal text, the expected return type must not be <code>void</code>. </summary>
        /// <param name="store"> used to get the parse tree from. </param>
        /// <param name="functions"> the function mapper used to bind functions </param>
        /// <param name="variables"> the variable mapper used to bind variables </param>
        /// <param name="expr"> the expression string </param>
        /// <param name="returnType"> the expected return type (may be <code>null</code>) </param>
        /// <param name="paramTypes"> the expected parameter types (must not be <code>null</code> for lvalues) </param>
        public TreeMethodExpression(TreeStore store, FunctionMapper functions, VariableMapper variables, ITypeConverter converter, string expr, Type returnType, Type[] paramTypes) : base()
        {
            Tree tree = store.Get(expr);

            this.builder  = store.Builder;
            this.bindings = tree.Bind(functions, variables, converter);
            this.expr     = expr;
            this.type     = returnType;
            this.types    = paramTypes;
            this.node     = tree.Root;
            this.deferred = tree.Deferred;

            if (node.LiteralText)
            {
                if (returnType == typeof(void))
                {
                    throw new ELException(LocalMessages.Get("error.method.literal.void", expr));
                }
            }
            else if (!node.MethodInvocation)
            {
                if (!node.LeftValue)
                {
                    throw new ELException(LocalMessages.Get("error.method.invalid", expr));
                }
                if (paramTypes == null)
                {
                    throw new ELException(LocalMessages.Get("error.method.notypes"));
                }
            }
        }
示例#2
0
        /// <summary>
        /// Create a new value expression. </summary>
        /// <param name="store"> used to get the parse tree from. </param>
        /// <param name="functions"> the function mapper used to bind functions </param>
        /// <param name="variables"> the variable mapper used to bind variables </param>
        /// <param name="expr"> the expression string </param>
        /// <param name="type"> the expected type (may be <code>null</code>) </param>
        public TreeValueExpression(TreeStore store, FunctionMapper functions, VariableMapper variables, ITypeConverter converter, string expr, Type type) : base()
        {
            Tree tree = store.Get(expr);

            this.builder  = store.Builder;
            this.bindings = tree.Bind(functions, variables, converter);
            this.expr     = expr;
            this.type     = type;
            this.node     = tree.Root;
            this.deferred = tree.Deferred;

            if (type == null)
            {
                throw new System.NullReferenceException(LocalMessages.Get("error.value.notype"));
            }
        }