IKVM11  11
Java SE 11 Virtual Machine for .NET
Loading...
Searching...
No Matches
ClassLoaderAccessor.cs
Go to the documentation of this file.
1using System;
2
4{
5
6#if FIRST_PASS == false && EXPORTER == false && IMPORTER == false
7
11 internal sealed class ClassLoaderAccessor : Accessor<object>
12 {
13
14 Type javaLangClass;
15 Type javaLangClassLoader;
16 Type javaSecurityProtectionDomain;
17
18 FieldAccessor<object> scl;
19 FieldAccessor<object> systemNativeLibraries;
20
21 FieldAccessor<object, object> parent;
22 FieldAccessor<object, object> nativeLibraries;
23 MethodAccessor<Action<object, object, object>> checkPackageAccess;
24 MethodAccessor<Func<object, string, object>> loadClassInternal;
25 MethodAccessor<Func<object, string, bool>> checkName;
26 MethodAccessor<Func<object, string, long>> findNative;
27
32 public ClassLoaderAccessor(AccessorTypeResolver resolver) :
33 base(resolver, "java.lang.ClassLoader")
34 {
35
36 }
37
38 Type JavaLangClass => Resolve(ref javaLangClass, "java.lang.Class");
39
40 Type JavaLangClassLoader => Resolve(ref javaLangClassLoader, "java.lang.ClassLoader");
41
42 Type JavaSecurityProtectionDomain => Resolve(ref javaSecurityProtectionDomain, "java.security.ProtectionDomain");
43
47 public object GetScl() => GetField(ref scl, nameof(scl)).GetValue();
48
53 public void SetScl(object value) => GetField(ref scl, nameof(scl)).SetValue(value);
54
58 public object GetSystemNativeLibraries() => GetField(ref systemNativeLibraries, nameof(systemNativeLibraries)).GetValue();
59
65 public object GetParent(object self) => GetField(ref parent, nameof(parent)).GetValue(self);
66
72 public void SetParent(object self, object value) => GetField(ref parent, nameof(parent)).SetValue(self, value);
73
79 public object GetNativeLibraries(object self) => GetField(ref nativeLibraries, nameof(nativeLibraries)).GetValue(self);
80
84 public void InvokeCheckPackageAccess(object self, object cls, object pd) => GetMethod(ref checkPackageAccess, nameof(checkPackageAccess), typeof(void), JavaLangClass, JavaSecurityProtectionDomain).Invoker(self, cls, pd);
85
89 public bool InvokeCheckName(object self, string name) => GetMethod(ref checkName, nameof(checkName), typeof(bool), typeof(string)).Invoker(self, name);
90
94 public object InvokeLoadClassInternal(object self, string name) => GetMethod(ref loadClassInternal, nameof(loadClassInternal), JavaLangClass, typeof(string)).Invoker(self, name);
95
102 public long InvokeFindNative(object loader, string name) => GetMethod(ref findNative, nameof(findNative), typeof(long), JavaLangClassLoader, typeof(string)).Invoker(loader, name);
103
104 }
105
106#endif
107
108}
IKVM.Reflection.Type Type