IKVM11  11
Java SE 11 Virtual Machine for .NET
Loading...
Searching...
No Matches
SystemAccessor.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 SystemAccessor : Accessor<object>
12 {
13
14 Type ikvmInternalCallerID;
15 Type javaLangSecurityManager;
16
17 FieldAccessor<object> _in;
18 FieldAccessor<object> _out;
19 FieldAccessor<object> _err;
20 MethodAccessor<Action> initializeSystemClass;
21 MethodAccessor<Func<string, string>> getProperty;
22 MethodAccessor<Func<string, string, string>> setProperty;
23 MethodAccessor<Func<object>> getSecurityManager;
24 MethodAccessor<Action<string, object>> loadLibrary;
25
30 public SystemAccessor(AccessorTypeResolver resolver) :
31 base(resolver, "java.lang.System")
32 {
33
34 }
35
36 Type IkvmInternalCallerID => Resolve(ref ikvmInternalCallerID, "ikvm.internal.CallerID");
37
38 Type JavaLangSecurityManager => Resolve(ref javaLangSecurityManager, "java.lang.SecurityManager");
39
45 public void SetIn(object value) => GetField(ref _in, nameof(_in)).SetValue(value);
46
52 public void SetOut(object value) => GetField(ref _out, nameof(_out)).SetValue(value);
53
59 public void SetErr(object value) => GetField(ref _err, nameof(_err)).SetValue(value);
60
65 public void InvokeInitializeSystemClass() => GetMethod(ref initializeSystemClass, nameof(initializeSystemClass), typeof(void)).Invoker();
66
72 public string InvokeGetProperty(string key) => GetMethod(ref getProperty, nameof(getProperty), typeof(string), typeof(string)).Invoker(key);
73
80 public string InvokeSetProperty(string key, string value) => GetMethod(ref setProperty, nameof(setProperty), typeof(string), typeof(string), typeof(string)).Invoker(key, value);
81
86 public object InvokeGetSecurityManager() => GetMethod(ref getSecurityManager, nameof(getSecurityManager), JavaLangSecurityManager).Invoker();
87
93 public void InvokeLoadLibrary(string libname, object callerID) => GetMethod(ref loadLibrary, nameof(loadLibrary), typeof(void), typeof(string), IkvmInternalCallerID).Invoker(libname, callerID);
94
95 }
96
97#endif
98
99}
IKVM.Reflection.Type Type