Esempio n. 1
0
        /// <summary>
        /// Create a type defrinition for the given class file and all inner classes.
        /// </summary>
        public override void CreateType(NetTypeDefinition declaringType, NetModule module, TargetFramework target)
        {
            if (declaringType != null)
            {
                throw new ArgumentException("Declaring type should be null");
            }
            docClass = target.GetXmlClass(cf);

            var fullName = GetFullName();
            var dotIndex = fullName.LastIndexOf('.');
            var ns       = (dotIndex > 0) ? NameConverter.UpperCamelCase(fullName.Substring(0, dotIndex)) : String.Empty;
            var name     = (dotIndex > 0) ? NameConverter.UpperCamelCase(fullName.Substring(dotIndex + 1)) : fullName;

            name = CreateTypeName(null, cf, name, ns);

            typeDef                        = new NetTypeDefinition(cf, target, module.Scope);
            typeDef.Name                   = name;
            typeDef.Namespace              = ns;
            typeDef.OriginalJavaClassName  = cf.ClassName;
            typeDef.Attributes             = GetAttributes(cf, cf.Fields.Any());
            typeDef.IgnoreGenericArguments = !AddGenericParameters;
            typeDef.Description            = (docClass != null) ? docClass.Description : null;
            module.Types.Add(typeDef);

            // Prepare generics
            CreateGenericParameters(cf, typeDef);

            // Add mapping
            var finalFullName = string.IsNullOrEmpty(ns) ? name : ns + "." + name;

            RegisterType(target, cf, typeDef);
            CreateNestedTypes(cf, typeDef, finalFullName, module, target);
        }
Esempio n. 2
0
        /// <summary>
        /// Create a type defrinition for the given class file and all inner classes.
        /// </summary>
        public override void CreateType(NetTypeDefinition declaringType, NetModule module, TargetFramework target)
        {
            if (declaringType == null)
            {
                throw new ArgumentNullException("declaringType");
            }
            docClass = target.GetXmlClass(cf);

            var name = NameConverter.UpperCamelCase(inner.IsAnonymous ? cf.Name : inner.Name);

            name = CreateTypeName(declaringType, cf, name, null);

            var finalFullName = parentFullName + "/" + name;

            var attributes = GetAttributes(cf);

            typeDef = new NetTypeDefinition(cf, target, module.Scope)
            {
                Name = name, Attributes = attributes
            };
            typeDef.OriginalJavaClassName = cf.ClassName;
            typeDef.Description           = (docClass != null) ? docClass.Description : null;
            parent.AddNestedType(typeDef, "", module, ref finalFullName);

            // Prepare generics
            CreateGenericParameters(cf, typeDef);

            // Add mapping
            RegisterType(target, cf, typeDef);
            CreateNestedTypes(cf, typeDef, finalFullName, module, target);
        }
Esempio n. 3
0
        /// <summary>
        /// Create a type defrinition for the given class file and all inner classes.
        /// </summary>
        public override void CreateType(NetTypeDefinition declaringType, NetModule module, TargetFramework target)
        {
            if (declaringType == null)
                throw new ArgumentNullException("declaringType");
            docClass = target.GetXmlClass(cf);

            var name = NameConverter.UpperCamelCase(inner.IsAnonymous ? cf.Name : inner.Name);
            name = CreateTypeName(declaringType, cf, name, null);

            var finalFullName = parentFullName + "/" + name;

            var attributes = GetAttributes(cf);
            typeDef = new NetTypeDefinition(cf, target, module.Scope) { Name = name, Attributes = attributes };
            typeDef.OriginalJavaClassName = cf.ClassName;
            typeDef.Description = (docClass != null) ? docClass.Description : null;
            parent.AddNestedType(typeDef, "", module, ref finalFullName);

            // Prepare generics
            CreateGenericParameters(cf, typeDef);

            // Add mapping
            RegisterType(target, cf, typeDef);
            CreateNestedTypes(cf, typeDef, finalFullName, module, target);
        }
Esempio n. 4
0
        /// <summary>
        /// Create a type definition for the given class file and all inner classes.
        /// </summary>
        public override void CreateType(NetTypeDefinition declaringType, NetModule module, TargetFramework target)
        {
            if (declaringType != null)
                throw new ArgumentException("Declaring type should be null");
            docClass = target.GetXmlClass(cf);

            var fullName = GetFullName();
            var dotIndex = fullName.LastIndexOf('.');
            var ns = (dotIndex > 0) ? ConvertNamespace(fullName, dotIndex) : String.Empty;
            var name = (dotIndex > 0) ? NameConverter.UpperCamelCase(fullName.Substring(dotIndex + 1)) : fullName;

            name = CreateTypeName(null, cf, name, ns);

            typeDef = new NetTypeDefinition(cf, target, module.Scope);
            typeDef.Name = name;
            typeDef.Namespace = ns;
            typeDef.OriginalJavaClassName = cf.ClassName;
            typeDef.Attributes = GetAttributes(cf, cf.Fields.Any());
            typeDef.IgnoreGenericArguments = !AddGenericParameters;
            typeDef.Description = (docClass != null) ? docClass.Description : null;
            module.Types.Add(typeDef);

            // Prepare generics
            CreateGenericParameters(cf, typeDef);

            // Add mapping
            var finalFullName = string.IsNullOrEmpty(ns) ? name : ns + "." + name;
            RegisterType(target, cf, typeDef);
            CreateNestedTypes(cf, typeDef, finalFullName, module, target);
        }