Handles discovery and valuation of a boolean object property, of the form public boolean is<property> when executed. We do this separately as to preserve the current quasi-broken semantics of get<as is property> get< flip 1st char> get("property") and now followed by is<Property>
상속: NVelocity.Runtime.Parser.Node.PropertyExecutor
예제 #1
0
        /// <summary>  introspects the class to find the method name of the node,
        /// or if that fails, treats the reference object as a map
        /// and treats the identifier as a key in that map.
        /// This needs work.
        /// *
        /// </summary>
        /// <param name="data">Class to be introspected
        ///
        /// </param>
        private AbstractExecutor doIntrospection(System.Type data)
        {
            AbstractExecutor executor;

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

            executor = new PropertyExecutor(rsvc, data, identifier);

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

            if (executor.isAlive() == false)
            {
                executor = new GetExecutor(rsvc, data, identifier);
            }

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

            if (executor.isAlive() == false)
            {
                executor = new BooleanPropertyExecutor(rsvc, data, identifier);
            }

            return(executor);
        }
예제 #2
0
		/// <summary>
		/// Property  getter
		/// </summary>
		public IVelPropertyGet 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 new VelGetterImpl(executor);
		}
예제 #3
0
	/// <summary>  introspects the class to find the method name of the node,
	/// or if that fails, treats the reference object as a map
	/// and treats the identifier as a key in that map.
	/// This needs work.
	/// *
	/// </summary>
	/// <param name="data">Class to be introspected
	///
	/// </param>
	private AbstractExecutor doIntrospection(System.Type data) {
	    AbstractExecutor executor;

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

	    executor = new PropertyExecutor(rsvc, data, identifier);

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

	    if (executor.isAlive() == false) {
		executor = new GetExecutor(rsvc, data, identifier);
	    }

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

	    if (executor.isAlive() == false) {
		executor = new BooleanPropertyExecutor(rsvc, data, identifier);
	    }

	    return executor;
	}
        /// <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);
        }