IKVM11  11
Java SE 11 Virtual Machine for .NET
Loading...
Searching...
No Matches
EnumBuilder.cs
Go to the documentation of this file.
1/*
2 Copyright (C) 2010 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{
26
27 internal sealed class EnumBuilder : TypeInfo
28 {
29
30 readonly TypeBuilder typeBuilder;
31 readonly FieldBuilder fieldBuilder;
32
38 internal EnumBuilder(TypeBuilder typeBuilder, FieldBuilder fieldBuilder) :
39 base(typeBuilder)
40 {
41 this.typeBuilder = typeBuilder;
42 this.fieldBuilder = fieldBuilder;
43 }
44
45 internal override TypeName TypeName
46 {
47 get { return typeBuilder.TypeName; }
48 }
49
50 public override string Name
51 {
52 get { return typeBuilder.Name; }
53 }
54
55 public override string FullName
56 {
57 get { return typeBuilder.FullName; }
58 }
59
60 public override Type BaseType
61 {
62 get { return typeBuilder.BaseType; }
63 }
64
65 public override TypeAttributes Attributes
66 {
67 get { return typeBuilder.Attributes; }
68 }
69
70 public override Module Module
71 {
72 get { return typeBuilder.Module; }
73 }
74
75 public FieldBuilder DefineLiteral(string literalName, object literalValue)
76 {
77 FieldBuilder fb = typeBuilder.DefineField(literalName, typeBuilder, FieldAttributes.Public | FieldAttributes.Static | FieldAttributes.Literal);
78 fb.SetConstant(literalValue);
79 return fb;
80 }
81
82 public Type CreateType()
83 {
84 return typeBuilder.CreateType();
85 }
86
87 public TypeInfo CreateTypeInfo()
88 {
89 return typeBuilder.CreateTypeInfo();
90 }
91
92 public TypeToken TypeToken
93 {
94 get { return typeBuilder.TypeToken; }
95 }
96
97 public FieldBuilder UnderlyingField
98 {
99 get { return fieldBuilder; }
100 }
101
102 public void SetCustomAttribute(ConstructorInfo con, byte[] binaryAttribute)
103 {
104 typeBuilder.SetCustomAttribute(con, binaryAttribute);
105 }
106
107 public void SetCustomAttribute(CustomAttributeBuilder customBuilder)
108 {
109 typeBuilder.SetCustomAttribute(customBuilder);
110 }
111
112 public override Type GetEnumUnderlyingType()
113 {
114 return fieldBuilder.FieldType;
115 }
116
117 protected override bool IsValueTypeImpl
118 {
119 get { return true; }
120 }
121
122 internal override bool IsBaked
123 {
124 get { return typeBuilder.IsBaked; }
125 }
126
127 }
128
129}
IKVM.Reflection.Module Module
IKVM.Reflection.Type Type
IKVM.Reflection.ConstructorInfo ConstructorInfo
global::java.lang.invoke.LambdaForm.Name Name