getParameterAnnotations() private method

private getParameterAnnotations ( ) : java.lang.annotation.Annotation[][]
return java.lang.annotation.Annotation[][]
コード例 #1
0
ファイル: Generator.cs プロジェクト: NALSS/SmartDashboard.NET
 public static Generator.MethodInformation getMethodInformation(Method method)
 {
   if (!Modifier.isNative(method.getModifiers()))
     return (Generator.MethodInformation) null;
   Generator.MethodInformation methodInformation1 = new Generator.MethodInformation();
   methodInformation1.method = method;
   methodInformation1.annotations = ((AccessibleObject) method).getAnnotations();
   methodInformation1.modifiers = method.getModifiers();
   methodInformation1.returnType = method.getReturnType();
   methodInformation1.name = method.getName();
   methodInformation1.memberName = methodInformation1.name;
   Name name1 = (Name) method.getAnnotation((Class) ClassLiteral<Name>.Value);
   if (name1 != null)
   {
     methodInformation1.memberName = name1.value();
     methodInformation1.memberNameSuffix = name1.suffix();
   }
   methodInformation1.parameterTypes = method.getParameterTypes();
   methodInformation1.parameterAnnotations = method.getParameterAnnotations();
   Class behavior = Generator.getBehavior(method);
   int num1 = methodInformation1.returnType != Void.TYPE ? 1 : 0;
   int num2 = 1;
   for (int index = 0; index < methodInformation1.parameterTypes.Length; ++index)
   {
     if (methodInformation1.parameterTypes[index] != Integer.TYPE && methodInformation1.parameterTypes[index] != Long.TYPE)
     {
       num1 = 0;
       if (index < methodInformation1.parameterTypes.Length - 1)
         num2 = 0;
     }
   }
   int num3 = Modifier.isStatic(methodInformation1.modifiers) || methodInformation1.returnType != Void.TYPE ? 0 : 1;
   int num4 = num3 == 0 || methodInformation1.parameterTypes.Length != 1 || methodInformation1.parameterTypes[0] != Integer.TYPE && methodInformation1.parameterTypes[0] != Long.TYPE ? 0 : 1;
   int num5 = 0;
   int num6 = 0;
   int num7 = 0;
   int num8 = 0;
   Method method1 = (Method) null;
   foreach (Method method2 in method.getDeclaringClass().getDeclaredMethods(Generator.__\u003CGetCallerID\u003E()))
   {
     int modifiers = method2.getModifiers();
     Class returnType = method2.getReturnType();
     string name2 = method2.getName();
     Class[] parameterTypes = method2.getParameterTypes();
     if (!method.equals((object) method2) && Modifier.isNative(modifiers))
     {
       if (String.instancehelper_equals("get", (object) methodInformation1.name) && String.instancehelper_equals("put", (object) name2) && (methodInformation1.parameterTypes.Length == 0 && parameterTypes.Length == 1) && (parameterTypes[0] == methodInformation1.returnType && num1 != 0))
       {
         num5 = 1;
         method1 = method2;
       }
       else if (String.instancehelper_equals("put", (object) methodInformation1.name) && String.instancehelper_equals("get", (object) name2) && (methodInformation1.parameterTypes.Length == 1 && parameterTypes.Length == 0) && (methodInformation1.parameterTypes[0] == returnType && num2 != 0))
       {
         num6 = 1;
         method1 = method2;
       }
       else if (String.instancehelper_equals(name2, (object) methodInformation1.name))
       {
         methodInformation1.overloaded = true;
         int num9 = 1;
         for (int index = 0; index < methodInformation1.parameterTypes.Length && index < parameterTypes.Length; ++index)
         {
           if (methodInformation1.parameterTypes[index] != parameterTypes[index])
             num9 = 0;
         }
         if (num9 != 0 && parameterTypes.Length - 1 == methodInformation1.parameterTypes.Length && (methodInformation1.returnType == parameterTypes[parameterTypes.Length - 1] && num1 != 0))
         {
           num7 = 1;
           method1 = method2;
         }
         else if (num9 != 0 && methodInformation1.parameterTypes.Length - 1 == parameterTypes.Length && (returnType == methodInformation1.parameterTypes[methodInformation1.parameterTypes.Length - 1] && num2 != 0))
         {
           num8 = 1;
           method1 = method2;
         }
       }
     }
   }
   if (num1 != 0 && behavior == ClassLiteral<ValueGetter>.Value)
     methodInformation1.valueGetter = true;
   else if (num2 != 0 && behavior == ClassLiteral<ValueSetter>.Value)
     methodInformation1.valueSetter = true;
   else if (num1 != 0 && behavior == ClassLiteral<MemberGetter>.Value)
     methodInformation1.memberGetter = true;
   else if (num2 != 0 && behavior == ClassLiteral<MemberSetter>.Value)
     methodInformation1.memberSetter = true;
   else if (num3 != 0 && behavior == ClassLiteral<Allocator>.Value)
     methodInformation1.allocator = true;
   else if (num4 != 0 && behavior == ClassLiteral<ArrayAllocator>.Value)
   {
     Generator.MethodInformation methodInformation2 = methodInformation1;
     Generator.MethodInformation methodInformation3 = methodInformation1;
     int num9 = 1;
     Generator.MethodInformation methodInformation4 = methodInformation3;
     int num10 = num9;
     methodInformation4.arrayAllocator = num9 != 0;
     methodInformation2.allocator = num10 != 0;
   }
   else if (behavior == null)
   {
     if (methodInformation1.returnType == Void.TYPE && String.instancehelper_equals("deallocate", (object) methodInformation1.name) && (!Modifier.isStatic(methodInformation1.modifiers) && methodInformation1.parameterTypes.Length == 2) && (methodInformation1.parameterTypes[0] == Long.TYPE && methodInformation1.parameterTypes[1] == Long.TYPE))
       methodInformation1.deallocator = true;
     else if (num3 != 0 && String.instancehelper_equals("allocate", (object) methodInformation1.name))
       methodInformation1.allocator = true;
     else if (num4 != 0 && String.instancehelper_equals("allocateArray", (object) methodInformation1.name))
     {
       Generator.MethodInformation methodInformation2 = methodInformation1;
       Generator.MethodInformation methodInformation3 = methodInformation1;
       int num9 = 1;
       Generator.MethodInformation methodInformation4 = methodInformation3;
       int num10 = num9;
       methodInformation4.arrayAllocator = num9 != 0;
       methodInformation2.allocator = num10 != 0;
     }
     else if (methodInformation1.returnType.isAssignableFrom((Class) ClassLiteral<ByteBuffer>.Value) && String.instancehelper_equals("asDirectBuffer", (object) methodInformation1.name) && (!Modifier.isStatic(methodInformation1.modifiers) && methodInformation1.parameterTypes.Length == 1) && (methodInformation1.parameterTypes[0] == Integer.TYPE || methodInformation1.parameterTypes[0] == Long.TYPE))
       methodInformation1.bufferGetter = true;
     else if (num5 != 0)
     {
       methodInformation1.valueGetter = true;
       methodInformation1.pairedMethod = method1;
     }
     else if (num6 != 0)
     {
       methodInformation1.valueSetter = true;
       methodInformation1.pairedMethod = method1;
     }
     else if (num7 != 0)
     {
       methodInformation1.memberGetter = true;
       methodInformation1.pairedMethod = method1;
     }
     else if (num8 != 0)
     {
       methodInformation1.memberSetter = true;
       methodInformation1.pairedMethod = method1;
     }
   }
   else
   {
     Generator.logger.log((Level) Level.WARNING, new StringBuilder().append("Method \"").append((object) method).append("\" cannot behave like a \"").append((object) behavior).append("\". No code will be generated.").toString());
     return (Generator.MethodInformation) null;
   }
   if (name1 == null && methodInformation1.pairedMethod != null)
   {
     Name name2 = (Name) methodInformation1.pairedMethod.getAnnotation((Class) ClassLiteral<Name>.Value);
     if (name2 != null)
     {
       methodInformation1.memberName = name2.value();
       methodInformation1.memberNameSuffix = name2.suffix();
     }
   }
   methodInformation1.noOffset = ((AccessibleObject) method).isAnnotationPresent((Class) ClassLiteral<NoOffset>.Value);
   if (!methodInformation1.noOffset && methodInformation1.pairedMethod != null)
     methodInformation1.noOffset = ((AccessibleObject) methodInformation1.pairedMethod).isAnnotationPresent((Class) ClassLiteral<NoOffset>.Value);
   return methodInformation1;
 }
コード例 #2
0
 public static ArrayList signatures(Method method)
 {
   return ParameterSignature.signatures(method.getParameterTypes(), method.getParameterAnnotations());
 }