Пример #1
0
 public Signature(MethodDefinition method, ExportAttribute export)
     : this(method.Name, GetJniSignature(method), "__export__", null, null, export.SuperArgumentsString)
 {
     IsExport         = true;
     IsStatic         = method.IsStatic;
     JavaAccess       = JavaCallableWrapperGenerator.GetJavaAccess(method.Attributes & MethodAttributes.MemberAccessMask);
     ThrownTypeNames  = export.ThrownNames;
     JavaNameOverride = export.Name;
     Annotations      = JavaCallableWrapperGenerator.GetAnnotationsString("\t", method.CustomAttributes);
 }
Пример #2
0
 static void GenerateRegisterType(TextWriter sw, JavaCallableWrapperGenerator self, string field)
 {
     sw.WriteLine("\t\t{0} = ", field);
     foreach (Signature method in self.methods)
     {
         sw.WriteLine("\t\t\t\"{0}\\n\" +", method.Method);
     }
     sw.WriteLine("\t\t\t\"\";");
     if (!CannotRegisterInStaticConstructor(self.type))
     {
         sw.WriteLine("\t\tmono.android.Runtime.register (\"{0}\", {1}.class, {2});",
                      self.type.GetAssemblyQualifiedName(), self.name, field);
     }
 }
Пример #3
0
            public Signature(MethodDefinition method, ExportFieldAttribute exportField)
                : this(method.Name, GetJniSignature(method), "__export__", null, null, null)
            {
                if (method.HasParameters)
                {
                    Diagnostic.Error(4205, JavaCallableWrapperGenerator.LookupSource(method), "[ExportField] can only be used on methods with 0 parameters.");
                }
                if (method.ReturnType.MetadataType == MetadataType.Void)
                {
                    Diagnostic.Error(4208, JavaCallableWrapperGenerator.LookupSource(method), "[ExportField] cannot be used on a method returning void.");
                }
                IsExport   = true;
                IsStatic   = method.IsStatic;
                JavaAccess = JavaCallableWrapperGenerator.GetJavaAccess(method.Attributes & MethodAttributes.MemberAccessMask);

                // annotations are processed within JavaFieldInfo, not the initializer method. So we don't generate them here.
            }
Пример #4
0
        public static bool ShouldSkipJavaCallableWrapperGeneration(TypeDefinition type, TypeDefinitionCache cache)
        {
            if (JavaNativeTypeManager.IsNonStaticInnerClass(type, cache))
            {
                return(true);
            }

            foreach (var r in type.GetCustomAttributes(typeof(global::Android.Runtime.RegisterAttribute)))
            {
                if (JavaCallableWrapperGenerator.ToRegisterAttribute(r).DoNotGenerateAcw)
                {
                    return(true);
                }
            }

            return(false);
        }
Пример #5
0
            public Signature(MethodDefinition method, ExportFieldAttribute exportField, IMetadataResolver cache)
                : this(method.Name, GetJniSignature(method, cache), "__export__", null, null, null)
            {
                if (method.HasParameters)
                {
                    Diagnostic.Error(4205, JavaCallableWrapperGenerator.LookupSource(method), Localization.Resources.JavaCallableWrappers_XA4205);
                }
                if (method.ReturnType.MetadataType == MetadataType.Void)
                {
                    Diagnostic.Error(4208, JavaCallableWrapperGenerator.LookupSource(method), Localization.Resources.JavaCallableWrappers_XA4208);
                }
                IsExport   = true;
                IsStatic   = method.IsStatic;
                JavaAccess = JavaCallableWrapperGenerator.GetJavaAccess(method.Attributes & MethodAttributes.MemberAccessMask);

                // annotations are processed within JavaFieldInfo, not the initializer method. So we don't generate them here.
            }
Пример #6
0
 public Signature(MethodDefinition method, RegisterAttribute register, string managedParameters, string outerType)
     : this(register.Name, register.Signature, register.Connector, managedParameters, outerType, null)
 {
     Annotations = JavaCallableWrapperGenerator.GetAnnotationsString("\t", method.CustomAttributes);
 }
Пример #7
0
 public string GetJavaAccess()
 {
     return(JavaCallableWrapperGenerator.GetJavaAccess(Access));
 }