Udostępnij za pośrednictwem


StackWalker.CallerClass Property

Definition

Gets the Class object of the caller who invoked the method that invoked getCallerClass.

public Java.Lang.Class? CallerClass { [Android.Runtime.Register("getCallerClass", "()Ljava/lang/Class;", "", ApiSince=34)] get; }
[<get: Android.Runtime.Register("getCallerClass", "()Ljava/lang/Class;", "", ApiSince=34)>]
member this.CallerClass : Java.Lang.Class

Property Value

Class object of the caller's caller invoking this method.

Attributes

Remarks

Gets the Class object of the caller who invoked the method that invoked getCallerClass.

This method filters Option#SHOW_REFLECT_FRAMES reflection frames, java.lang.invoke.MethodHandle, and Option#SHOW_HIDDEN_FRAMES hidden frames regardless of the Option#SHOW_REFLECT_FRAMES SHOW_REFLECT_FRAMES and Option#SHOW_HIDDEN_FRAMES SHOW_HIDDEN_FRAMES options this StackWalker has been configured with.

This method should be called when a caller frame is present. If it is called from the bottom most frame on the stack, IllegalCallerException will be thrown.

This method throws UnsupportedOperationException if this StackWalker is not configured with the Option#RETAIN_CLASS_REFERENCE RETAIN_CLASS_REFERENCE option.

Java documentation for java.lang.StackWalker.getCallerClass().

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