getName() private méthode

private getName ( ) : global::java.lang.String
Résultat global::java.lang.String
 protected internal virtual string testName(Method method)
 {
   return method.getName();
 }
Exemple #2
0
 private static bool testVirtual(GType type, Class clazz, Method method, bool create, bool isBaseClassPublic)
 {
     var modifiers = (ModifierFlags) method.getModifiers();
     bool isStatic = (modifiers & ModifierFlags.Static) != ModifierFlags.None;
     bool isVirtual = (modifiers & ModifierFlags.Final) == ModifierFlags.None;
     if (!clazz.isInterface())
     {
         if (create && !isStatic && isVirtual && !type.IsRootType)
         {
             Method smethod = clazz.getSuperclass().GetMethodNoThrow(method.getName(), method.GetSignature(), false);
             if (smethod != null && isBaseClassPublic)
             {
                 create = false;
             }
         }
     }
     return create;
 }
 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;
 }
Exemple #4
0
        private static void RegisterJVMMethod(GType type, Method method, bool register)
        {
            var modifiers = (ModifierFlags)method.getModifiers();
            Annotation annotation = HasAnnotation(method, "net.sf.jni4net.attributes.ClrMethod");
            if (annotation != null ||
                (modifiers & (ModifierFlags.Private | ModifierFlags.Synthetic)) != ModifierFlags.None)
            {
                if (annotation == null)
                {
                    if (config.Verbose)
                    {
                        Console.WriteLine("Skip " + type + "." + method);
                    }
                }
                return;
            }

            var res = new GMethod();
            res.Type = type;
            res.Name = method.getName();
            res.JVMName = res.Name;
            res.CLRName = res.JVMName;
            res.IsJVMMethod = true;
            Class[] parameterTypes = method.getParameterTypes();
            for (int i = 0; i < parameterTypes.Length; i++)
            {
                Class paramType = parameterTypes[i];
                res.ParameterNames.Add("par" + i); //+ paramType.ShortName
                res.Parameters.Add(RegisterClass(paramType));
            }
            ConvertJVMAttributes(type, res, method);
            res.LowerName = res.Name + res.GetSignatureLowerNoRet();
            res.ReturnType = RegisterClass(method.getReturnType());
            if (register)
            {
                bool force = false;
                if (UseMethodModifier(type, res, res.Name, res.GetJVMSignature(), ref force))
                {
                    if (config.Verbose)
                    {
                        Console.WriteLine("Skip " + type + "." + method);
                    }
                    return;
                }

                FinishRegistration(method.getName(), type, res, force, res.Name + res.GetCLRSignatureNoRet(), skipCLR);
            }
        }