Example #1
0
 /**
  * Copy constructor.
  * @param base the base to copy
  * @since 2.1
  */
 protected Interpreter(Interpreter base) {
     this.logger = base.logger;
     this.uberspect = base.uberspect;
     this.arithmetic = base.arithmetic;
     this.functions = base.functions;
     this.strict = base.strict;
     this.silent = base.silent;
     this.cache = base.cache;
     this.context = base.context;
     this.functors = base.functors;
 }
Example #2
0
 /**
  * Creates an interpreter.
  * @param jexl the engine creating this interpreter
  * @param aContext the context to evaluate expression
  * @param strictFlag whether this interpreter runs in strict mode
  * @param silentFlag whether this interpreter runs in silent mode
  * @since 2.1
  */
 public Interpreter(JexlEngine jexl, JexlContext aContext, bool strictFlag, bool silentFlag) {
     this.logger = jexl.logger;
     this.uberspect = jexl.uberspect;
     this.arithmetic = jexl.arithmetic;
     this.functions = jexl.functions;
     this.strict = strictFlag;
     this.silent = silentFlag;
     this.cache = jexl.cache != null;
     this.context = aContext != null ? aContext : JexlEngine.EMPTY_CONTEXT;
     this.functors = null;
 }
Example #3
0
        /// <summary>  Gets the classname for the Uberspect introspection package and
        /// instantiates an instance.
        /// </summary>
        private void initializeIntrospection()
        {
            String rm = getString(RuntimeConstants_Fields.UBERSPECT_CLASSNAME);

            if (rm != null && rm.Length > 0)
            {
                Object o = null;

                //UPGRADE_NOTE: Exception 'java.lang.ClassNotFoundException' was converted to 'System.Exception' which has different behavior. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1100"'
                try
                {
                    //UPGRADE_TODO: Format of parameters of method 'java.lang.Class.forName' are different in the equivalent in .NET. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1092"'
                    o = SupportClass.CreateNewInstance(Type.GetType(rm));
                }
                catch (System.Exception)
                {
                    String err = "The specified class for Uberspect (" + rm + ") does not exist (or is not accessible to the current classlaoder.";
                    error(err);
                    throw new System.Exception(err);
                }

                if (!(o is Uberspect))
                {
                    String err = "The specified class for Uberspect (" + rm + ") does not implement org.apache.velocity.util.introspector.Uberspect." + " Velocity not initialized correctly.";

                    error(err);
                    throw new System.Exception(err);
                }

                uberSpect = (Uberspect)o;

                if (uberSpect is UberspectLoggable)
                {
                    ((UberspectLoggable)uberSpect).RuntimeLogger = this;
                }

                uberSpect.init();
            }
            else
            {
                /*
                 *  someone screwed up.  Lets not fool around...
                 */

                String err = "It appears that no class was specified as the" + " Uberspect.  Please ensure that all configuration" + " information is correct.";

                error(err);
                throw new System.Exception(err);
            }
        }