예제 #1
0
        ManagedMethod(GenBase declaringType, MethodDefinition m, ManagedMethodBaseSupport support)
            : base(declaringType, support)
        {
            this.m = m;
            var regatt = m.CustomAttributes.FirstOrDefault(a => a.AttributeType.FullName == "Android.Runtime.RegisterAttribute");

            is_acw = regatt != null;
            is_interface_default_method = m.CustomAttributes
                                          .Any(ca => ca.AttributeType.FullName == "Java.Interop.JavaInterfaceDefaultMethodAttribute");
            java_name = regatt != null ? ((string)regatt.ConstructorArguments [0].Value) : m.Name;

            foreach (var p in support.GetParameters(regatt))
            {
                Parameters.Add(p);
            }

            if (regatt != null && !IsReturnEnumified)
            {
                var rt = support.GetJniReturnType(regatt);
                if (rt != null)
                {
                    java_return = rt.Type;
                }
            }
            FillReturnType();
        }
예제 #2
0
        ManagedCtor(GenBase declaringType, MethodDefinition m, ManagedMethodBaseSupport support)
            : base(declaringType, support)
        {
            this.m = m;
            name   = m.Name;
            // If 'elem' is a constructor for a non-static nested type, then
            // the type of the containing class must be inserted as the first
            // argument
            if (IsNonStaticNestedType)
            {
                Parameters.AddFirst(Parameter.FromManagedType(m.DeclaringType.DeclaringType, DeclaringType.JavaName));
            }
            var regatt = m.CustomAttributes.FirstOrDefault(a => a.AttributeType.FullName == "Android.Runtime.RegisterAttribute");

            is_acw = regatt != null;
            foreach (var p in support.GetParameters(regatt))
            {
                Parameters.Add(p);
            }
        }