private getClass ( ) : global::java.lang.Class | ||
Résultat | global::java.lang.Class |
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); } }
public void CallMeFromJava() { Class testClass = env.FindClass("net/sf/jni4net/tested/JavaToClrReflection"); Object test = testClass.newInstance(); test.getClass().Invoke("reflect", "()V"); }
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)); }
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); }
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); }
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); }
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); }
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(); }