2005-06-05 Peter Bartok <pbartok@novell.com>
[mono.git] / mcs / class / corlib / System.Reflection / TypeDelegator.cs
1 // System.Reflection/TypeDelegator.cs
2 //
3 // Paolo Molaro (lupus@ximian.com)
4 //
5 // (C) 2002 Ximian, Inc.
6
7 //
8 // Copyright (C) 2004 Novell, Inc (http://www.novell.com)
9 //
10 // Permission is hereby granted, free of charge, to any person obtaining
11 // a copy of this software and associated documentation files (the
12 // "Software"), to deal in the Software without restriction, including
13 // without limitation the rights to use, copy, modify, merge, publish,
14 // distribute, sublicense, and/or sell copies of the Software, and to
15 // permit persons to whom the Software is furnished to do so, subject to
16 // the following conditions:
17 // 
18 // The above copyright notice and this permission notice shall be
19 // included in all copies or substantial portions of the Software.
20 // 
21 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
22 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
23 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
24 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
25 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
26 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
27 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
28 //
29
30 using System;
31 using System.Reflection;
32 using System.Globalization;
33
34 namespace System.Reflection {
35
36         [Serializable]
37         public class TypeDelegator : Type {
38                 protected Type typeImpl;
39         
40                 protected TypeDelegator () {
41                 }
42
43                 public TypeDelegator( Type delegatingType)
44                 {
45                         if (delegatingType == null)
46                                 throw new ArgumentNullException ("delegatingType must be non-null");
47                         typeImpl = delegatingType;
48                 }
49
50                 public override Assembly Assembly {
51                         get { return typeImpl.Assembly; }
52                 }
53
54                 public override string AssemblyQualifiedName {
55                         get { return typeImpl.AssemblyQualifiedName; }
56                 }
57
58                 public override Type BaseType {
59                         get { return typeImpl.BaseType; }
60                 }
61
62                 public override string FullName {
63                         get { return typeImpl.FullName; }
64                 }
65
66                 public override Guid GUID {
67                         get { return typeImpl.GUID; }
68                 }
69
70                 public override Module Module {
71                         get { return typeImpl.Module; }
72                 }
73
74                 public override string Name {
75                         get { return typeImpl.Name; }
76                 }
77
78                 public override string Namespace {
79                         get { return typeImpl.Namespace; }
80                 }
81
82                 public override RuntimeTypeHandle TypeHandle {
83                         get { return typeImpl.TypeHandle; }
84                 }
85
86                 public override Type UnderlyingSystemType {
87                         get { return typeImpl.UnderlyingSystemType; }
88                 }
89
90                 protected override TypeAttributes GetAttributeFlagsImpl ()
91                 {
92                         return typeImpl.Attributes;
93                 }
94                 
95                 protected override ConstructorInfo GetConstructorImpl (
96                         BindingFlags bindingAttr, Binder binder, CallingConventions callConvention,
97                         Type[] types, ParameterModifier[] modifiers)
98                 {
99                         return typeImpl.GetConstructor (bindingAttr, binder, callConvention, types, modifiers);
100                 }
101
102                 public override ConstructorInfo[] GetConstructors( BindingFlags bindingAttr)
103                 {
104                         return typeImpl.GetConstructors (bindingAttr);
105                 }
106
107                 public override object[] GetCustomAttributes (bool inherit)
108                 {
109                         return typeImpl.GetCustomAttributes (inherit);
110                 }
111
112                 public override object[] GetCustomAttributes (Type attributeType, bool inherit)
113                 {
114                         return typeImpl.GetCustomAttributes (attributeType, inherit);
115                 }
116
117                 public override Type GetElementType()
118                 {
119                         return typeImpl.GetElementType ();
120                 }
121
122                 public override EventInfo GetEvent( string name, BindingFlags bindingAttr)
123                 {
124                         return typeImpl.GetEvent (name, bindingAttr);
125                 }
126
127                 public override EventInfo[] GetEvents()
128                 {
129                         return GetEvents (BindingFlags.Public);
130                 }
131
132                 public override EventInfo[] GetEvents (BindingFlags bindingAttr)
133                 {
134                         return typeImpl.GetEvents (bindingAttr);
135                 }
136
137                 public override FieldInfo GetField (string name, BindingFlags bindingAttr)
138                 {
139                         return typeImpl.GetField (name, bindingAttr);
140                 }
141
142                 public override FieldInfo[] GetFields( BindingFlags bindingAttr)
143                 {
144                         return typeImpl.GetFields (bindingAttr);
145                 }
146
147                 public override Type GetInterface( string name, bool ignoreCase)
148                 {
149                         return typeImpl.GetInterface (name, ignoreCase);
150                 }
151
152                 public override InterfaceMapping GetInterfaceMap( Type interfaceType)
153                 {
154                         return typeImpl.GetInterfaceMap (interfaceType);
155                 }
156                 
157                 public override Type[] GetInterfaces ()
158                 {
159                         return typeImpl.GetInterfaces ();
160                 }
161
162                 public override MemberInfo[] GetMember( string name, MemberTypes type, BindingFlags bindingAttr)
163                 {
164                         return typeImpl.GetMember (name, type, bindingAttr);
165                 }
166
167                 public override MemberInfo[] GetMembers( BindingFlags bindingAttr)
168                 {
169                         return typeImpl.GetMembers (bindingAttr);
170                 }
171
172                 protected override MethodInfo GetMethodImpl( string name, BindingFlags bindingAttr, Binder binder, CallingConventions callConvention, Type[] types, ParameterModifier[] modifiers)
173                 {
174                         // Can't call GetMethod since it makes restrictive argument checks
175                         return typeImpl.GetMethodImplInternal (name, bindingAttr, binder, callConvention, types, modifiers);
176                 }
177
178                 public override MethodInfo[] GetMethods( BindingFlags bindingAttr)
179                 {
180                         return typeImpl.GetMethods (bindingAttr);
181                 }
182
183                 public override Type GetNestedType( string name, BindingFlags bindingAttr)
184                 {
185                         return typeImpl.GetNestedType (name, bindingAttr);
186                 }
187
188                 public override Type[] GetNestedTypes( BindingFlags bindingAttr)
189                 {
190                         return typeImpl.GetNestedTypes (bindingAttr);
191                 }
192
193                 public override PropertyInfo[] GetProperties( BindingFlags bindingAttr)
194                 {
195                         return typeImpl.GetProperties (bindingAttr);
196                 }
197
198                 protected override PropertyInfo GetPropertyImpl( string name, BindingFlags bindingAttr, Binder binder, Type returnType, Type[] types, ParameterModifier[] modifiers)
199                 {
200                         // Can't call GetProperty since it makes restrictive argument checks
201                         return typeImpl.GetPropertyImplInternal (name, bindingAttr, binder, returnType, types, modifiers);
202                 }
203
204                 protected override bool HasElementTypeImpl()
205                 {
206                         return typeImpl.HasElementType;
207                 }
208
209                 public override object InvokeMember( string name, BindingFlags invokeAttr, Binder binder, object target, object[] args, ParameterModifier[] modifiers, CultureInfo culture, string[] namedParameters) {
210                         return typeImpl.InvokeMember (name, invokeAttr, binder, target, args, modifiers, culture, namedParameters);
211                 }
212
213                 protected override bool IsArrayImpl()
214                 {
215                         return typeImpl.IsArray;
216                 }
217
218                 protected override bool IsByRefImpl()
219                 {
220                         return typeImpl.IsByRef;
221                 }
222
223                 protected override bool IsCOMObjectImpl()
224                 {
225                         return typeImpl.IsCOMObject;
226                 }
227
228                 public override bool IsDefined( Type attributeType, bool inherit) {
229                         return typeImpl.IsDefined (attributeType, inherit);
230                 }
231
232                 protected override bool IsPointerImpl()
233                 {
234                         return typeImpl.IsPointer;
235                 }
236
237                 protected override bool IsPrimitiveImpl()
238                 {
239                         return typeImpl.IsPrimitive;
240                 }
241
242                 protected override bool IsValueTypeImpl()
243                 {
244                         return typeImpl.IsValueType;
245                 }
246
247 #if NET_2_0 || BOOTSTRAP_NET_2_0
248                 public override Type[] GetGenericArguments ()
249                 {
250                         throw new NotImplementedException ();
251                 }
252
253                 public override bool HasGenericArguments {
254                         get {
255                                 throw new NotImplementedException ();
256                         }
257                 }
258
259                 public override bool ContainsGenericParameters {
260                         get {
261                                 throw new NotImplementedException ();
262                         }
263                 }
264
265                 public override bool IsGenericParameter {
266                         get {
267                                 throw new NotImplementedException ();
268                         }
269                 }
270
271                 public override int GenericParameterPosition {
272                         get {
273                                 throw new NotImplementedException ();
274                         }
275                 }
276
277                 public override MethodInfo DeclaringMethod {
278                         get {
279                                 throw new NotImplementedException ();
280                         }
281                 }
282 #endif
283
284         }
285 }