SwitchBootstraps.TypeSwitch Method

Definition

Links an invokedynamic call site that switches on a reference-type target.

[Android.Runtime.Register("typeSwitch", "(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;[Ljava/lang/Object;)Ljava/lang/invoke/CallSite;", "", ApiSince=36)]
public static Java.Lang.Invoke.CallSite? TypeSwitch(Java.Lang.Invoke.MethodHandles.Lookup? lookup, string? invocationName, Java.Lang.Invoke.MethodType? invocationType, params Java.Lang.Object[]? labels);
[<Android.Runtime.Register("typeSwitch", "(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;[Ljava/lang/Object;)Ljava/lang/invoke/CallSite;", "", ApiSince=36)>]
static member TypeSwitch : Java.Lang.Invoke.MethodHandles.Lookup * string * Java.Lang.Invoke.MethodType * Java.Lang.Object[] -> Java.Lang.Invoke.CallSite

Parameters

lookup
MethodHandles.Lookup

The lookup context with the caller's accessibility privileges.

invocationName
String

Unused.

invocationType
MethodType

The call site invocation type with a reference-type parameter, an int parameter, and an int return type.

labels
Object[]

The case labels, represented by String, Int32, Class, or enum-description values.

Returns

A call site that returns -1 for a null target, the index of the first matching label at or after the restart index, or labels.Length when no label matches.

Attributes

Exceptions

An element of labels is null; invocationType does not accept a reference type and an int and return an int; or a label is not a String, Int32, Class, or enum-description value.

An argument is null.

Remarks

The returned call site produces -1 for a null target. For a non-null target, it searches from the restart index and returns the first matching label index, or labels.Length when no label matches. The restart index must be from zero through labels.Length, inclusive; otherwise, invoking the call site throws IndexOutOfBoundsException.

Java documentation for java.lang.runtime.SwitchBootstraps.typeSwitch.

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