Beispiel #1
0
 public static JniObjectReference NewObject(JniObjectReference type, JniMethodInfo method)
 {
     JniEnvironment.WithinNewObjectScope = true;
     try {
         return(_NewObject(type, method));
     }
     finally {
         JniEnvironment.WithinNewObjectScope = false;
     }
 }
Beispiel #2
0
        public JniMethodInfo GetCachedInstanceMethod(ref JniMethodInfo cachedMethod, string name, string signature)
        {
            AssertValid();

            if (cachedMethod != null && cachedMethod.IsValid)
            {
                return(cachedMethod);
            }
            var m = GetInstanceMethod(name, signature);

            if (Interlocked.CompareExchange(ref cachedMethod, m, null) != null)
            {
                // No cleanup required; let the GC collect the unused instance
            }
            return(cachedMethod);
        }
Beispiel #3
0
        public JniMethodInfo GetCachedStaticMethod(ref JniMethodInfo cachedMethod, string name, string signature)
        {
            AssertValid();

            if (cachedMethod != null && cachedMethod.IsValid)
                return(cachedMethod); }
Beispiel #4
0
        public unsafe JniObjectReference NewObject(JniMethodInfo constructor, JniArgumentValue * @parameters)
        {
            AssertValid();

            return(JniEnvironment.Object.NewObject(PeerReference, constructor, parameters));
        }
Beispiel #5
0
        public JniMethodInfo GetCachedConstructor(ref JniMethodInfo cachedMethod, string signature)
        {
            AssertValid();

            return(GetCachedInstanceMethod(ref cachedMethod, "<init>", signature));
        }
Beispiel #6
0
 static Types()
 {
     using (var t = new JniType("java/lang/Class")) {
         Class_getName = t.GetInstanceMethod("getName", "()Ljava/lang/String;");
     }
 }
Beispiel #7
0
 static Object()
 {
     using (var t = new JniType("java/lang/Object")) {
         Object_toString = t.GetInstanceMethod("toString", "()Ljava/lang/String;");
     }
 }
Beispiel #8
0
 public static unsafe JniObjectReference NewObject(JniObjectReference type, JniMethodInfo method, JniArgumentValue *args)
 {
     JniEnvironment.WithinNewObjectScope = true;
     try {
         return(_NewObject(type, method, args));
     }
     finally {
         JniEnvironment.WithinNewObjectScope = false;
     }
 }