IKVM11  11
Java SE 11 Virtual Machine for .NET
Loading...
Searching...
No Matches
EventInfoImpl.cs
Go to the documentation of this file.
1/*
2 Copyright (C) 2009-2012 Jeroen Frijters
3
4 This software is provided 'as-is', without any express or implied
5 warranty. In no event will the authors be held liable for any damages
6 arising from the use of this software.
7
8 Permission is granted to anyone to use this software for any purpose,
9 including commercial applications, and to alter it and redistribute it
10 freely, subject to the following restrictions:
11
12 1. The origin of this software must not be misrepresented; you must not
13 claim that you wrote the original software. If you use this software
14 in a product, an acknowledgment in the product documentation would be
15 appreciated but is not required.
16 2. Altered source versions must be plainly marked as such, and must not be
17 misrepresented as being the original software.
18 3. This notice may not be removed or altered from any source distribution.
19
20 Jeroen Frijters
21 jeroen@frijters.net
22
23*/
25
27{
28
29 sealed class EventInfoImpl : EventInfo
30 {
31
32 readonly ModuleReader module;
33 readonly Type declaringType;
34 readonly int index;
35 bool isPublic;
36 bool isNonPrivate;
37 bool isStatic;
38 bool flagsCached;
39
46 internal EventInfoImpl(ModuleReader module, Type declaringType, int index)
47 {
48 this.module = module;
49 this.declaringType = declaringType;
50 this.index = index;
51 }
52
53 public override bool Equals(object obj)
54 {
55 var other = obj as EventInfoImpl;
56 return other != null && other.declaringType == declaringType && other.index == index;
57 }
58
59 public override int GetHashCode()
60 {
61 return declaringType.GetHashCode() * 123 + index;
62 }
63
64 public override EventAttributes Attributes
65 {
66 get { return (EventAttributes)module.EventTable.records[index].EventFlags; }
67 }
68
69 public override MethodInfo GetAddMethod(bool nonPublic)
70 {
71 return module.MethodSemanticsTable.GetMethod(module, this.MetadataToken, nonPublic, MethodSemanticsTable.AddOn);
72 }
73
74 public override MethodInfo GetRaiseMethod(bool nonPublic)
75 {
76 return module.MethodSemanticsTable.GetMethod(module, this.MetadataToken, nonPublic, MethodSemanticsTable.Fire);
77 }
78
79 public override MethodInfo GetRemoveMethod(bool nonPublic)
80 {
81 return module.MethodSemanticsTable.GetMethod(module, this.MetadataToken, nonPublic, MethodSemanticsTable.RemoveOn);
82 }
83
84 public override MethodInfo[] GetOtherMethods(bool nonPublic)
85 {
86 return module.MethodSemanticsTable.GetMethods(module, this.MetadataToken, nonPublic, MethodSemanticsTable.Other);
87 }
88
89 public override MethodInfo[] __GetMethods()
90 {
91 return module.MethodSemanticsTable.GetMethods(module, this.MetadataToken, true, -1);
92 }
93
94 public override Type EventHandlerType
95 {
96 get { return module.ResolveType(module.EventTable.records[index].EventType, declaringType); }
97 }
98
99 public override string Name
100 {
101 get { return module.GetString(module.EventTable.records[index].Name); }
102 }
103
104 public override Type DeclaringType
105 {
106 get { return declaringType; }
107 }
108
109 public override Module Module
110 {
111 get { return module; }
112 }
113
114 public override int MetadataToken
115 {
116 get { return (EventTable.Index << 24) + index + 1; }
117 }
118
119 internal override bool IsPublic
120 {
121 get
122 {
123 if (!flagsCached)
124 ComputeFlags();
125
126 return isPublic;
127 }
128 }
129
130 internal override bool IsNonPrivate
131 {
132 get
133 {
134 if (!flagsCached)
135 ComputeFlags();
136
137 return isNonPrivate;
138 }
139 }
140
141 internal override bool IsStatic
142 {
143 get
144 {
145 if (!flagsCached)
146 ComputeFlags();
147
148 return isStatic;
149 }
150 }
151
152 void ComputeFlags()
153 {
154 module.MethodSemanticsTable.ComputeFlags(module, this.MetadataToken, out isPublic, out isNonPrivate, out isStatic);
155 flagsCached = true;
156 }
157
158 internal override bool IsBaked
159 {
160 get { return true; }
161 }
162
163 internal override int GetCurrentToken()
164 {
165 return this.MetadataToken;
166 }
167
168 }
169
170}
global::java.lang.invoke.LambdaForm.Name Name
override bool Equals(object obj)
override MethodInfo[] GetOtherMethods(bool nonPublic)
override EventAttributes Attributes
override MethodInfo GetRemoveMethod(bool nonPublic)
override MethodInfo[] __GetMethods()
override MethodInfo GetRaiseMethod(bool nonPublic)
override MethodInfo GetAddMethod(bool nonPublic)