Ejemplo n.º 1
0
        public ITypeModel InstanceType()
        {
            if (this.IsInstanceType)
            {
                return(this);
            }

            PrimaryTypeModel instanceType = new PrimaryTypeModel(this);

            if (instanceType.Name == "boolean")
            {
                instanceType.Name = "Boolean";
            }
            else if (instanceType.Name == "double")
            {
                instanceType.Name = "Double";
            }
            else if (instanceType.Name == "int")
            {
                instanceType.Name = "Integer";
            }
            else if (instanceType.Name == "long")
            {
                instanceType.Name = "Long";
            }
            else if (instanceType.Name == "void")
            {
                instanceType.Name = "Void";
            }
            return(instanceType);
        }
Ejemplo n.º 2
0
        public override IType NormalizeTypeReference(IType type)
        {
            if (type == null)
            {
                return(null);
            }
            var enumType = type as EnumType;

            if (enumType != null && enumType.ModelAsString)
            {
                type = new PrimaryTypeModel(KnownPrimaryType.String);
            }

            if (_visited.ContainsKey(type))
            {
                return(_visited[type]);
            }

            if (type is PrimaryType)
            {
                _visited[type] = new PrimaryTypeModel(type as PrimaryType);
                return(_visited[type]);
            }
            if (type is SequenceType)
            {
                SequenceTypeModel model = new SequenceTypeModel(type as SequenceType);
                _visited[type] = model;
                return(NormalizeSequenceType(model));
            }
            if (type is DictionaryType)
            {
                DictionaryTypeModel model = new DictionaryTypeModel(type as DictionaryType);
                _visited[type] = model;
                return(NormalizeDictionaryType(model));
            }
            if (type is CompositeType)
            {
                CompositeTypeModel model = NewCompositeTypeModel(type as CompositeType);
                _visited[type] = model;
                return(NormalizeCompositeType(model));
            }
            if (type is EnumType)
            {
                EnumTypeModel model = new EnumTypeModel(type as EnumType, _package);
                _visited[type] = model;
                return(NormalizeEnumType(model));
            }


            throw new NotSupportedException(string.Format(CultureInfo.InvariantCulture,
                                                          "Type {0} is not supported.", type.GetType()));
        }
Ejemplo n.º 3
0
        public override IType NormalizeTypeReference(IType type)
        {
            if (type == null)
            {
                return null;
            }
            var enumType = type as EnumType;
            if (enumType != null && enumType.ModelAsString)
            {
                type = new PrimaryTypeModel(KnownPrimaryType.String);
            }

            if (_visited.ContainsKey(type))
            {
                return _visited[type];
            }

            if (type is PrimaryType)
            {
                _visited[type] = new PrimaryTypeModel(type as PrimaryType);
                return _visited[type];
            }
            if (type is SequenceType)
            {
                SequenceTypeModel model = new SequenceTypeModel(type as SequenceType);
                _visited[type] = model;
                return NormalizeSequenceType(model);
            }
            if (type is DictionaryType)
            {
                DictionaryTypeModel model = new DictionaryTypeModel(type as DictionaryType);
                _visited[type] = model;
                return NormalizeDictionaryType(model);
            }
            if (type is CompositeType)
            {
                CompositeTypeModel model = NewCompositeTypeModel(type as CompositeType);
                _visited[type] = model;
                return NormalizeCompositeType(model);
            }
            if (type is EnumType)
            {
                EnumTypeModel model = new EnumTypeModel(type as EnumType, _package);
                _visited[type] = model;
                return NormalizeEnumType(model);
            }


            throw new NotSupportedException(string.Format(CultureInfo.InvariantCulture, 
                "Type {0} is not supported.", type.GetType()));
        }
Ejemplo n.º 4
0
        public override IType NormalizeTypeReference(IType type)
        {
            if (type == null)
            {
                return null;
            }

            if (type is ITypeModel)
            {
                return type;
            }

            var enumType = type as EnumType;
            if (enumType != null && enumType.ModelAsString)
            {
                type = new PrimaryTypeModel(KnownPrimaryType.String);
            }

            return NormalizeTypeDeclaration(type);
        }
Ejemplo n.º 5
0
        public ITypeModel InstanceType()
        {
            if (this.IsInstanceType)
            {
                return this;
            }

            PrimaryTypeModel instanceType = new PrimaryTypeModel(this);
            if (instanceType.Name == "boolean")
            {
                instanceType.Name = "Boolean";
            }
            else if (instanceType.Name == "double")
            {
                instanceType.Name = "Double";
            }
            else if (instanceType.Name == "int")
            {
                instanceType.Name = "Integer";
            }
            else if (instanceType.Name == "long")
            {
                instanceType.Name = "Long";
            }
            else if (instanceType.Name == "void")
            {
                instanceType.Name = "Void";
            }
            return instanceType;
        }