blob: 3dea39c2cfdfa07a6264082e35ada59f86ee1b60 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
/*
* System.Reflection-like API for access to .NET assemblies (DLL & EXE)
*/
// $Id$
package ch.epfl.lamp.compiler.msil;
/**
* Discovers the attributes of a class constructor and provides
* access to constructor metadata.
* ConstructorInfo is used to discover the attributes of a constructor
* as well as to invoke a constructor. Objects are created by invoking
* either the GetConstructors or GetConstructor method of a Type object.
*
* @author Nikolay Mihaylov
* @version 1.0
*/
public class ConstructorInfo extends MethodBase {
//##########################################################################
public final int MemberType() { return MemberTypes.Constructor; }
public final boolean IsConstructor() { return true; }
protected static final String CTOR = ".ctor";
protected static final String CCTOR = ".cctor";
protected static final ConstructorInfo[] EMPTY_ARRAY =
new ConstructorInfo[0];
protected static String getName(int attrs) {
return (attrs & MethodAttributes.Static) == 0 ? CTOR : CCTOR;
}
/** Protected constructor */
protected ConstructorInfo(Type declType, int attrs, Type[] paramTypes) {
super(getName(attrs), declType, attrs, paramTypes);
assert declType != null : "Owner can't be 'null' for a constructor!";
}
protected ConstructorInfo(Type declType, int attrs, ParameterInfo[] params)
{
super(getName(attrs), declType, attrs, params);
assert declType != null : "Owner can't be 'null' for a constructor!";
}
public String toString() {
return MethodAttributes.toString(Attributes) + " " + Type.VOID() +
" " + DeclaringType.FullName + "::" + Name + params2String();
}
//##########################################################################
} // class ConstructorInfo
|