/Java.Lang.Object.cs Secret
Created
November 5, 2020 17:50
Java.Lang.Object.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using Android.Runtime; | |
using Java.Interop; | |
namespace Java.Lang { | |
/// <summary>Class <c>Object</c> is the root of the class hierarchy.</summary> | |
/// <remarks> | |
/// <para>Class <c>Object</c> is the root of the class hierarchy. | |
/// Every class has <c>Object</c> as a superclass. All objects, | |
/// including arrays, implement the methods of this class.</para> | |
/// <para>Added in JDK1.0.</para> | |
/// <para>Added in API level 1.</para> | |
/// </remarks> | |
/// <altmember cref="java.lang.Class" /> | |
// Metadata.xml XPath class reference: path="/api/package[@name='java.lang']/class[@name='Object']" | |
[global::Android.Runtime.Register ("java/lang/Object", DoNotGenerateAcw=true)] | |
public partial class Object { | |
static readonly JniPeerMembers _members = new XAPeerMembers ("java/lang/Object", typeof (Object)); | |
internal static IntPtr class_ref { | |
get { return _members.JniPeerType.PeerReference.Handle; } | |
} | |
// Metadata.xml XPath constructor reference: path="/api/package[@name='java.lang']/class[@name='Object']/constructor[@name='Object' and count(parameter)=0]" | |
[Register (".ctor", "()V", "")] | |
protected unsafe Object () : this (IntPtr.Zero, JniHandleOwnership.DoNotTransfer) | |
{ | |
const string __id = "()V"; | |
if (((global::Java.Lang.Object) this).Handle != IntPtr.Zero) | |
return; | |
try { | |
var __r = _members.InstanceMethods.StartCreateInstance (__id, ((object) this).GetType (), null); | |
SetHandle (__r.Handle, JniHandleOwnership.TransferLocalRef); | |
_members.InstanceMethods.FinishCreateInstance (__id, this, null); | |
} finally { | |
} | |
} | |
public unsafe Java.Lang.Class Class { | |
// Metadata.xml XPath method reference: path="/api/package[@name='java.lang']/class[@name='Object']/method[@name='getClass' and count(parameter)=0]" | |
[Register ("getClass", "()Ljava/lang/Class;", "")] | |
get { | |
const string __id = "getClass.()Ljava/lang/Class;"; | |
try { | |
var __rm = _members.InstanceMethods.InvokeNonvirtualObjectMethod (__id, this, null); | |
return global::Java.Lang.Object.GetObject<Java.Lang.Class> (__rm.Handle, JniHandleOwnership.TransferLocalRef)!; | |
} finally { | |
} | |
} | |
} | |
static Delegate? cb_clone; | |
#pragma warning disable 0169 | |
static Delegate GetCloneHandler () | |
{ | |
if (cb_clone == null) | |
cb_clone = JNINativeWrapper.CreateDelegate ((_JniMarshal_PP_L) n_Clone); | |
return cb_clone; | |
} | |
static IntPtr n_Clone (IntPtr jnienv, IntPtr native__this) | |
{ | |
var __this = global::Java.Lang.Object.GetObject<Java.Lang.Object> (jnienv, native__this, JniHandleOwnership.DoNotTransfer)!; | |
return JNIEnv.ToLocalJniHandle (__this.Clone ()); | |
} | |
#pragma warning restore 0169 | |
/// <summary>Creates and returns a copy of this object.</summary> | |
/// <remarks> | |
/// <para>Creates and returns a copy of this object. The precise meaning | |
/// of "copy" may depend on the class of the object. The general | |
/// intent is that, for any object <c>x</c>, the expression: | |
/// <blockquote></para> | |
/// <code lang="text/java">x.clone() != x</code> | |
/// <para></blockquote> | |
/// will be true, and that the expression: | |
/// <blockquote></para> | |
/// <code lang="text/java">x.clone().getClass() == x.getClass()</code> | |
/// <para></blockquote> | |
/// will be <c>true</c>, but these are not absolute requirements. | |
/// While it is typically the case that: | |
/// <blockquote></para> | |
/// <code lang="text/java">x.clone().equals(x)</code> | |
/// <para></blockquote> | |
/// will be <c>true</c>, this is not an absolute requirement.</para> | |
/// <para>By convention, the returned object should be obtained by calling | |
/// <c>super.clone</c>. If a class and all of its superclasses (except | |
/// <c>Object</c>) obey this convention, it will be the case that | |
/// <c>x.clone().getClass() == x.getClass()</c>.</para> | |
/// <para>By convention, the object returned by this method should be independent | |
/// of this object (which is being cloned). To achieve this independence, | |
/// it may be necessary to modify one or more fields of the object returned | |
/// by <c>super.clone</c> before returning it. Typically, this means | |
/// copying any mutable objects that comprise the internal "deep structure" | |
/// of the object being cloned and replacing the references to these | |
/// objects with references to the copies. If a class contains only | |
/// primitive fields or references to immutable objects, then it is usually | |
/// the case that no fields in the object returned by <c>super.clone</c> | |
/// need to be modified.</para> | |
/// <para>The method <c>clone</c> for class <c>Object</c> performs a | |
/// specific cloning operation. First, if the class of this object does | |
/// not implement the interface <c>Cloneable</c>, then a | |
/// <c>CloneNotSupportedException</c> is thrown. Note that all arrays | |
/// are considered to implement the interface <c>Cloneable</c> and that | |
/// the return type of the <c>clone</c> method of an array type <c>T[]</c> | |
/// is <c>T[]</c> where T is any reference or primitive type. | |
/// Otherwise, this method creates a new instance of the class of this | |
/// object and initializes all its fields with exactly the contents of | |
/// the corresponding fields of this object, as if by assignment; the | |
/// contents of the fields are not themselves cloned. Thus, this method | |
/// performs a "shallow copy" of this object, not a "deep copy" operation.</para> | |
/// <para>The class <c>Object</c> does not itself implement the interface | |
/// <c>Cloneable</c>, so calling the <c>clone</c> method on an object | |
/// whose class is <c>Object</c> will result in throwing an | |
/// exception at run time.</para> | |
/// <para>Added in API level 1.</para> | |
/// </remarks> | |
/// <returns>a clone of this instance.</returns> | |
/// <exception cref="CloneNotSupportedException">if the object's class does not | |
/// support the <c>Cloneable</c> interface. Subclasses | |
/// that override the <c>clone</c> method can also | |
/// throw this exception to indicate that an instance cannot | |
/// be cloned.</exception> | |
/// <altmember cref="java.lang.Cloneable" /> | |
// Metadata.xml XPath method reference: path="/api/package[@name='java.lang']/class[@name='Object']/method[@name='clone' and count(parameter)=0]" | |
[Register ("clone", "()Ljava/lang/Object;", "GetCloneHandler")] | |
protected virtual unsafe Java.Lang.Object Clone () | |
{ | |
const string __id = "clone.()Ljava/lang/Object;"; | |
try { | |
var __rm = _members.InstanceMethods.InvokeVirtualObjectMethod (__id, this, null); | |
return global::Java.Lang.Object.GetObject<Java.Lang.Object> (__rm.Handle, JniHandleOwnership.TransferLocalRef)!; | |
} finally { | |
} | |
} | |
static Delegate? cb_equals_Ljava_lang_Object_; | |
#pragma warning disable 0169 | |
static Delegate GetEquals_Ljava_lang_Object_Handler () | |
{ | |
if (cb_equals_Ljava_lang_Object_ == null) | |
cb_equals_Ljava_lang_Object_ = JNINativeWrapper.CreateDelegate ((_JniMarshal_PPL_Z) n_Equals_Ljava_lang_Object_); | |
return cb_equals_Ljava_lang_Object_; | |
} | |
static bool n_Equals_Ljava_lang_Object_ (IntPtr jnienv, IntPtr native__this, IntPtr native_obj) | |
{ | |
var __this = global::Java.Lang.Object.GetObject<Java.Lang.Object> (jnienv, native__this, JniHandleOwnership.DoNotTransfer)!; | |
var obj = global::Java.Lang.Object.GetObject<Java.Lang.Object> (native_obj, JniHandleOwnership.DoNotTransfer); | |
bool __ret = __this.Equals (obj); | |
return __ret; | |
} | |
#pragma warning restore 0169 | |
/// <param name="obj">the reference object with which to compare.</param> | |
/// <summary>Indicates whether some other object is "equal to" this one.</summary> | |
/// <remarks> | |
/// <para>Indicates whether some other object is "equal to" this one.</para> | |
/// <para>The <c>equals</c> method implements an equivalence relation | |
/// on non-null object references: | |
/// <ul> | |
/// <li>It is <i>reflexive</i>: for any non-null reference value | |
/// <c>x</c>, <c>x.equals(x)</c> should return | |
/// <c>true</c>. | |
/// <li>It is <i>symmetric</i>: for any non-null reference values | |
/// <c>x</c> and <c>y</c>, <c>x.equals(y)</c> | |
/// should return <c>true</c> if and only if | |
/// <c>y.equals(x)</c> returns <c>true</c>. | |
/// <li>It is <i>transitive</i>: for any non-null reference values | |
/// <c>x</c>, <c>y</c>, and <c>z</c>, if | |
/// <c>x.equals(y)</c> returns <c>true</c> and | |
/// <c>y.equals(z)</c> returns <c>true</c>, then | |
/// <c>x.equals(z)</c> should return <c>true</c>. | |
/// <li>It is <i>consistent</i>: for any non-null reference values | |
/// <c>x</c> and <c>y</c>, multiple invocations of | |
/// <c>x.equals(y)</c> consistently return <c>true</c> | |
/// or consistently return <c>false</c>, provided no | |
/// information used in <c>equals</c> comparisons on the | |
/// objects is modified. | |
/// <li>For any non-null reference value <c>x</c>, | |
/// <c>x.equals(null)</c> should return <c>false</c>. | |
/// </ul></para> | |
/// <para>The <c>equals</c> method for class <c>Object</c> implements | |
/// the most discriminating possible equivalence relation on objects; | |
/// that is, for any non-null reference values <c>x</c> and | |
/// <c>y</c>, this method returns <c>true</c> if and only | |
/// if <c>x</c> and <c>y</c> refer to the same object | |
/// (<c>x == y</c> has the value <c>true</c>).</para> | |
/// <para>Note that it is generally necessary to override the <c>hashCode</c> | |
/// method whenever this method is overridden, so as to maintain the | |
/// general contract for the <c>hashCode</c> method, which states | |
/// that equal objects must have equal hash codes.</para> | |
/// <para>Added in API level 1.</para> | |
/// </remarks> | |
/// <returns> | |
/// <c>true</c> if this object is the same as the obj | |
/// argument; <c>false</c> otherwise.</returns> | |
/// <altmember cref="#hashCode()" /> | |
/// <altmember cref="java.util.HashMap" /> | |
// Metadata.xml XPath method reference: path="/api/package[@name='java.lang']/class[@name='Object']/method[@name='equals' and count(parameter)=1 and parameter[1][@type='java.lang.Object']]" | |
[Register ("equals", "(Ljava/lang/Object;)Z", "GetEquals_Ljava_lang_Object_Handler")] | |
public virtual unsafe bool Equals (Java.Lang.Object? obj) | |
{ | |
const string __id = "equals.(Ljava/lang/Object;)Z"; | |
try { | |
JniArgumentValue* __args = stackalloc JniArgumentValue [1]; | |
__args [0] = new JniArgumentValue ((obj == null) ? IntPtr.Zero : ((global::Java.Lang.Object) obj).Handle); | |
var __rm = _members.InstanceMethods.InvokeVirtualBooleanMethod (__id, this, __args); | |
return __rm; | |
} finally { | |
global::System.GC.KeepAlive (obj); | |
} | |
} | |
static Delegate? cb_finalize; | |
#pragma warning disable 0169 | |
static Delegate GetJavaFinalizeHandler () | |
{ | |
if (cb_finalize == null) | |
cb_finalize = JNINativeWrapper.CreateDelegate ((_JniMarshal_PP_V) n_JavaFinalize); | |
return cb_finalize; | |
} | |
static void n_JavaFinalize (IntPtr jnienv, IntPtr native__this) | |
{ | |
var __this = global::Java.Lang.Object.GetObject<Java.Lang.Object> (jnienv, native__this, JniHandleOwnership.DoNotTransfer)!; | |
__this.JavaFinalize (); | |
} | |
#pragma warning restore 0169 | |
/// <summary>Called by the garbage collector on an object when garbage collection | |
/// determines that there are no more references to the object.</summary> | |
/// <remarks> | |
/// <para>Called by the garbage collector on an object when garbage collection | |
/// determines that there are no more references to the object. | |
/// A subclass overrides the <c>finalize</c> method to dispose of | |
/// system resources or to perform other cleanup.</para> | |
/// <para>The general contract of <c>finalize</c> is that it is invoked | |
/// if and when the Java&trade; virtual | |
/// machine has determined that there is no longer any | |
/// means by which this object can be accessed by any thread that has | |
/// not yet died, except as a result of an action taken by the | |
/// finalization of some other object or class which is ready to be | |
/// finalized. The <c>finalize</c> method may take any action, including | |
/// making this object available again to other threads; the usual purpose | |
/// of <c>finalize</c>, however, is to perform cleanup actions before | |
/// the object is irrevocably discarded. For example, the finalize method | |
/// for an object that represents an input/output connection might perform | |
/// explicit I/O transactions to break the connection before the object is | |
/// permanently discarded.</para> | |
/// <para>The <c>finalize</c> method of class <c>Object</c> performs no | |
/// special action; it simply returns normally. Subclasses of | |
/// <c>Object</c> may override this definition.</para> | |
/// <para>The Java programming language does not guarantee which thread will | |
/// invoke the <c>finalize</c> method for any given object. It is | |
/// guaranteed, however, that the thread that invokes finalize will not | |
/// be holding any user-visible synchronization locks when finalize is | |
/// invoked. If an uncaught exception is thrown by the finalize method, | |
/// the exception is ignored and finalization of that object terminates.</para> | |
/// <para>After the <c>finalize</c> method has been invoked for an object, no | |
/// further action is taken until the Java virtual machine has again | |
/// determined that there is no longer any means by which this object can | |
/// be accessed by any thread that has not yet died, including possible | |
/// actions by other objects or classes which are ready to be finalized, | |
/// at which point the object may be discarded.</para> | |
/// <para>The <c>finalize</c> method is never invoked more than once by a Java | |
/// virtual machine for any given object.</para> | |
/// <para>Any exception thrown by the <c>finalize</c> method causes | |
/// the finalization of this object to be halted, but is otherwise | |
/// ignored.</para> | |
/// <para>Added in API level 1.</para> | |
/// </remarks> | |
/// <exception cref="Throwable">the <c>Exception</c> raised by this method</exception> | |
/// <altmember cref="java.lang.ref.WeakReference" /> | |
/// <altmember cref="java.lang.ref.PhantomReference" /> | |
// Metadata.xml XPath method reference: path="/api/package[@name='java.lang']/class[@name='Object']/method[@name='finalize' and count(parameter)=0]" | |
[Register ("finalize", "()V", "GetJavaFinalizeHandler")] | |
protected virtual unsafe void JavaFinalize () | |
{ | |
const string __id = "finalize.()V"; | |
try { | |
_members.InstanceMethods.InvokeVirtualVoidMethod (__id, this, null); | |
} finally { | |
} | |
} | |
static Delegate? cb_hashCode; | |
#pragma warning disable 0169 | |
static Delegate GetGetHashCodeHandler () | |
{ | |
if (cb_hashCode == null) | |
cb_hashCode = JNINativeWrapper.CreateDelegate ((_JniMarshal_PP_I) n_GetHashCode); | |
return cb_hashCode; | |
} | |
static int n_GetHashCode (IntPtr jnienv, IntPtr native__this) | |
{ | |
var __this = global::Java.Lang.Object.GetObject<Java.Lang.Object> (jnienv, native__this, JniHandleOwnership.DoNotTransfer)!; | |
return __this.GetHashCode (); | |
} | |
#pragma warning restore 0169 | |
/// <summary>Returns a hash code value for the object.</summary> | |
/// <remarks> | |
/// <para>Returns a hash code value for the object. This method is | |
/// supported for the benefit of hash tables such as those provided by | |
/// <c><see cref="java.util.HashMap" /></c>.</para> | |
/// <para>The general contract of <c>hashCode</c> is: | |
/// <ul> | |
/// <li>Whenever it is invoked on the same object more than once during | |
/// an execution of a Java application, the <c>hashCode</c> method | |
/// must consistently return the same integer, provided no information | |
/// used in <c>equals</c> comparisons on the object is modified. | |
/// This integer need not remain consistent from one execution of an | |
/// application to another execution of the same application. | |
/// <li>If two objects are equal according to the <c>equals(Object)</c> | |
/// method, then calling the <c>hashCode</c> method on each of | |
/// the two objects must produce the same integer result. | |
/// <li>It is <em>not</em> required that if two objects are unequal | |
/// according to the <c><see cref="java.lang.Object#equals(java.lang.Object)" /></c> | |
/// method, then calling the <c>hashCode</c> method on each of the | |
/// two objects must produce distinct integer results. However, the | |
/// programmer should be aware that producing distinct integer results | |
/// for unequal objects may improve the performance of hash tables. | |
/// </ul></para> | |
/// <para>As much as is reasonably practical, the hashCode method defined by | |
/// class <c>Object</c> does return distinct integers for distinct | |
/// objects. (This is typically implemented by converting the internal | |
/// address of the object into an integer, but this implementation | |
/// technique is not required by the | |
/// Java&trade; programming language.)</para> | |
/// <para>Added in API level 1.</para> | |
/// </remarks> | |
/// <returns>a hash code value for this object.</returns> | |
/// <altmember cref="java.lang.Object#equals(java.lang.Object)" /> | |
/// <altmember cref="java.lang.System#identityHashCode" /> | |
// Metadata.xml XPath method reference: path="/api/package[@name='java.lang']/class[@name='Object']/method[@name='hashCode' and count(parameter)=0]" | |
[Register ("hashCode", "()I", "GetGetHashCodeHandler")] | |
public override unsafe int GetHashCode () | |
{ | |
const string __id = "hashCode.()I"; | |
try { | |
var __rm = _members.InstanceMethods.InvokeVirtualInt32Method (__id, this, null); | |
return __rm; | |
} finally { | |
} | |
} | |
/// <summary>Wakes up a single thread that is waiting on this object's | |
/// monitor.</summary> | |
/// <remarks> | |
/// <para>Wakes up a single thread that is waiting on this object's | |
/// monitor. If any threads are waiting on this object, one of them | |
/// is chosen to be awakened. The choice is arbitrary and occurs at | |
/// the discretion of the implementation. A thread waits on an object's | |
/// monitor by calling one of the <c>wait</c> methods.</para> | |
/// <para>The awakened thread will not be able to proceed until the current | |
/// thread relinquishes the lock on this object. The awakened thread will | |
/// compete in the usual manner with any other threads that might be | |
/// actively competing to synchronize on this object; for example, the | |
/// awakened thread enjoys no reliable privilege or disadvantage in being | |
/// the next thread to lock this object.</para> | |
/// <para>This method should only be called by a thread that is the owner | |
/// of this object's monitor. A thread becomes the owner of the | |
/// object's monitor in one of three ways: | |
/// <ul> | |
/// <li>By executing a synchronized instance method of that object. | |
/// <li>By executing the body of a <c>synchronized</c> statement | |
/// that synchronizes on the object. | |
/// <li>For objects of type <c>Class,</c> by executing a | |
/// synchronized static method of that class. | |
/// </ul></para> | |
/// <para>Only one thread at a time can own an object's monitor.</para> | |
/// <para>Added in API level 1.</para> | |
/// </remarks> | |
/// <exception cref="IllegalMonitorStateException">if the current thread is not | |
/// the owner of this object's monitor.</exception> | |
/// <altmember cref="java.lang.Object#notifyAll()" /> | |
/// <altmember cref="java.lang.Object#wait()" /> | |
// Metadata.xml XPath method reference: path="/api/package[@name='java.lang']/class[@name='Object']/method[@name='notify' and count(parameter)=0]" | |
[Register ("notify", "()V", "")] | |
public unsafe void Notify () | |
{ | |
const string __id = "notify.()V"; | |
try { | |
_members.InstanceMethods.InvokeNonvirtualVoidMethod (__id, this, null); | |
} finally { | |
} | |
} | |
/// <summary>Wakes up all threads that are waiting on this object's monitor.</summary> | |
/// <remarks> | |
/// <para>Wakes up all threads that are waiting on this object's monitor. A | |
/// thread waits on an object's monitor by calling one of the | |
/// <c>wait</c> methods.</para> | |
/// <para>The awakened threads will not be able to proceed until the current | |
/// thread relinquishes the lock on this object. The awakened threads | |
/// will compete in the usual manner with any other threads that might | |
/// be actively competing to synchronize on this object; for example, | |
/// the awakened threads enjoy no reliable privilege or disadvantage in | |
/// being the next thread to lock this object.</para> | |
/// <para>This method should only be called by a thread that is the owner | |
/// of this object's monitor. See the <c>notify</c> method for a | |
/// description of the ways in which a thread can become the owner of | |
/// a monitor.</para> | |
/// <para>Added in API level 1.</para> | |
/// </remarks> | |
/// <exception cref="IllegalMonitorStateException">if the current thread is not | |
/// the owner of this object's monitor.</exception> | |
/// <altmember cref="java.lang.Object#notify()" /> | |
/// <altmember cref="java.lang.Object#wait()" /> | |
// Metadata.xml XPath method reference: path="/api/package[@name='java.lang']/class[@name='Object']/method[@name='notifyAll' and count(parameter)=0]" | |
[Register ("notifyAll", "()V", "")] | |
public unsafe void NotifyAll () | |
{ | |
const string __id = "notifyAll.()V"; | |
try { | |
_members.InstanceMethods.InvokeNonvirtualVoidMethod (__id, this, null); | |
} finally { | |
} | |
} | |
static Delegate? cb_toString; | |
#pragma warning disable 0169 | |
static Delegate GetToStringHandler () | |
{ | |
if (cb_toString == null) | |
cb_toString = JNINativeWrapper.CreateDelegate ((_JniMarshal_PP_L) n_ToString); | |
return cb_toString; | |
} | |
static IntPtr n_ToString (IntPtr jnienv, IntPtr native__this) | |
{ | |
var __this = global::Java.Lang.Object.GetObject<Java.Lang.Object> (jnienv, native__this, JniHandleOwnership.DoNotTransfer)!; | |
return JNIEnv.NewString (__this.ToString ()); | |
} | |
#pragma warning restore 0169 | |
/// <summary>Returns a string representation of the object.</summary> | |
/// <remarks> | |
/// <para>Returns a string representation of the object. In general, the | |
/// <c>toString</c> method returns a string that | |
/// "textually represents" this object. The result should | |
/// be a concise but informative representation that is easy for a | |
/// person to read. | |
/// It is recommended that all subclasses override this method.</para> | |
/// <para>The <c>toString</c> method for class <c>Object</c> | |
/// returns a string consisting of the name of the class of which the | |
/// object is an instance, the at-sign character `<c>@</c>', and | |
/// the unsigned hexadecimal representation of the hash code of the | |
/// object. In other words, this method returns a string equal to the | |
/// value of: | |
/// <blockquote></para> | |
/// <code lang="text/java">getClass().getName() + '@' + Integer.toHexString(hashCode()) | |
/// </code> | |
/// <para></blockquote></para> | |
/// <para>Added in API level 1.</para> | |
/// </remarks> | |
/// <returns>a string representation of the object.</returns> | |
// Metadata.xml XPath method reference: path="/api/package[@name='java.lang']/class[@name='Object']/method[@name='toString' and count(parameter)=0]" | |
[Register ("toString", "()Ljava/lang/String;", "GetToStringHandler")] | |
public override unsafe string ToString () | |
{ | |
const string __id = "toString.()Ljava/lang/String;"; | |
try { | |
var __rm = _members.InstanceMethods.InvokeVirtualObjectMethod (__id, this, null); | |
return JNIEnv.GetString (__rm.Handle, JniHandleOwnership.TransferLocalRef)!; | |
} finally { | |
} | |
} | |
/// <summary>Causes the current thread to wait until another thread invokes the | |
/// <c><see cref="java.lang.Object#notify()" /></c> method or the | |
/// <c><see cref="java.lang.Object#notifyAll()" /></c> method for this object.</summary> | |
/// <remarks> | |
/// <para>Causes the current thread to wait until another thread invokes the | |
/// <c><see cref="java.lang.Object#notify()" /></c> method or the | |
/// <c><see cref="java.lang.Object#notifyAll()" /></c> method for this object. | |
/// In other words, this method behaves exactly as if it simply | |
/// performs the call <c>wait(0)</c>.</para> | |
/// <para>The current thread must own this object's monitor. The thread | |
/// releases ownership of this monitor and waits until another thread | |
/// notifies threads waiting on this object's monitor to wake up | |
/// either through a call to the <c>notify</c> method or the | |
/// <c>notifyAll</c> method. The thread then waits until it can | |
/// re-obtain ownership of the monitor and resumes execution.</para> | |
/// <para>As in the one argument version, interrupts and spurious wakeups are | |
/// possible, and this method should always be used in a loop:</para> | |
/// <code lang="text/java">synchronized (obj) { | |
/// while (&lt;condition does not hold&gt;) | |
/// obj.wait(); | |
/// ... // Perform action appropriate to condition | |
/// } | |
/// </code> | |
/// <para>This method should only be called by a thread that is the owner | |
/// of this object's monitor. See the <c>notify</c> method for a | |
/// description of the ways in which a thread can become the owner of | |
/// a monitor.</para> | |
/// <para>Added in API level 1.</para> | |
/// </remarks> | |
/// <exception cref="IllegalMonitorStateException">if the current thread is not | |
/// the owner of the object's monitor.</exception> | |
/// <exception cref="InterruptedException">if any thread interrupted the | |
/// current thread before or while the current thread | |
/// was waiting for a notification. The <i>interrupted | |
/// status</i> of the current thread is cleared when | |
/// this exception is thrown.</exception> | |
/// <altmember cref="java.lang.Object#notify()" /> | |
/// <altmember cref="java.lang.Object#notifyAll()" /> | |
// Metadata.xml XPath method reference: path="/api/package[@name='java.lang']/class[@name='Object']/method[@name='wait' and count(parameter)=0]" | |
[Register ("wait", "()V", "")] | |
public unsafe void Wait () | |
{ | |
const string __id = "wait.()V"; | |
try { | |
_members.InstanceMethods.InvokeNonvirtualVoidMethod (__id, this, null); | |
} finally { | |
} | |
} | |
/// <param name="timeout">the maximum time to wait in milliseconds.</param> | |
/// <summary>Causes the current thread to wait until either another thread invokes the | |
/// <c><see cref="java.lang.Object#notify()" /></c> method or the | |
/// <c><see cref="java.lang.Object#notifyAll()" /></c> method for this object, or a | |
/// specified amount of time has elapsed.</summary> | |
/// <remarks> | |
/// <para>Causes the current thread to wait until either another thread invokes the | |
/// <c><see cref="java.lang.Object#notify()" /></c> method or the | |
/// <c><see cref="java.lang.Object#notifyAll()" /></c> method for this object, or a | |
/// specified amount of time has elapsed.</para> | |
/// <para>The current thread must own this object's monitor.</para> | |
/// <para>This method causes the current thread (call it <var>T</var>) to | |
/// place itself in the wait set for this object and then to relinquish | |
/// any and all synchronization claims on this object. Thread <var>T</var> | |
/// becomes disabled for thread scheduling purposes and lies dormant | |
/// until one of four things happens: | |
/// <ul> | |
/// <li>Some other thread invokes the <c>notify</c> method for this | |
/// object and thread <var>T</var> happens to be arbitrarily chosen as | |
/// the thread to be awakened. | |
/// <li>Some other thread invokes the <c>notifyAll</c> method for this | |
/// object. | |
/// <li>Some other thread <see cref="Thread#interrupt() interrupts" /> | |
/// thread <var>T</var>. | |
/// <li>The specified amount of real time has elapsed, more or less. If | |
/// <c>timeout</c> is zero, however, then real time is not taken into | |
/// consideration and the thread simply waits until notified. | |
/// </ul> | |
/// The thread <var>T</var> is then removed from the wait set for this | |
/// object and re-enabled for thread scheduling. It then competes in the | |
/// usual manner with other threads for the right to synchronize on the | |
/// object; once it has gained control of the object, all its | |
/// synchronization claims on the object are restored to the status quo | |
/// ante - that is, to the situation as of the time that the <c>wait</c> | |
/// method was invoked. Thread <var>T</var> then returns from the | |
/// invocation of the <c>wait</c> method. Thus, on return from the | |
/// <c>wait</c> method, the synchronization state of the object and of | |
/// thread <c>T</c> is exactly as it was when the <c>wait</c> method | |
/// was invoked.</para> | |
/// <para>A thread can also wake up without being notified, interrupted, or | |
/// timing out, a so-called <i>spurious wakeup</i>. While this will rarely | |
/// occur in practice, applications must guard against it by testing for | |
/// the condition that should have caused the thread to be awakened, and | |
/// continuing to wait if the condition is not satisfied. In other words, | |
/// waits should always occur in loops, like this one:</para> | |
/// <code lang="text/java">synchronized (obj) { | |
/// while (&lt;condition does not hold&gt;) | |
/// obj.wait(timeout); | |
/// ... // Perform action appropriate to condition | |
/// } | |
/// </code> | |
/// <para>(For more information on this topic, see Section 3.2.3 in Doug Lea's | |
/// "Concurrent Programming in Java (Second Edition)" (Addison-Wesley, | |
/// 2000), or Item 50 in Joshua Bloch's "Effective Java Programming | |
/// Language Guide" (Addison-Wesley, 2001).</para> | |
/// <para>If the current thread is <see cref="java.lang.Thread#interrupt()
interrupted" /> by any thread before or while it is waiting, then an | |
/// <c>InterruptedException</c> is thrown. This exception is not | |
/// thrown until the lock status of this object has been restored as | |
/// described above.</para> | |
/// <para>Note that the <c>wait</c> method, as it places the current thread | |
/// into the wait set for this object, unlocks only this object; any | |
/// other objects on which the current thread may be synchronized remain | |
/// locked while the thread waits.</para> | |
/// <para>This method should only be called by a thread that is the owner | |
/// of this object's monitor. See the <c>notify</c> method for a | |
/// description of the ways in which a thread can become the owner of | |
/// a monitor.</para> | |
/// <para>Added in API level 1.</para> | |
/// </remarks> | |
/// <exception cref="IllegalArgumentException">if the value of timeout is | |
/// negative.</exception> | |
/// <exception cref="IllegalMonitorStateException">if the current thread is not | |
/// the owner of the object's monitor.</exception> | |
/// <exception cref="InterruptedException">if any thread interrupted the | |
/// current thread before or while the current thread | |
/// was waiting for a notification. The <i>interrupted | |
/// status</i> of the current thread is cleared when | |
/// this exception is thrown.</exception> | |
/// <altmember cref="java.lang.Object#notify()" /> | |
/// <altmember cref="java.lang.Object#notifyAll()" /> | |
// Metadata.xml XPath method reference: path="/api/package[@name='java.lang']/class[@name='Object']/method[@name='wait' and count(parameter)=1 and parameter[1][@type='long']]" | |
[Register ("wait", "(J)V", "")] | |
public unsafe void Wait (long timeout) | |
{ | |
const string __id = "wait.(J)V"; | |
try { | |
JniArgumentValue* __args = stackalloc JniArgumentValue [1]; | |
__args [0] = new JniArgumentValue (timeout); | |
_members.InstanceMethods.InvokeNonvirtualVoidMethod (__id, this, __args); | |
} finally { | |
} | |
} | |
/// <param name="timeout">the maximum time to wait in milliseconds.</param> | |
/// <param name="nanos">additional time, in nanoseconds range | |
/// 0-999999.</param> | |
/// <summary>Causes the current thread to wait until another thread invokes the | |
/// <c><see cref="java.lang.Object#notify()" /></c> method or the | |
/// <c><see cref="java.lang.Object#notifyAll()" /></c> method for this object, or | |
/// some other thread interrupts the current thread, or a certain | |
/// amount of real time has elapsed.</summary> | |
/// <remarks> | |
/// <para>Causes the current thread to wait until another thread invokes the | |
/// <c><see cref="java.lang.Object#notify()" /></c> method or the | |
/// <c><see cref="java.lang.Object#notifyAll()" /></c> method for this object, or | |
/// some other thread interrupts the current thread, or a certain | |
/// amount of real time has elapsed.</para> | |
/// <para>This method is similar to the <c>wait</c> method of one | |
/// argument, but it allows finer control over the amount of time to | |
/// wait for a notification before giving up. The amount of real time, | |
/// measured in nanoseconds, is given by: | |
/// <blockquote></para> | |
/// <code lang="text/java">1000000*timeout+nanos</code> | |
/// <para></blockquote></para> | |
/// <para>In all other respects, this method does the same thing as the | |
/// method <c><see cref="#wait(long)" /></c> of one argument. In particular, | |
/// <c>wait(0, 0)</c> means the same thing as <c>wait(0)</c>.</para> | |
/// <para>The current thread must own this object's monitor. The thread | |
/// releases ownership of this monitor and waits until either of the | |
/// following two conditions has occurred: | |
/// <ul> | |
/// <li>Another thread notifies threads waiting on this object's monitor | |
/// to wake up either through a call to the <c>notify</c> method | |
/// or the <c>notifyAll</c> method. | |
/// <li>The timeout period, specified by <c>timeout</c> | |
/// milliseconds plus <c>nanos</c> nanoseconds arguments, has | |
/// elapsed. | |
/// </ul></para> | |
/// <para>The thread then waits until it can re-obtain ownership of the | |
/// monitor and resumes execution.</para> | |
/// <para>As in the one argument version, interrupts and spurious wakeups are | |
/// possible, and this method should always be used in a loop:</para> | |
/// <code lang="text/java">synchronized (obj) { | |
/// while (&lt;condition does not hold&gt;) | |
/// obj.wait(timeout, nanos); | |
/// ... // Perform action appropriate to condition | |
/// } | |
/// </code> | |
/// <para>This method should only be called by a thread that is the owner | |
/// of this object's monitor. See the <c>notify</c> method for a | |
/// description of the ways in which a thread can become the owner of | |
/// a monitor.</para> | |
/// <para>Added in API level 1.</para> | |
/// </remarks> | |
/// <exception cref="IllegalArgumentException">if the value of timeout is | |
/// negative or the value of nanos is | |
/// not in the range 0-999999.</exception> | |
/// <exception cref="IllegalMonitorStateException">if the current thread is not | |
/// the owner of this object's monitor.</exception> | |
/// <exception cref="InterruptedException">if any thread interrupted the | |
/// current thread before or while the current thread | |
/// was waiting for a notification. The <i>interrupted | |
/// status</i> of the current thread is cleared when | |
/// this exception is thrown.</exception> | |
// Metadata.xml XPath method reference: path="/api/package[@name='java.lang']/class[@name='Object']/method[@name='wait' and count(parameter)=2 and parameter[1][@type='long'] and parameter[2][@type='int']]" | |
[Register ("wait", "(JI)V", "")] | |
public unsafe void Wait (long timeout, int nanos) | |
{ | |
const string __id = "wait.(JI)V"; | |
try { | |
JniArgumentValue* __args = stackalloc JniArgumentValue [2]; | |
__args [0] = new JniArgumentValue (timeout); | |
__args [1] = new JniArgumentValue (nanos); | |
_members.InstanceMethods.InvokeNonvirtualVoidMethod (__id, this, __args); | |
} finally { | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment