getClass() private method

private getClass ( ) : global::java.lang.Class
return global::java.lang.Class
Example #1
0
 public static java.lang.Object java_Invoke_UsingSignature(this java.lang.Object liveObject, string methodName, string signature, params java.lang.Object[] methodParameters)
 {
     try
     {
         var method = (signature.isNull())
                                                         ? liveObject.getClass().getMethod(methodName, null)
                                                         : liveObject.getClass().GetMethod(methodName, signature, false);
         var result = method.invoke(liveObject, methodParameters);
         return(result);
     }
     catch (System.Exception ex)
     {
         ex.log();
         return(null);
     }
 }
Example #2
0
        public void CallMeFromJava()
        {
            Class  testClass = env.FindClass("net/sf/jni4net/tested/JavaToClrReflection");
            Object test      = testClass.newInstance();

            test.getClass().Invoke("reflect", "()V");
        }
Example #3
0
 internal static Method GetExecuteUpdate(this Object target)
 {
     return(target
            .getClass()
            .getMethods()
            .Single(x => x.getName() == Constants.Methods.ExecuteUpdate &&
                    x.GetSignature() == Constants.MethodSignatures.ExecuteUpdate_String_Int));
 }
Example #4
0
        public void cIfaceCanInt()
        {
            var    cw1   = 1;
            Object proxy = Bridge.WrapCLR(cw1);
            Class  clazz = proxy.getClass();
            //TODO Assert.AreEqual(System.Int32_._class, clazz);
            object res = Bridge.UnwrapCLR <object>(proxy);

            Assert.AreEqual(cw1, res);
        }
Example #5
0
        internal static string GetString(this Object target, string columnName)
        {
            var getString = target
                            .getClass()
                            .getMethods()
                            .Single(x => x.getName() == Constants.Methods.GetString &&
                                    x.GetSignature() == Constants.MethodSignatures.String_String);

            java.lang.String result = (java.lang.String)getString.invoke(target, new[] { JNIEnv.ThreadEnv.NewString(columnName) });
            return(result);
        }
Example #6
0
        public void cIfaceCanString()
        {
            var    cw1   = "sdfd";
            Object proxy = Bridge.WrapCLR(cw1);
            Class  clazz = proxy.getClass();

            Assert.AreEqual(System.String_._class, clazz);
            object res = Bridge.UnwrapCLR <object>(proxy);

            Assert.AreSame(cw1, res);
        }
Example #7
0
        public void HeavyCallMeFromJava()
        {
            var      start     = DateTime.Now;
            Class    testClass = env.FindClass("net/sf/jni4net/tested/JavaToClrReflection");
            Object   test      = testClass.newInstance();
            MethodId methodId  = env.GetStaticMethodID(test.getClass(), "reflect", "()V");

            for (int i = 0; i < 100000; i++)
            {
                env.CallVoidMethod(test, methodId);
            }
            var end = DateTime.Now;

            Console.WriteLine(end - start);
        }
Example #8
0
        public void TypeCbyCLRProxy()
        {
            JInterfacesHelper  h               = new JInterfacesHelper();
            CWithJavaInterface cwc             = h.getCWithJavaInterfaceC(new CWithJavaInterface(0));
            Object             val             = Bridge.WrapCLR(cwc);
            JniGlobalHandle    jniGlobalHandle = ((IClrProxy)val).JvmHandle;
            RegistryRecord     record          = Registry.GetRecord(JNIEnv.ThreadEnv, jniGlobalHandle, val.getClass());

            Assert.IsNotNull(record);
            jniGlobalHandle.HoldThisHandle();
        }