7#if FIRST_PASS == false && EXPORTER == false && IMPORTER == false
12 internal sealed class ThreadAccessor : Accessor<object>
16 Type javaLangThreadGroup;
18 FieldAccessor<object> current;
19 FieldAccessor<object, Thread> nativeThread;
20 MethodAccessor<Func<object>> currentThread;
21 MethodAccessor<Func<bool>> interrupted;
23 MethodAccessor<Func<object, object>> init;
24 MethodAccessor<Func<object, bool>> isDaemon;
25 MethodAccessor<Func<object, bool>> isInterrupted;
26 MethodAccessor<Action<object>> die;
27 MethodAccessor<Func<object, object>> getThreadGroup;
33 public ThreadAccessor(AccessorTypeResolver resolver) :
34 base(resolver,
"java.lang.Thread")
39 Type JavaLangThread => Resolve(
ref javaLangThread,
"java.lang.Thread");
41 Type JavaLangThreadGroup => Resolve(
ref javaLangThreadGroup,
"java.lang.ThreadGroup");
47 public object GetCurrent() => GetField(
ref current, nameof(current)).GetValue();
53 public Thread GetNativeThread(
object self) => GetField(
ref nativeThread, nameof(nativeThread)).GetValue(
self);
58 public object InvokeCurrentThread() => GetMethod(
ref currentThread, nameof(currentThread), JavaLangThread).Invoker();
64 public bool InvokeIsInterrupted(
object self) => GetMethod(
ref isInterrupted, nameof(isInterrupted), typeof(
bool)).Invoker(
self);
71 public object Init(
object threadGroup) => GetConstructor(
ref init, JavaLangThreadGroup).Invoker(threadGroup);
78 public bool InvokeIsDaemon(
object self) => GetMethod(
ref isDaemon, nameof(isDaemon), typeof(
bool)).Invoker(
self);
83 public void InvokeDie(
object self) => GetMethod(
ref die, nameof(die), typeof(
void)).Invoker(
self);
88 public object InvokeGetThreadGroup(
object self) => GetMethod(
ref getThreadGroup, nameof(getThreadGroup), JavaLangThreadGroup).Invoker(
self);
94 public bool InvokeInterrupted() => GetMethod(
ref interrupted, nameof(interrupted), typeof(
bool)).Invoker();
IKVM.Reflection.Type Type