public double CallDoubleMethod(JniHandle obj, MethodId methodIdNative, params Value[] args) { double res = callDoubleMethod(envPtr, obj, methodIdNative.native, args); ExceptionTest(); return(res); }
public bool CallBooleanMethod(JniHandle obj, MethodId methodIdNative, params Value[] args) { bool res = callBooleanMethod(envPtr, obj, methodIdNative.native, args) != 0; ExceptionTest(); return(res); }
public long CallLongMethod(JniHandle obj, MethodId methodIdNative, params Value[] args) { long res = callLongMethod(envPtr, obj, methodIdNative.native, args); ExceptionTest(); return(res); }
public char CallCharMethod(JniHandle obj, MethodId methodIdNative, params Value[] args) { var res = (char)callCharMethod(envPtr, obj, methodIdNative.native, args); ExceptionTest(); return(res); }
public void NewObject(Class clazz, MethodId methodID, IJvmProxy obj, params Value[] args) { JniLocalHandle res = newObject(envPtr, clazz.jvmHandle, methodID.native, args); ExceptionTest(); obj.Init(this, res); }
public IObject NewObject(Class clazz, MethodId methodID, params Value[] args) { JniLocalHandle res = newObject(envPtr, clazz.jvmHandle, methodID.native, args); ExceptionTest(); return(Convertor.FullJ2C <IJvmProxy>(this, res)); }
public JniLocalHandle NewObjectPtr(JniHandle clazz, MethodId methodID, params Value[] args) { JniLocalHandle res = newObject(envPtr, clazz, methodID.native, args); ExceptionTest(); return(res); }
public float CallFloatMethod(JniHandle obj, MethodId methodIdNative, params Value[] args) { float res = callFloatMethod(envPtr, obj, methodIdNative.native, args); ExceptionTest(); return(res); }
public Method ToReflectedMethod(Class cls, MethodId methodId, bool isStatic) { JniLocalHandle res = toReflectedMethod.Invoke(envPtr, cls.jvmHandle, methodId.native, isStatic ? (byte)1 : (byte)0); ExceptionTest(); return(Convertor.StrongJ2Cp <Method>(this, res)); }
private TRes CallStaticMethod <TRes>(Class clazz, string method, string sig, params Value[] args) { MethodId idNative = GetStaticMethodID(clazz, method, sig); if (idNative != null) { if (typeof(IObject).IsAssignableFrom(typeof(TRes)) || (typeof(object) == (typeof(TRes)) || typeof(Delegate).IsAssignableFrom(typeof(TRes))) ) { return(CallStaticObjectMethod <TRes>(clazz, idNative, args)); } if (typeof(string).IsAssignableFrom(typeof(TRes))) { return(CallStaticObjectMethod <TRes>(clazz, idNative, args)); } if (typeof(int).IsAssignableFrom(typeof(TRes))) { return((TRes)(object)CallStaticIntMethod(clazz, idNative, args)); } if (typeof(bool).IsAssignableFrom(typeof(TRes))) { return((TRes)(object)CallStaticBooleanMethod(clazz, idNative, args)); } if (typeof(long).IsAssignableFrom(typeof(TRes))) { return((TRes)(object)CallStaticLongMethod(clazz, idNative, args)); } if (typeof(double).IsAssignableFrom(typeof(TRes))) { return((TRes)(object)CallStaticDoubleMethod(clazz, idNative, args)); } if (typeof(byte).IsAssignableFrom(typeof(TRes))) { return((TRes)(object)CallStaticByteMethod(clazz, idNative, args)); } if (typeof(short).IsAssignableFrom(typeof(TRes))) { return((TRes)(object)CallStaticShortMethod(clazz, idNative, args)); } if (typeof(float).IsAssignableFrom(typeof(TRes))) { return((TRes)(object)CallStaticFloatMethod(clazz, idNative, args)); } if (typeof(char).IsAssignableFrom(typeof(TRes))) { return((TRes)(object)CallStaticCharMethod(clazz, idNative, args)); } if (typeof(byte).IsAssignableFrom(typeof(TRes))) { return((TRes)(object)CallStaticByteMethod(clazz, idNative, args)); } } throw new ArgumentException(); }
public void CallVoidMethod(IJvmProxy obj, MethodId methodId, params Value[] args) { #if DEBUG if (Bridge.Setup.VeryVerbose) { Console.WriteLine("IJvmProxy : " + obj.GetType().FullName); } #endif CallVoidMethod(obj.JvmHandle, methodId, args); }
public IObject NewObject(Class clazz, string method, string sig, params object[] args) { MethodId idNative = GetMethodID(clazz, method, sig); if (idNative != null) { return(NewObject(clazz, idNative, Convertor.ConverArgs(this, args))); } throw new ArgumentException(); }
private TRes CallMethod <TRes>(IJvmProxy obj, string method, string sig, params Value[] args) { MethodId idNative = GetMethodID(GetObjectClass(obj), method, sig); if (idNative != null) { if (typeof(IObject).IsAssignableFrom(typeof(TRes)) || typeof(object) == (typeof(TRes)) || typeof(Delegate).IsAssignableFrom(typeof(TRes))) { return(CallObjectMethod <TRes>(obj, idNative, args)); } if (typeof(string).IsAssignableFrom(typeof(TRes))) { return(CallObjectMethod <TRes>(obj, idNative, args)); } if (typeof(int).IsAssignableFrom(typeof(TRes))) { return((TRes)(object)CallIntMethod(obj, idNative, args)); } if (typeof(bool).IsAssignableFrom(typeof(TRes))) { return((TRes)(object)CallBooleanMethod(obj, idNative, args)); } if (typeof(long).IsAssignableFrom(typeof(TRes))) { return((TRes)(object)CallLongMethod(obj, idNative, args)); } if (typeof(double).IsAssignableFrom(typeof(TRes))) { return((TRes)(object)CallDoubleMethod(obj, idNative, args)); } if (typeof(byte).IsAssignableFrom(typeof(TRes))) { return((TRes)(object)CallByteMethod(obj, idNative, args)); } if (typeof(short).IsAssignableFrom(typeof(TRes))) { return((TRes)(object)CallShortMethod(obj, idNative, args)); } if (typeof(float).IsAssignableFrom(typeof(TRes))) { return((TRes)(object)CallFloatMethod(obj, idNative, args)); } if (typeof(char).IsAssignableFrom(typeof(TRes))) { return((TRes)(object)CallCharMethod(obj, idNative, args)); } if (typeof(byte).IsAssignableFrom(typeof(TRes))) { return((TRes)(object)CallByteMethod(obj, idNative, args)); } } throw new ArgumentException(); }
internal void CallStaticVoidMethod(Class clazz, string method, string sig, params Value[] args) { MethodId idNative = GetStaticMethodID(clazz, method, sig); if (idNative != null) { CallStaticVoidMethod(clazz, idNative, args); return; } throw new ArgumentException(); }
public byte CallStaticByteMethod(Class clazz, MethodId methodIdNative, params Value[] args) { #if DEBUG if (Bridge.Setup.VeryVerbose) { Console.WriteLine("CallStaticByteMethod : " + clazz.FullName); } #endif byte res = callStaticByteMethod(envPtr, clazz.jvmHandle, methodIdNative.native, args); ExceptionTest(); return(res); }
public void CallStaticVoidMethod(Class clazz, MethodId methodIdNative, params Value[] args) { #if DEBUG if (Bridge.Setup.VeryVerbose) { Console.WriteLine("CallStaticVoidMethod : " + clazz.FullName); } #endif callStaticVoidMethod(envPtr, clazz.jvmHandle, methodIdNative.native, args); //TODO result could be tested in Java 1.6 ExceptionTest(); }
public char CallCharMethod(IJvmProxy obj, MethodId methodIdNative, params Value[] args) { #if DEBUG if (Bridge.Setup.VeryVerbose) { Console.WriteLine("CallCharMethod : " + obj.GetType().FullName); } #endif var res = (char)callCharMethod(envPtr, obj.JvmHandle, methodIdNative.native, args); ExceptionTest(); return(res); }
public JniLocalHandle CallStaticObjectMethodPtr(Class clazz, MethodId methodIdNative, params Value[] args) { #if DEBUG if (Bridge.Setup.VeryVerbose) { Console.WriteLine("CallStaticObjectMethodPtr : " + clazz.FullName); } #endif JniLocalHandle res = callStaticObjectMethod(envPtr, clazz.jvmHandle, methodIdNative.native, args); ExceptionTest(); return res; }
public JniLocalHandle CallObjectMethodPtr(IJvmProxy obj, MethodId methodIdNative, params Value[] args) { #if DEBUG if (Bridge.Setup.VeryVerbose) { Console.WriteLine("CallObjectMethodPtr : " + obj.GetType().FullName); } #endif JniLocalHandle res = callObjectMethod(envPtr, obj.JvmHandle, methodIdNative.native, args); ExceptionTest(); return(res); }
public JniLocalHandle CallObjectMethodPtr(IJvmProxy obj, MethodId methodIdNative, params Value[] args) { #if DEBUG if (Bridge.Setup.VeryVerbose) { Console.WriteLine("CallObjectMethodPtr : " + obj.GetType().FullName); } #endif JniLocalHandle res = callObjectMethod(envPtr, obj.JvmHandle, methodIdNative.native, args); ExceptionTest(); return res; }
private int CallIntMethod(IJvmProxy obj, string method, string sig, params Value[] args) { Class objectClass = GetObjectClass(obj); if (objectClass != null) { MethodId methodId = GetMethodID(objectClass, method, sig); if (methodId != null) { return(CallIntMethod(obj, methodId, args)); } } throw new ArgumentException(); }
public TRes CallObjectMethod <TRes>(IJvmProxy obj, MethodId methodIdNative, params Value[] args) { JniLocalHandle res = CallObjectMethodPtr(obj, methodIdNative, args); return(Convertor.FullJ2C <TRes>(this, res)); }
public TRes CallStaticObjectMethod <TRes>(Class clazz, MethodId methodIdNative, params Value[] args) { JniLocalHandle res = CallStaticObjectMethodPtr(clazz, methodIdNative, args); return(Convertor.FullJ2C <TRes>(this, res)); }
private static void Init() { if (initDone) { return; } try { initDone = true; // sun JVM specific JNIEnv env = JNIEnv.ThreadEnv; dbClazz = env.FindClass("java/nio/DirectByteBuffer"); // java 7 and above ctor = env.GetMethodIDNoThrow(dbClazz, "<init>", "(IJLjava/io/FileDescriptor;Ljava/lang/Runnable;)V"); if (ctor == null) { // java 6 and below ctor = env.GetMethodIDNoThrow(dbClazz, "<init>", "(IJLjava/lang/Runnable;)V"); jdk6 = true; } } catch (Exception) { } }
public void CallVoidMethod(JniHandle obj, MethodId methodId, params Value[] args) { callVoidMethod(envPtr, obj, methodId.native, args); //TODO result could be tested in Java 1.6 ExceptionTest(); }