Package bsh

Examples of bsh.Interpreter.eval()


                    if (bsh == null) {
                        bsh = BshUtil.makeInterpreter(context);
                        context.put("bshInterpreter", bsh);
                    }

                    Object retVal = bsh.eval(StringUtil.convertOperatorSubstitutions(useWhen));

                    // retVal should be a Boolean, if not something weird is up...
                    if (retVal instanceof Boolean) {
                        Boolean boolVal = (Boolean) retVal;
                        shouldUse = boolVal.booleanValue();
View Full Code Here


        try {
            // use the same Interpreter (ie with the same context setup) for all evals
            Interpreter bsh = this.getBshInterpreter(context);
            for (AltTarget altTarget: this.altTargets) {
                Object retVal = bsh.eval(StringUtil.convertOperatorSubstitutions(altTarget.useWhen));
                boolean condTrue = false;
                // retVal should be a Boolean, if not something weird is up...
                if (retVal instanceof Boolean) {
                    Boolean boolVal = (Boolean) retVal;
                    condTrue = boolVal.booleanValue();
View Full Code Here

        String styles = "";
        try {
            // use the same Interpreter (ie with the same context setup) for all evals
            Interpreter bsh = this.getBshInterpreter(context);
            for (AltRowStyle altRowStyle : this.altRowStyles) {
                Object retVal = bsh.eval(StringUtil.convertOperatorSubstitutions(altRowStyle.useWhen));
                // retVal should be a Boolean, if not something weird is up...
                if (retVal instanceof Boolean) {
                    Boolean boolVal = (Boolean) retVal;
                    if (boolVal.booleanValue()) {
                        styles += altRowStyle.style;
View Full Code Here

        if (UtilValidate.isEmpty(useWhenStr)) {
            return true;
        } else {
            try {
                Interpreter bsh = this.modelForm.getBshInterpreter(context);
                Object retVal = bsh.eval(StringUtil.convertOperatorSubstitutions(useWhenStr));
                boolean condTrue = false;
                // retVal should be a Boolean, if not something weird is up...
                if (retVal instanceof Boolean) {
                    Boolean boolVal = (Boolean) retVal;
                    condTrue = boolVal.booleanValue();
View Full Code Here

      while (iter.hasNext()) {
        String inputName = (String) iter.next();
        Object inputValue = inputMap.get(inputName);
        interpreter.set(inputName, inputValue);
     }
      interpreter.eval(expression);
      iter = outputNames.iterator();
      while (iter.hasNext()) {
        String outputName = (String) iter.next();
        Object outputValue = interpreter.get(outputName);
        outputMap.put(outputName, outputValue);
View Full Code Here

      Interpreter bsh = (Interpreter)SessionManager.getSession(session,
                       prefix, null);
      try {
    bsh.set("context", context);
    bsh.set("request", request);
    bsh.eval(Format.subst(request.props, script));
      } catch (EvalError e) {
    log(Server.LOG_WARNING, "BeanShell EvalError: ", e);
    aok = false;
      }
  }
View Full Code Here

                }
            }

            try
            {
                return engine.eval( script );
            }
            catch ( TargetError e )
            {
                throw new ScriptEvaluationException( e.getTarget() );
            }
View Full Code Here

    {
        Interpreter i = new Interpreter();
        try
        {
            i.set("params", params);
            i.eval(script);
        }
        catch (EvalError evalError)
        {
            evalError.printStackTrace();
            throw new MojoExecutionException(evalError.getMessage());
View Full Code Here

            // use the same Interpreter (ie with the same context setup) for all evals
            Interpreter bsh = this.getBshInterpreter(context);
            Iterator altTargetIter = this.altTargets.iterator();
            while (altTargetIter.hasNext()) {
                AltTarget altTarget = (AltTarget) altTargetIter.next();
                Object retVal = bsh.eval(altTarget.useWhen);
                boolean condTrue = false;
                // retVal should be a Boolean, if not something weird is up...
                if (retVal instanceof Boolean) {
                    Boolean boolVal = (Boolean) retVal;
                    condTrue = boolVal.booleanValue();
View Full Code Here

            Debug.logVerbose("Using Context -- " + context, module);

        try {
            Interpreter bsh = makeInterpreter(context);
            // evaluate the expression
            o = bsh.eval(expression);
            if (Debug.verboseOn())
                Debug.logVerbose("Evaluated to -- " + o, module);

            // read back the context info
            NameSpace ns = bsh.getNameSpace();
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.