本文整理汇总了C#中java.lang.Class.getModifiers方法的典型用法代码示例。如果您正苦于以下问题:C# Class.getModifiers方法的具体用法?C# Class.getModifiers怎么用?C# Class.getModifiers使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.lang.Class
的用法示例。
在下文中一共展示了Class.getModifiers方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: registerStaticWidget
public static void registerStaticWidget(Class clazz)
{
if (Modifier.isAbstract(clazz.getModifiers()))
return;
DisplayElementRegistry.staticWidgets.add((object) clazz);
}
示例2: registerWidget
public static void registerWidget(Class clazz)
{
if (Modifier.isAbstract(clazz.getModifiers()))
return;
DataType[] dataTypeArray1 = (DataType[]) null;
SecurityException securityException;
try
{
try
{
try
{
try
{
try
{
Field declaredField = clazz.getDeclaredField("TYPES", DisplayElementRegistry.__\u003CGetCallerID\u003E());
int modifiers = declaredField.getModifiers();
if (!Modifier.isStatic(modifiers))
{
string str = "TYPES must be static";
Throwable.__\u003CsuppressFillInStackTrace\u003E();
throw new RuntimeException(str);
}
else if (!Modifier.isFinal(modifiers))
{
string str = "TYPES must be final";
Throwable.__\u003CsuppressFillInStackTrace\u003E();
throw new RuntimeException(str);
}
else
{
dataTypeArray1 = (DataType[]) declaredField.get((object) null, DisplayElementRegistry.__\u003CGetCallerID\u003E());
DisplayElementRegistry.declaredTypes.put((object) clazz, (object) dataTypeArray1);
goto label_22;
}
}
catch (IllegalArgumentException ex)
{
}
}
catch (IllegalAccessException ex)
{
goto label_15;
}
}
catch (NoSuchFieldException ex)
{
goto label_16;
}
}
catch (SecurityException ex)
{
int num = 1;
securityException = (SecurityException) ByteCodeHelper.MapException<SecurityException>((Exception) ex, (ByteCodeHelper.MapFlags) num);
goto label_17;
}
}
catch (Exception ex)
{
int num = 2;
if (ByteCodeHelper.MapException<ClassCastException>(ex, (ByteCodeHelper.MapFlags) num) == null)
throw;
else
goto label_18;
}
if (!DisplayElementRegistry.\u0024assertionsDisabled)
{
Throwable.__\u003CsuppressFillInStackTrace\u003E();
throw new AssertionError();
}
else
goto label_22;
label_15:
string str1 = "TYPES must be public";
Throwable.__\u003CsuppressFillInStackTrace\u003E();
throw new RuntimeException(str1);
label_16:
string str2 = "Every ValueBasedDisplayElement must have a TYPES static field of type DataType[]";
Throwable.__\u003CsuppressFillInStackTrace\u003E();
throw new RuntimeException(str2);
label_17:
Throwable.instancehelper_printStackTrace((Exception) securityException);
return;
label_18:
string str3 = "TYPES must be of type Type[]";
Throwable.__\u003CsuppressFillInStackTrace\u003E();
throw new RuntimeException(str3);
label_22:
if (dataTypeArray1 == null)
{
string str4 = "TYPES must not be null";
Throwable.__\u003CsuppressFillInStackTrace\u003E();
throw new RuntimeException(str4);
}
else
{
DataType[] dataTypeArray2 = dataTypeArray1;
int length = dataTypeArray2.Length;
for (int index = 0; index < length; ++index)
//.........这里部分代码省略.........
示例3: RegisterClass
internal static GType RegisterClass(Class clazz, TypeRegistration registration)
{
if (knownClasses.ContainsKey(clazz))
{
GType known = knownClasses[clazz];
if (registration != null)
{
known.Registration = registration;
}
return known;
}
var res = new GType();
if (clazz.isArray())
{
res.ArrayElement = RegisterClass(clazz.getComponentType(), null);
res.IsArray = true;
string array = "[]";
Class comp = clazz.getComponentType();
while (comp.isArray())
{
array += "[]";
comp = comp.getComponentType();
}
res.LowerName = ((string) comp.getName()).ToLowerInvariant() + array;
}
else
{
res.LowerName = ((string) clazz.getName()).ToLowerInvariant();
}
res.Attributes = 0;
var classModifiers = (ModifierFlags) clazz.getModifiers();
if ((classModifiers & ModifierFlags.Abstract) != 0)
{
res.IsAbstract = true;
res.Attributes |= TypeAttributes.Abstract;
}
if ((classModifiers & ModifierFlags.Final) != 0)
{
res.IsFinal = true;
}
if ((classModifiers & ModifierFlags.Public) != 0)
{
res.Attributes |= TypeAttributes.Public;
}
else if ((classModifiers & ModifierFlags.Private) != 0)
{
res.Attributes |= TypeAttributes.NotPublic;
}
//TODO internal ?
if (knownNames.ContainsKey(res.LowerName))
{
res = knownNames[res.LowerName];
}
if (res.Registration == null && registration != null)
{
res.Registration = registration;
}
res.JVMType = clazz;
res.JVMFullName = clazz.getName();
if (res.IsArray)
{
string array = "[]";
Class comp = clazz.getComponentType();
while (comp.isArray())
{
array += "[]";
comp = comp.getComponentType();
}
res.JVMFullName = comp.getName() + array;
}
else
{
res.JVMFullName = clazz.getName();
}
res.IsJVMType = true;
res.IsPrimitive = clazz.isPrimitive();
res.IsException = Throwable._class.isAssignableFrom(clazz);
res.IsInterface = clazz.isInterface();
res.IsCLRProxy = clrProxyClass != null && clrProxyClass.isAssignableFrom(clazz);
if (!res.IsCLRProxy)
{
res.IsJVMRealType = true;
}
Class superclass = clazz.getSuperclass();
var isBaseClassPublic = superclass == null || ((ModifierFlags)superclass.getModifiers() & ModifierFlags.Public) != 0;
if (superclass != null && res.Base == null
&& clazz != Object._class
&& clazz != Throwable._class
&& res.JVMFullName != "system.Object"
&& res.JVMFullName != "system.Exception"
&& isBaseClassPublic)
{
res.Base = RegisterClass(superclass);
}
List<Class> interfaces = new List<Class>(clazz.getInterfaces());
if (!isBaseClassPublic)
{
interfaces.AddRange(superclass.getInterfaces());
res.Base = RegisterClass(superclass.getSuperclass());
//.........这里部分代码省略.........