Example #1
0
            public void SetValue(string encodedMember, IJavaPeerable self, short value)
            {
                JniPeerMembers.AssertSelf(self);

                var f = GetFieldInfo(encodedMember);

                JniEnvironment.InstanceFields.SetShortField(self.PeerReference, f, value);
                GC.KeepAlive(self);
            }
            public unsafe void InvokeAbstractVoidMethod(string encodedMember, IJavaPeerable self, JniArgumentValue *parameters)
            {
                JniPeerMembers.AssertSelf(self);

                var m = GetMethodInfo(encodedMember);

                JniEnvironment.InstanceMethods.CallVoidMethod(self.PeerReference, m, parameters);
                return;
            }
            public unsafe sbyte InvokeAbstractSByteMethod(string encodedMember, IJavaPeerable self, JniArgumentValue *parameters)
            {
                JniPeerMembers.AssertSelf(self);

                var m = GetMethodInfo(encodedMember);

                var r = JniEnvironment.InstanceMethods.CallByteMethod(self.PeerReference, m, parameters);

                GC.KeepAlive(self);
                return(r);
            }
            public unsafe bool InvokeNonvirtualBooleanMethod(string encodedMember, IJavaPeerable self, JniArgumentValue *parameters)
            {
                JniPeerMembers.AssertSelf(self);

                var m = GetMethodInfo(encodedMember);

                var r = JniEnvironment.InstanceMethods.CallNonvirtualBooleanMethod(self.PeerReference, JniPeerType.PeerReference, m, parameters);

                GC.KeepAlive(self);
                return(r);
            }
Example #5
0
            public int GetInt32Value(
                string encodedMember,
                IJavaPeerable self)
            {
                JniPeerMembers.AssertSelf(self);

                var f = GetFieldInfo(encodedMember);
                var r = JniEnvironment.InstanceFields.GetIntField(self.PeerReference, f);

                GC.KeepAlive(self);
                return(r);
            }
Example #6
0
 public JniFieldInfo GetFieldInfo(string encodedMember)
 {
     lock (InstanceFields) {
         if (!InstanceFields.TryGetValue(encodedMember, out var f))
         {
             string field, signature;
             JniPeerMembers.GetNameAndSignature(encodedMember, out field, out signature);
             f = Members.JniPeerType.GetInstanceField(field, signature);
             InstanceFields.Add(encodedMember, f);
         }
         return(f);
     }
 }
 public JniMethodInfo GetMethodInfo(string encodedMember)
 {
     lock (StaticMethods) {
         if (!StaticMethods.TryGetValue(encodedMember, out var m))
         {
             string method, signature;
             JniPeerMembers.GetNameAndSignature(encodedMember, out method, out signature);
             m = Members.JniPeerType.GetStaticMethod(method, signature);
             StaticMethods.Add(encodedMember, m);
         }
         return(m);
     }
 }
 public JniMethodInfo GetMethodInfo(string encodedMember)
 {
     lock (InstanceMethods) {
         JniMethodInfo m;
         if (!InstanceMethods.TryGetValue(encodedMember, out m))
         {
             string method, signature;
             JniPeerMembers.GetNameAndSignature(encodedMember, out method, out signature);
             m = JniPeerType.GetInstanceMethod(method, signature);
             InstanceMethods.Add(encodedMember, m);
         }
         return(m);
     }
 }
 public JniFieldInfo GetFieldInfo(string encodedMember)
 {
     lock (StaticFields) {
         JniFieldInfo f;
         if (!StaticFields.TryGetValue(encodedMember, out f))
         {
             string field, signature;
             JniPeerMembers.GetNameAndSignature(encodedMember, out field, out signature);
             f = Members.JniPeerType.GetStaticField(field, signature);
             StaticFields.Add(encodedMember, f);
         }
         return(f);
     }
 }
Example #10
0
            public unsafe sbyte InvokeVirtualSByteMethod(string encodedMember, IJavaPeerable self, JniArgumentValue *parameters)
            {
                JniPeerMembers.AssertSelf(self);

                var declaringType = DeclaringType;

                if (Members.UsesVirtualDispatch(self, declaringType))
                {
                    var m = GetMethodInfo(encodedMember);
                    return(JniEnvironment.InstanceMethods.CallByteMethod(self.PeerReference, m, parameters));
                }
                var j = Members.GetPeerMembers(self);
                var n = j.InstanceMethods.GetMethodInfo(encodedMember);

                return(JniEnvironment.InstanceMethods.CallNonvirtualByteMethod(self.PeerReference, j.JniPeerType.PeerReference, n, parameters));
            }
Example #11
0
        public override bool Equals(object obj)
        {
            JniPeerMembers.AssertSelf(this);

            if (object.ReferenceEquals(obj, this))
            {
                return(true);
            }
            var o = obj as IJavaPeerable;

            if (o != null)
            {
                return(JniEnvironment.Types.IsSameObject(PeerReference, o.PeerReference));
            }
            return(false);
        }
            public unsafe long InvokeVirtualInt64Method(string encodedMember, IJavaPeerable self, JniArgumentValue *parameters)
            {
                JniPeerMembers.AssertSelf(self);

                var declaringType = DeclaringType;

                if (Members.UsesVirtualDispatch(self, declaringType))
                {
                    var m   = GetMethodInfo(encodedMember);
                    var _nr = JniEnvironment.InstanceMethods.CallLongMethod(self.PeerReference, m, parameters);
                    GC.KeepAlive(self);
                    return(_nr);
                }
                var j = Members.GetPeerMembers(self);
                var n = j.InstanceMethods.GetMethodInfo(encodedMember);
                var r = JniEnvironment.InstanceMethods.CallNonvirtualLongMethod(self.PeerReference, j.JniPeerType.PeerReference, n, parameters);

                GC.KeepAlive(self);
                return(r);
            }
 public static string GetJniTypeName(this IJavaPeerable self)
 {
     JniPeerMembers.AssertSelf(self);
     return(JniEnvironment.Types.GetJniTypeNameFromInstance(self.PeerReference));
 }
 internal JniStaticMethods(JniPeerMembers members)
 {
     Members = members;
 }
Example #15
0
 internal JniInstanceFields(JniPeerMembers members)
 {
     Members = members;
 }
 internal JniInstanceMethods(JniPeerMembers members)
 {
     DeclaringType = members.ManagedPeerType;
     Members       = members;
 }
 internal JniStaticFields(JniPeerMembers members)
 {
     Members = members;
 }