Executor that simply tries to execute a get(key) operation. This will try to find a get(key) method for any type of object, not just objects that implement the Map interface as was previously the case.
Add discovery for .NET default property, using Type.GetDefaultMembers.
Inheritance: AbstractExecutor
コード例 #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
ファイル: ASTIdentifier.cs プロジェクト: DF-thangld/web_game
	/// <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;
	}
コード例 #4
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);
        }