// // Exception audit: // // Verdict // Exception wrapping is required. // // Rationale // `java.util.List.get(int)` throws an exceptions, see: // // https://developer.android.com/reference/java/util/List.html?hl=en#get(int) // internal object InternalGet(int location, Type targetType = null) { if (id_get == IntPtr.Zero) { id_get = JNIEnv.GetMethodID(arraylist_class, "get", "(I)Ljava/lang/Object;"); } IntPtr obj; try { obj = JNIEnv.CallObjectMethod(Handle, id_get, new JValue(location)); } catch (Java.Lang.IndexOutOfBoundsException ex) when(JNIEnv.ShouldWrapJavaException(ex)) { throw new ArgumentOutOfRangeException(ex.Message, ex); } return(JavaConvert.FromJniHandle( obj, JniHandleOwnership.TransferLocalRef, targetType)); }
// // Exception audit: // // Verdict // Exception wrapping is required. // // Rationale // `java.util.Set.remove(Object)` throws a number of exceptions, see: // // https://developer.android.com/reference/java/util/Set?hl=en#remove(java.lang.Object) // public void Remove(object item) { if (id_remove == IntPtr.Zero) { id_remove = JNIEnv.GetMethodID(set_class, "remove", "(Ljava/lang/Object;)Z"); } JavaConvert.WithLocalJniHandle(item, lref => { try { return(JNIEnv.CallBooleanMethod(Handle, id_remove, new JValue(lref))); } catch (Java.Lang.UnsupportedOperationException ex) when(JNIEnv.ShouldWrapJavaException(ex)) { throw new NotSupportedException(ex.Message, ex); } catch (Java.Lang.ClassCastException ex) when(JNIEnv.ShouldWrapJavaException(ex)) { throw new InvalidCastException(ex.Message, ex); } catch (Java.Lang.NullPointerException ex) when(JNIEnv.ShouldWrapJavaException(ex)) { throw new NullReferenceException(ex.Message, ex); } }); }
// // Exception audit: // // Verdict // Exception wrapping is required. // // Rationale // `java.util.Map.put(K, V)` throws a number of exceptions, see: // // https://developer.android.com/reference/java/util/Map#put(K,%20V) // internal void Put (object key, object value) { if (id_put == IntPtr.Zero) id_put = JNIEnv.GetMethodID (map_class, "put", "(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;"); IntPtr r = JavaConvert.WithLocalJniHandle (key, lrefKey => JavaConvert.WithLocalJniHandle (value, lrefValue => { try { return JNIEnv.CallObjectMethod (Handle, id_put, new JValue (lrefKey), new JValue (lrefValue)); } catch (Java.Lang.UnsupportedOperationException ex) when (JNIEnv.ShouldWrapJavaException (ex)) { throw new NotSupportedException (ex.Message, ex); } catch (Java.Lang.ClassCastException ex) when (JNIEnv.ShouldWrapJavaException (ex)) { throw new InvalidCastException (ex.Message, ex); } catch (Java.Lang.NullPointerException ex) when (JNIEnv.ShouldWrapJavaException (ex)) { throw new NullReferenceException (ex.Message, ex); } catch (Java.Lang.IllegalArgumentException ex) when (JNIEnv.ShouldWrapJavaException (ex)) { throw new ArgumentException (ex.Message, ex); } } ) ); JNIEnv.DeleteLocalRef (r); }
public override Java.Lang.Object? GetItem(int position) { return(JavaObjectExtensions.JavaCast <Java.Lang.Object>(JavaConvert.ToJavaObject(this [position]))); }
protected virtual void OnPostExecute([AllowNull] TResult result) { base.OnPostExecute(JavaObjectExtensions.JavaCast <Java.Lang.Object>(JavaConvert.ToJavaObject(result))); }
protected override void OnPostExecute(Java.Lang.Object?result) { OnPostExecute(JavaConvert.FromJavaObject <TResult> (result)); }
public static async Task PutAsync <T>(this DatabaseReference reference, T obj) => await reference.Push().SetValueAsync(JavaConvert.ToJavaObject(obj));