示例#1
0
文件: Class.cs 项目: g-pechorin/xmlvm
        public virtual global::System.Object getDeclaredMethods()
        {
//XMLVM_BEGIN_WRAPPER[java.lang.Class: java.lang.reflect.Method[] getDeclaredMethods()]
            org.xmlvm._nTIB     tib        = (org.xmlvm._nTIB) this._ftib;
            global::System.Type nativeType = tib.getNativeType();
            global::System.Reflection.BindingFlags bindingFlags
                = global::System.Reflection.BindingFlags.DeclaredOnly
                  | global::System.Reflection.BindingFlags.Static
                  | global::System.Reflection.BindingFlags.Instance
                  | global::System.Reflection.BindingFlags.Public
                  | global::System.Reflection.BindingFlags.NonPublic;
            global::System.Reflection.MethodInfo[] methodInfos
                = nativeType.GetMethods(bindingFlags);
            global::System.Collections.Generic.IList <java.lang.reflect.Method> jMethods
                = new global::System.Collections.Generic.List <java.lang.reflect.Method>();
            foreach (global::System.Reflection.MethodInfo nativeMethodInfo in methodInfos)
            {
                java.lang.reflect.Method jMethod
                    = org.xmlvm._nMemberInfoAdapter <global::System.Reflection.MethodInfo,
                                                     java.lang.reflect.Method._nImpl> .getJavaClient(nativeMethodInfo);

                jMethods.Add(jMethod);
            }
            java.lang.reflect.Method[] jMethodArray = new java.lang.reflect.Method[jMethods.Count];
            jMethods.CopyTo(jMethodArray, 0);
            return(new org.xmlvm._nArrayAdapter <object>(jMethodArray));
//XMLVM_END_WRAPPER[java.lang.Class: java.lang.reflect.Method[] getDeclaredMethods()]
        }
示例#2
0
        public static object slowCallField(object obj, string field, global::Array args)
        {
            if ((string.Equals(field, "toString") && (((args == null) || (((int)(global::haxe.lang.Runtime.getField_f(args, "length", 520590566, true))) == 0)))))
            {
                return(obj.ToString());
            }

            if ((args == null))
            {
                args = new global::Array <object>(new object[] {});
            }

            global::System.Reflection.BindingFlags bf = default(global::System.Reflection.BindingFlags);
            global::System.Type t = ((global::System.Type)((obj as global::System.Type)));
            if ((t == null))
            {
                string s = ((string)((obj as string)));
                if (!(string.Equals(s, null)))
                {
                    return(global::haxe.lang.StringRefl.handleCallField(s, field, args));
                }

                t = obj.GetType();
                global::System.Reflection.BindingFlags this1 = global::System.Reflection.BindingFlags.Instance;
                global::System.Reflection.BindingFlags this2 = ((global::System.Reflection.BindingFlags)((((global::System.Reflection.BindingFlags)(this1)) | ((global::System.Reflection.BindingFlags)(global::System.Reflection.BindingFlags.Public)))));
                global::System.Reflection.BindingFlags this3 = ((global::System.Reflection.BindingFlags)((((global::System.Reflection.BindingFlags)(this2)) | ((global::System.Reflection.BindingFlags)(global::System.Reflection.BindingFlags.FlattenHierarchy)))));
                bf = ((global::System.Reflection.BindingFlags)(this3));
            }
            else
            {
                if (((t == ((global::System.Type)(typeof(string)))) && string.Equals(field, "fromCharCode")))
                {
                    return(global::haxe.lang.StringExt.fromCharCode(global::haxe.lang.Runtime.toInt(args[0])));
                }

                obj = null;
                global::System.Reflection.BindingFlags this4 = global::System.Reflection.BindingFlags.Static;
                global::System.Reflection.BindingFlags this5 = ((global::System.Reflection.BindingFlags)((((global::System.Reflection.BindingFlags)(this4)) | ((global::System.Reflection.BindingFlags)(global::System.Reflection.BindingFlags.Public)))));
                bf = ((global::System.Reflection.BindingFlags)(this5));
            }

            global::System.Reflection.MethodBase[] mis = ((global::System.Reflection.MethodBase[])(t.GetMethods(((global::System.Reflection.BindingFlags)(bf)))));
            int last = 0;

            {
                int _g1 = 0;
                int _g  = (mis as global::System.Array).Length;
                while ((_g1 < _g))
                {
                    int    i    = _g1++;
                    string name = (mis[i] as global::System.Reflection.MemberInfo).Name;
                    if (string.Equals(name, field))
                    {
                        mis[last++] = mis[i];
                    }
                }
            }

            if (((last == 0) && ((string.Equals(field, "__get") || string.Equals(field, "__set")))))
            {
                if (string.Equals(field, "__get"))
                {
                    field = "get_Item";
                }
                else
                {
                    field = "set_Item";
                }

                {
                    int _g11 = 0;
                    int _g2  = (mis as global::System.Array).Length;
                    while ((_g11 < _g2))
                    {
                        int    i1    = _g11++;
                        string name1 = (mis[i1] as global::System.Reflection.MemberInfo).Name;
                        if (string.Equals(name1, field))
                        {
                            mis[last++] = mis[i1];
                        }
                    }
                }
            }

            if (((last == 0) && t.IsCOMObject))
            {
                object[] oargs = new object[((int)(global::haxe.lang.Runtime.getField_f(args, "length", 520590566, true)))];
                {
                    int _g12 = 0;
                    int _g3  = (oargs as global::System.Array).Length;
                    while ((_g12 < _g3))
                    {
                        int i2 = _g12++;
                        oargs[i2] = args[i2];
                    }
                }

                return(t.InvokeMember(((string)(field)), ((global::System.Reflection.BindingFlags)(global::System.Reflection.BindingFlags.InvokeMethod)), default(global::System.Reflection.Binder), ((object)(obj)), ((object[])(oargs))));
            }

            if ((last == 0))
            {
                throw global::haxe.lang.HaxeException.wrap(global::haxe.lang.Runtime.concat(global::haxe.lang.Runtime.concat(global::haxe.lang.Runtime.concat("Method \"", field), "\" not found on type "), global::Std.@string(t)));
            }

            return(global::haxe.lang.Runtime.callMethod(obj, mis, last, args));
        }