IKVM11  11
Java SE 11 Virtual Machine for .NET
Loading...
Searching...
No Matches
EventInfo.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*/
24using System.Collections.Generic;
25
26namespace IKVM.Reflection
27{
28
29 internal abstract class EventInfo : MemberInfo
30 {
31
35 protected EventInfo()
36 {
37
38 }
39
40 public sealed override MemberTypes MemberType
41 {
42 get { return MemberTypes.Event; }
43 }
44
45 public abstract EventAttributes Attributes { get; }
46
47 public abstract MethodInfo GetAddMethod(bool nonPublic);
48
49 public abstract MethodInfo GetRaiseMethod(bool nonPublic);
50
51 public abstract MethodInfo GetRemoveMethod(bool nonPublic);
52
53 public abstract MethodInfo[] GetOtherMethods(bool nonPublic);
54
55 public abstract MethodInfo[] __GetMethods();
56
57 public abstract Type EventHandlerType { get; }
58
59 internal abstract bool IsPublic { get; }
60
61 internal abstract bool IsNonPrivate { get; }
62
63 internal abstract bool IsStatic { get; }
64
65 public bool IsSpecialName
66 {
67 get { return (Attributes & EventAttributes.SpecialName) != 0; }
68 }
69
70 public MethodInfo GetAddMethod()
71 {
72 return GetAddMethod(false);
73 }
74
75 public MethodInfo GetRaiseMethod()
76 {
77 return GetRaiseMethod(false);
78 }
79
80 public MethodInfo GetRemoveMethod()
81 {
82 return GetRemoveMethod(false);
83 }
84
85 public MethodInfo[] GetOtherMethods()
86 {
87 return GetOtherMethods(false);
88 }
89
90 public MethodInfo AddMethod
91 {
92 get { return GetAddMethod(true); }
93 }
94
95 public MethodInfo RaiseMethod
96 {
97 get { return GetRaiseMethod(true); }
98 }
99
100 public MethodInfo RemoveMethod
101 {
102 get { return GetRemoveMethod(true); }
103 }
104
105 internal virtual EventInfo BindTypeParameters(Type type)
106 {
107 return new GenericEventInfo(this.DeclaringType.BindTypeParameters(type), this);
108 }
109
110 public override string ToString()
111 {
112 return this.DeclaringType.ToString() + " " + Name;
113 }
114
115 internal sealed override bool BindingFlagsMatch(BindingFlags flags)
116 {
117 return BindingFlagsMatch(IsPublic, flags, BindingFlags.Public, BindingFlags.NonPublic)
118 && BindingFlagsMatch(IsStatic, flags, BindingFlags.Static, BindingFlags.Instance);
119 }
120
121 internal sealed override bool BindingFlagsMatchInherited(BindingFlags flags)
122 {
123 return IsNonPrivate
124 && BindingFlagsMatch(IsPublic, flags, BindingFlags.Public, BindingFlags.NonPublic)
125 && BindingFlagsMatch(IsStatic, flags, BindingFlags.Static | BindingFlags.FlattenHierarchy, BindingFlags.Instance);
126 }
127
128 internal sealed override MemberInfo SetReflectedType(Type type)
129 {
130 return new EventInfoWithReflectedType(type, this);
131 }
132
133 internal sealed override List<CustomAttributeData> GetPseudoCustomAttributes(Type attributeType)
134 {
135 // events don't have pseudo custom attributes
136 return null;
137 }
138
139 }
140
141}
IKVM.Reflection.Type Type
IKVM.Reflection.EventInfo EventInfo
IKVM.Reflection.MemberInfo MemberInfo
IKVM.Reflection.MethodInfo MethodInfo
global::java.lang.invoke.LambdaForm.Name Name