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); }
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 && enumType.Name.IsNullOrEmpty()) { type = new PrimaryTypeModel(KnownPrimaryType.String); } return NormalizeTypeDeclaration(type); }
public override IType NormalizeTypeDeclaration(IType type) { if (type == null) { return null; } if (type is ITypeModel) { return type; } 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 = NewEnumTypeModel(type as EnumType); _visited[type] = model; return NormalizeEnumType(model); } throw new NotSupportedException(string.Format(CultureInfo.InvariantCulture, "Type {0} is not supported.", type.GetType())); }
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; }