Beispiel #1
0
        /// <summary>
        /// Property getter.
        /// </summary>
        public IVelPropertyGet GetPropertyGet(Object obj, String identifier, Info i)
        {
            AbstractExecutor executor;

            Type type = obj.GetType();

            // First try for a getFoo() type of property (also getfoo())
            executor = new PropertyExecutor(runtimeLogger, introspector, type, identifier);

            // If that didn't work, look for get("foo")
            if (!executor.IsAlive)
            {
                executor = new GetExecutor(runtimeLogger, introspector, type, identifier);
            }

            // If that didn't work, look for boolean isFoo()
            if (!executor.IsAlive)
            {
                executor = new BooleanPropertyExecutor(runtimeLogger, introspector, type, identifier);
            }

            // If that didn't work, look for an enumeration
            if (!executor.IsAlive && (obj is Type) && (obj as Type).IsEnum)
            {
                executor = new EnumValueExecutor(runtimeLogger, introspector, obj as Type, identifier);
            }

            return(new VelGetterImpl(executor));
        }
        /// <summary> Property  getter
        /// </summary>
        public VelPropertyGet getPropertyGet(Object obj, String identifier, Info i)
        {
            AbstractExecutor executor;

            Type claz = obj.GetType();

            /*
             *  first try for a getFoo() type of property
             *  (also getfoo() )
             */

            executor = new PropertyExecutor(rlog, introspector, claz, identifier);

            /*
             *  if that didn't work, look for get("foo")
             */

            if (!executor.isAlive())
            {
                executor = new GetExecutor(rlog, introspector, claz, identifier);
            }

            /*
             *  finally, look for boolean isFoo()
             */

            if (!executor.isAlive())
            {
                executor = new BooleanPropertyExecutor(rlog, introspector, claz, identifier);
            }

            return((executor != null) ? new VelGetterImpl(this, executor) : null);
        }
Beispiel #3
0
        public IVelPropertyGet GetPropertyGet(object obj, string identifier, Info i)
        {
            Type             type             = obj.GetType();
            AbstractExecutor abstractExecutor = new PropertyExecutor(this.rlog, UberspectImpl.introspector, type, identifier);

            if (!abstractExecutor.IsAlive)
            {
                abstractExecutor = new GetExecutor(this.rlog, UberspectImpl.introspector, type, identifier);
            }
            if (!abstractExecutor.IsAlive)
            {
                abstractExecutor = new BooleanPropertyExecutor(this.rlog, UberspectImpl.introspector, type, identifier);
            }
            return((abstractExecutor != null) ? new UberspectImpl.VelGetterImpl(abstractExecutor) : null);
        }
        /// <summary> Property  getter</summary>
        /// <param name="obj">
        /// </param>
        /// <param name="identifier">
        /// </param>
        /// <param name="i">
        /// </param>
        /// <returns> A Velocity Getter Method.
        /// </returns>
        /// <throws>  Exception </throws>
        public virtual IVelPropertyGet GetPropertyGet(object obj, string identifier, Info i)
        {
            if (obj == null)
            {
                return(null);
            }

            System.Type claz = obj.GetType();

            /*
             *  first try for a getFoo() type of property
             *  (also getfoo() )
             */
            AbstractExecutor executor = new PropertyExecutor(log, introspector, claz, identifier);

            /*
             * Let's see if we are a map...
             */
            if (!executor.Alive)
            {
                executor = new MapGetExecutor(log, claz, identifier);
            }

            /*
             *  if that didn't work, look for Get("foo")
             */

            if (!executor.Alive)
            {
                executor = new GetExecutor(log, introspector, claz, identifier);
            }

            /*
             *  finally, look for boolean isFoo()
             */

            if (!executor.Alive)
            {
                executor = new BooleanPropertyExecutor(log, introspector, claz, identifier);
            }

            return((executor.Alive) ? new VelGetterImpl(executor) : null);
        }