summaryrefslogtreecommitdiff
path: root/src/msil/ch/epfl/lamp/compiler/msil/MemberTypes.java
blob: 5f49ad33231dc02bc9a4a10b0c91be8eee4ba31a (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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
/*
 * System.Reflection-like API for access to .NET assemblies (DLL & EXE)
 */


package ch.epfl.lamp.compiler.msil;

/**
 * Marks each type of member that is defined as a derived class of MemberInfo.
 *
 * @author Nikolay Mihaylov
 * @version 1.0
 */
public final class MemberTypes {

    //##########################################################################

    /** Specifies that the member is a constructor,
     *  representing a ConstructorInfo member. */
    public static final int Constructor = 0x01;


    /** Specifies that the member is an event,
     *  representing an EventInfo member. */
    public static final int Event = 0x02;


    /** Specifies that the member is a field,
     *	representing a FieldInfo member. */
    public static final int Field = 0x04;


    /** Specifies that the member is a method,
     *  representing a MethodInfo member. */
    public static final int Method = 0x08;


    /** Specifies that the member is a property,
     *  representing a PropertyInfo member.
     */
    public static final int Property = 0x10;

    /** Specifies that the member is a type,
     *  representing a TypeInfo member. */
    public static final int TypeInfo = 0x20;


    /** Specifies that the member is a custom member type. */
    public static final int Custom = 0x40;


    /** Specifies that the member is a nested type,
     *  extending MemberInfo. */
    public static final int NestedType = 0x80;


    /** Specifies all member types. */
    public static final int All =
	Constructor | Event | Field | Method | Property | TypeInfo | NestedType;


    public static String toString(int memberType) {
	if ((memberType & Constructor) != 0) return "Constructor";
	if ((memberType & Event) != 0) return "Event";
	if ((memberType & Field) != 0) return "Field";
	if ((memberType & Method) != 0) return "Method";
	if ((memberType & Property) != 0) return "Property";
	if ((memberType & TypeInfo) != 0) return "TypeInfo";
	if ((memberType & Custom) != 0) return "Custom";
	if ((memberType & NestedType) != 0) return "NestedType";
	return "Unknown MemberType: " + memberType;
    }

    //##########################################################################

    // makes the class uninstantiable
    private MemberTypes() {}

    //##########################################################################

}  // class MemberTypes