当前位置: 首页>>代码示例>>C#>>正文


C# Class.getAnnotation方法代码示例

本文整理汇总了C#中java.lang.Class.getAnnotation方法的典型用法代码示例。如果您正苦于以下问题:C# Class.getAnnotation方法的具体用法?C# Class.getAnnotation怎么用?C# Class.getAnnotation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.lang.Class的用法示例。


在下文中一共展示了Class.getAnnotation方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: runnerForClass

 public override Runner runnerForClass(Class testClass)
 {
   if (testClass.getAnnotation((Class) ClassLiteral<Ignore>.Value) == null)
     return (Runner) null;
   return (Runner) new IgnoredClassRunner(testClass);
 }
开发者ID:NALSS,项目名称:SmartDashboard.NET,代码行数:6,代码来源:IgnoredBuilder.cs

示例2: getCPPTypeName

 public static string getCPPTypeName(Class type)
 {
   if (type == ClassLiteral<Buffer>.Value || type == ClassLiteral<Pointer>.Value)
     return "void*";
   if (type == ClassLiteral<byte[]>.Value || type == ClassLiteral<ByteBuffer>.Value || type == ClassLiteral<BytePointer>.Value)
     return "signed char*";
   if (type == ClassLiteral<short[]>.Value || type == ClassLiteral<ShortBuffer>.Value || type == ClassLiteral<ShortPointer>.Value)
     return "short*";
   if (type == ClassLiteral<int[]>.Value || type == ClassLiteral<IntBuffer>.Value || type == ClassLiteral<IntPointer>.Value)
     return "int*";
   if (type == ClassLiteral<long[]>.Value || type == ClassLiteral<LongBuffer>.Value || type == ClassLiteral<LongPointer>.Value)
     return "jlong*";
   if (type == ClassLiteral<float[]>.Value || type == ClassLiteral<FloatBuffer>.Value || type == ClassLiteral<FloatPointer>.Value)
     return "float*";
   if (type == ClassLiteral<double[]>.Value || type == ClassLiteral<DoubleBuffer>.Value || type == ClassLiteral<DoublePointer>.Value)
     return "double*";
   if (type == ClassLiteral<char[]>.Value || type == ClassLiteral<CharBuffer>.Value || type == ClassLiteral<CharPointer>.Value)
     return "unsigned short*";
   if (type == ClassLiteral<PointerPointer>.Value)
     return "void**";
   if (type == ClassLiteral<String>.Value)
     return "const char*";
   if (type == Byte.TYPE)
     return "signed char";
   if (type == Character.TYPE)
     return "unsigned short";
   if (type == Long.TYPE)
     return "jlong";
   if (type == Boolean.TYPE)
     return "unsigned char";
   if (type.isPrimitive())
     return type.getName();
   else if (((Class) ClassLiteral<FunctionPointer>.Value).isAssignableFrom(type))
   {
     return new StringBuilder().append("JavaCPP_").append(Generator.mangle(type.getName())).append("*").toString();
   }
   else
   {
     string str1 = "";
     for (; type != null; type = type.getDeclaringClass())
     {
       Namespace @namespace = (Namespace) type.getAnnotation((Class) ClassLiteral<Namespace>.Value);
       string str2 = @namespace == null ? "" : @namespace.value();
       if (((Class) ClassLiteral<Pointer>.Value).isAssignableFrom(type))
       {
         Name name1 = (Name) type.getAnnotation((Class) ClassLiteral<Name>.Value);
         string str3;
         if (name1 == null)
         {
           string name2 = type.getName();
           str3 = String.instancehelper_substring(name2, String.instancehelper_lastIndexOf(name2, "$") + 1);
         }
         else
           str3 = name1.value();
         str2 = String.instancehelper_length(str2) != 0 ? new StringBuilder().append(str2).append("::").append(str3).toString() : str3;
       }
       if (String.instancehelper_length(str1) == 0)
         str1 = str2;
       else if (String.instancehelper_length(str2) > 0)
         str1 = new StringBuilder().append(str2).append("::").append(str1).toString();
     }
     return new StringBuilder().append(str1).append("*").toString();
   }
 }
开发者ID:NALSS,项目名称:SmartDashboard.NET,代码行数:64,代码来源:Generator.cs

示例3: runnerForClass

 public override Runner runnerForClass(Class testClass)
 {
   RunWith runWith = (RunWith) testClass.getAnnotation((Class) ClassLiteral<RunWith>.Value);
   if (runWith == null)
     return (Runner) null;
   return this.buildRunner(runWith.value(), testClass);
 }
开发者ID:NALSS,项目名称:SmartDashboard.NET,代码行数:7,代码来源:AnnotatedBuilder.cs

示例4: appendProperties

 public static void appendProperties(Properties properties, Class cls)
 {
   string property1 = properties.getProperty("platform.name");
   Properties properties1 = (Properties) cls.getAnnotation((Class) ClassLiteral<Properties>.Value);
   Platform[] platformArray1;
   if (properties1 == null)
   {
     Platform platform1 = (Platform) cls.getAnnotation((Class) ClassLiteral<Platform>.Value);
     if (platform1 == null)
       return;
     Platform[] platformArray2 = new Platform[1];
     int index = 0;
     Platform platform2 = platform1;
     platformArray2[index] = platform2;
     platformArray1 = platformArray2;
   }
   else
     platformArray1 = properties1.value();
   string[] strArray1 = new string[0];
   string[] strArray2 = new string[0];
   string[] strArray3 = new string[0];
   string[] strArray4 = new string[0];
   string[] strArray5 = new string[0];
   string[] strArray6 = new string[0];
   string[] strArray7 = new string[0];
   string[] strArray8 = new string[0];
   string[] strArray9 = new string[0];
   Platform[] platformArray3 = platformArray1;
   int length1 = platformArray3.Length;
   for (int index1 = 0; index1 < length1; ++index1)
   {
     Platform platform = platformArray3[index1];
     string[][] strArray10 = new string[2][];
     int index2 = 0;
     string[] strArray11 = platform.value();
     strArray10[index2] = strArray11;
     int index3 = 1;
     string[] strArray12 = platform.not();
     strArray10[index3] = strArray12;
     string[][] strArray13 = strArray10;
     bool[] flagArray1 = new bool[2];
     int index4 = 0;
     int num1 = 0;
     flagArray1[index4] = num1 != 0;
     int index5 = 1;
     int num2 = 0;
     flagArray1[index5] = num2 != 0;
     bool[] flagArray2 = flagArray1;
     for (int index6 = 0; index6 < strArray13.Length; ++index6)
     {
       string[] strArray14 = strArray13[index6];
       int length2 = strArray14.Length;
       for (int index7 = 0; index7 < length2; ++index7)
       {
         string str = strArray14[index7];
         if (String.instancehelper_startsWith(property1, str))
         {
           flagArray2[index6] = true;
           break;
         }
       }
     }
     if ((strArray13[0].Length == 0 || flagArray2[0]) && (strArray13[1].Length == 0 || !flagArray2[1]))
     {
       if (platform.define().Length > 0)
         strArray1 = platform.define();
       if (platform.include().Length > 0)
         strArray2 = platform.include();
       if (platform.cinclude().Length > 0)
         strArray3 = platform.cinclude();
       if (platform.includepath().Length > 0)
         strArray4 = platform.includepath();
       if (platform.options().Length > 0)
         strArray5 = platform.options();
       if (platform.linkpath().Length > 0)
         strArray6 = platform.linkpath();
       if (platform.link().Length > 0)
         strArray7 = platform.link();
       if (platform.preloadpath().Length > 0)
         strArray8 = platform.preloadpath();
       if (platform.preload().Length > 0)
         strArray9 = platform.preload();
     }
   }
   string property2 = properties.getProperty("path.separator");
   Loader.appendProperty(properties, "generator.define", "\0", strArray1);
   Loader.appendProperty(properties, "generator.include", "\0", strArray2);
   Loader.appendProperty(properties, "generator.cinclude", "\0", strArray3);
   Loader.appendProperty(properties, "compiler.includepath", property2, strArray4);
   if (strArray5.Length > 0)
   {
     string property3 = properties.getProperty("compiler.options");
     properties.setProperty("compiler.options", "");
     for (int index1 = 0; index1 < strArray5.Length; ++index1)
     {
       string str1 = property3;
       if (String.instancehelper_length(strArray5[index1]) > 0)
         str1 = properties.getProperty(new StringBuilder().append("compiler.options.").append(strArray5[index1]).toString());
       Properties properties2 = properties;
       string name = "compiler.options";
//.........这里部分代码省略.........
开发者ID:NALSS,项目名称:SmartDashboard.NET,代码行数:101,代码来源:Loader.cs


注:本文中的java.lang.Class.getAnnotation方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。