Partager via


MethodHandles.Lookup.LookupModes Method

Definition

Tells which access-protection classes of members this lookup object can produce.

[Android.Runtime.Register("lookupModes", "()I", "", ApiSince=26)]
public Java.Lang.Invoke.MethodLookupModes LookupModes ();
[<Android.Runtime.Register("lookupModes", "()I", "", ApiSince=26)>]
member this.LookupModes : unit -> Java.Lang.Invoke.MethodLookupModes

Returns

the lookup modes, which limit the kinds of access performed by this lookup object

Attributes

Remarks

Tells which access-protection classes of members this lookup object can produce. The result is a bit-mask of the bits #PUBLIC PUBLIC (0x01), #PRIVATE PRIVATE (0x02), #PROTECTED PROTECTED (0x04), and #PACKAGE PACKAGE (0x08).

A freshly-created lookup object on the java.lang.invoke.MethodHandles#lookup() caller's class has all possible bits set, since the caller class can access all its own members. A lookup object on a new lookup class java.lang.invoke.MethodHandles.Lookup#in created from a previous lookup object may have some mode bits set to zero. The purpose of this is to restrict access via the new lookup object, so that it can access only names which can be reached by the original lookup object, and also by the new lookup class.

Java documentation for java.lang.invoke.MethodHandles.Lookup.lookupModes().

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to