/// <summary> /// Format the value of a sequence given the modeled element format. Note that only sequences of strings are supported /// </summary> /// <param name="parameter">The parameter to format</param> /// <returns>return the separator</returns> public static string NeedsFormattedSeparator(Parameter parameter) { if (parameter == null) { throw new ArgumentNullException("parameter"); } SequenceType sequence = parameter.Type as SequenceType; if (sequence == null) { return null; } PrimaryType primaryType = sequence.ElementType as PrimaryType; EnumType enumType = sequence.ElementType as EnumType; if (enumType != null) { primaryType = new PrimaryType(KnownPrimaryType.String) { Name = "str" }; } if (primaryType != null && primaryType.Type != KnownPrimaryType.String) { throw new InvalidOperationException( string.Format(CultureInfo.InvariantCulture, "Cannot generate a formatted sequence from a " + "non-string array parameter {0}", parameter)); } return parameter.CollectionFormat.GetSeparator(); }
public AzureCSharpFluentCodeNamer(Settings settings) :base(settings) { _innerTypes = new HashSet<CompositeType>(); _resourceType = new CompositeType { Name = "Microsoft.Rest.Azure.Resource", SerializedName = "Resource", }; var stringType = new PrimaryType(KnownPrimaryType.String) { Name = "string" }; _resourceType.Properties.Add(new Property { Name = "location", SerializedName = "location", Type = stringType }); _resourceType.Properties.Add(new Property { Name = "id", SerializedName = "id", Type = stringType }); _resourceType.Properties.Add(new Property { Name = "name", SerializedName = "name", Type = stringType }); _resourceType.Properties.Add(new Property { Name = "type", SerializedName = "type", Type = stringType }); _resourceType.Properties.Add(new Property { Name = "tags", SerializedName = "tags", Type = new DictionaryType { ValueType = stringType, NameFormat = "System.Collections.Generic.IDictionary<string, {0}>" } }); _subResourceType = new CompositeType { Name = "Microsoft.Rest.Azure.SubResource", SerializedName = "SubResource" }; _subResourceType.Properties.Add(new Property { Name = "id", SerializedName = "id", Type = stringType }); }
public PrimaryTypeModel(PrimaryType primaryType) : base(primaryType != null ? primaryType.Type : KnownPrimaryType.None) { if (primaryType == null) { throw new ArgumentNullException("primaryType"); } this.LoadFrom(primaryType); _imports = new List<string>(); Initialize(primaryType); }
private static IType NormalizePrimaryType(PrimaryType primaryType) { if (primaryType == null) { throw new ArgumentNullException("primaryType"); } if (primaryType.Type == KnownPrimaryType.Base64Url) { primaryType.Name = "Buffer"; } else if (primaryType.Type == KnownPrimaryType.Boolean) { primaryType.Name = "Boolean"; } else if (primaryType.Type == KnownPrimaryType.ByteArray) { primaryType.Name = "Buffer"; } else if (primaryType.Type == KnownPrimaryType.Date) { primaryType.Name = "Date"; } else if (primaryType.Type == KnownPrimaryType.DateTime) { primaryType.Name = "Date"; } else if (primaryType.Type == KnownPrimaryType.DateTimeRfc1123) { primaryType.Name = "Date"; } else if (primaryType.Type == KnownPrimaryType.UnixTime) { primaryType.Name = "Date"; } else if (primaryType.Type == KnownPrimaryType.Double) { primaryType.Name = "Number"; } else if (primaryType.Type == KnownPrimaryType.Decimal) { primaryType.Name = "Number"; } else if (primaryType.Type == KnownPrimaryType.Int) { primaryType.Name = "Number"; } else if (primaryType.Type == KnownPrimaryType.Long) { primaryType.Name = "Number"; } else if (primaryType.Type == KnownPrimaryType.Stream) { primaryType.Name = "Object"; } else if (primaryType.Type == KnownPrimaryType.String) { primaryType.Name = "String"; } else if (primaryType.Type == KnownPrimaryType.TimeSpan) { primaryType.Name = "moment.duration"; } else if (primaryType.Type == KnownPrimaryType.Uuid) { primaryType.Name = "Uuid"; } else if (primaryType.Type == KnownPrimaryType.Object) { primaryType.Name = "Object"; } return primaryType; }
public override IType NormalizeTypeReference(IType type) { if (type == null) { return null; } var enumType = type as EnumType; if (enumType != null && enumType.ModelAsString) { type = new PrimaryType(KnownPrimaryType.String); } // Using Any instead of Contains since object hash is bound to a property which is modified during normalization if (_normalizedTypes.Any(item => type.Equals(item))) { return _normalizedTypes.First(item => type.Equals(item)); } _normalizedTypes.Add(type); if (type is PrimaryType) { return NormalizePrimaryType(type as PrimaryType); } if (type is SequenceType) { return NormalizeSequenceType(type as SequenceType); } if (type is DictionaryType) { return NormalizeDictionaryType(type as DictionaryType); } if (type is CompositeType) { return NormalizeCompositeType(type as CompositeType); } if (type is EnumType) { return NormalizeEnumType(type as EnumType); } throw new NotSupportedException(string.Format(CultureInfo.InvariantCulture, "Type {0} is not supported.", type.GetType())); }
/// <summary> /// The visitor method for building service types. This is called when an instance of this class is /// visiting a _swaggerModeler to build a service type. /// </summary> /// <param name="serviceTypeName">name for the service type</param> /// <returns>built service type</returns> public virtual IType BuildServiceType(string serviceTypeName) { PrimaryType type = SwaggerObject.ToType(); Debug.Assert(type != null); if (type.Type == KnownPrimaryType.Object && "file".Equals(SwaggerObject.Format, StringComparison.OrdinalIgnoreCase)) { type = new PrimaryType(KnownPrimaryType.Stream); } type.Format = SwaggerObject.Format; if (SwaggerObject.Enum != null && type.Type == KnownPrimaryType.String && !(IsSwaggerObjectConstant(SwaggerObject))) { var enumType = new EnumType(); SwaggerObject.Enum.ForEach(v => enumType.Values.Add(new EnumValue { Name = v, SerializedName = v })); if (SwaggerObject.Extensions.ContainsKey(CodeGenerator.EnumObject)) { var enumObject = SwaggerObject.Extensions[CodeGenerator.EnumObject] as Newtonsoft.Json.Linq.JContainer; if (enumObject != null) { enumType.Name= enumObject["name"].ToString(); if (enumObject["modelAsString"] != null) { enumType.ModelAsString = bool.Parse(enumObject["modelAsString"].ToString()); } } enumType.SerializedName = enumType.Name; if (string.IsNullOrEmpty(enumType.Name)) { throw new InvalidOperationException( string.Format(CultureInfo.InvariantCulture, "{0} extension needs to specify an enum name.", CodeGenerator.EnumObject)); } var existingEnum = Modeler.ServiceClient.EnumTypes.FirstOrDefault( e => e.Name.Equals(enumType.Name, StringComparison.OrdinalIgnoreCase)); if (existingEnum != null) { if (!existingEnum.Equals(enumType)) { throw new InvalidOperationException( string.Format(CultureInfo.InvariantCulture, "Swagger document contains two or more {0} extensions with the same name '{1}' and different values.", CodeGenerator.EnumObject, enumType.Name)); } } else { Modeler.ServiceClient.EnumTypes.Add(enumType); } } else { enumType.ModelAsString = true; enumType.Name = string.Empty; enumType.SerializedName = string.Empty; } return enumType; } if (SwaggerObject.Type == DataType.Array) { string itemServiceTypeName; if (SwaggerObject.Items.Reference != null) { itemServiceTypeName = SwaggerObject.Items.Reference.StripDefinitionPath(); } else { itemServiceTypeName = serviceTypeName + "Item"; } var elementType = SwaggerObject.Items.GetBuilder(Modeler).BuildServiceType(itemServiceTypeName); return new SequenceType { ElementType = elementType }; } if (SwaggerObject.AdditionalProperties != null) { string dictionaryValueServiceTypeName; if (SwaggerObject.AdditionalProperties.Reference != null) { dictionaryValueServiceTypeName = SwaggerObject.AdditionalProperties.Reference.StripDefinitionPath(); } else { dictionaryValueServiceTypeName = serviceTypeName + "Value"; } return new DictionaryType { ValueType = SwaggerObject.AdditionalProperties.GetBuilder(Modeler) .BuildServiceType((dictionaryValueServiceTypeName)) }; } return type; }
/// <summary> /// Format the value of a sequence given the modeled element format. Note that only sequences of strings are supported /// </summary> /// <param name="parameter">The parameter to format</param> /// <returns>A reference to the formatted parameter value</returns> public static string GetFormattedReferenceValue(this Parameter parameter) { if (parameter == null) { throw new ArgumentNullException("parameter"); } SequenceType sequence = parameter.Type as SequenceType; if (sequence == null) { return parameter.Type.ToString(parameter.Name); } PrimaryType primaryType = sequence.ElementType as PrimaryType; EnumType enumType = sequence.ElementType as EnumType; if (enumType != null && enumType.ModelAsString) { primaryType = new PrimaryType(KnownPrimaryType.String); } if (primaryType == null || primaryType.Type != KnownPrimaryType.String) { throw new InvalidOperationException( string.Format(CultureInfo.InvariantCulture, "Cannot generate a formatted sequence from a " + "non-string array parameter {0}", parameter)); } return string.Format(CultureInfo.InvariantCulture, "{0}.join('{1}')", parameter.Name, parameter.CollectionFormat.GetSeparator()); }
private IType NormalizePrimaryType(PrimaryType primaryType) { if (primaryType.Type == KnownPrimaryType.Object) { return new MapType(new InterfaceType()); } else if (primaryType.Type == KnownPrimaryType.Date) { return new PackageType { Import = "github.com/Azure/go-autorest/autorest/date", Member = "Date" }; } else if (primaryType.Type == KnownPrimaryType.DateTimeRfc1123) { return new PackageType { Import = "github.com/Azure/go-autorest/autorest/date", Member = "TimeRFC1123" }; } else if (primaryType.Type == KnownPrimaryType.DateTime) { return new PackageType { Import = "github.com/Azure/go-autorest/autorest/date", Member = "Time" }; } else if (primaryType.Type == KnownPrimaryType.Decimal) { return new PackageType { Import = "github.com/shopspring/decimal", Member = "Decimal" }; } else if (primaryType.Type == KnownPrimaryType.Uuid) { return new PackageType { Import = "github.com/satori/uuid", Member = "UUID" }; } else { // The remaining Primary types normalize to the same object _normalizedTypes[primaryType] = primaryType; if (primaryType.Type == KnownPrimaryType.Boolean) { primaryType.Name = "bool"; } else if (primaryType.Type == KnownPrimaryType.ByteArray) { primaryType.Name = "[]byte"; } else if (primaryType.Type == KnownPrimaryType.Double) { primaryType.Name = "float64"; } else if (primaryType.Type == KnownPrimaryType.Int) { primaryType.Name = "int32"; } else if (primaryType.Type == KnownPrimaryType.Long) { primaryType.Name = "int64"; } else if (primaryType.Type == KnownPrimaryType.Stream) { // Note: // -- All streaming will be through instances of an io.ReadCloser // -- When streaming to the server, the method will take an io.ReadCloser as the http.Request body // -- When streaming from the servier, the method will return access to the (open) http.Response body primaryType.Name = "io.ReadCloser"; } else if (primaryType.Type == KnownPrimaryType.String) { primaryType.Name = "string"; } else if (primaryType.Type == KnownPrimaryType.TimeSpan) { primaryType.Name = "string"; } else if (primaryType.Type == KnownPrimaryType.Base64Url) { //TODO: add base64Url type. primaryType.Name = "string"; } else if (primaryType.Type == KnownPrimaryType.UnixTime) { //TODO: add unixtime type. primaryType.Name = "string"; } else { throw new ArgumentException("Illegal primary type for Go: " + primaryType.ToString()); } return primaryType; } }
public static PrimaryTypeModel NormalizePrimaryType(PrimaryType primaryType) { if (primaryType == null) { throw new ArgumentNullException("primaryType"); } return new PrimaryTypeModel(primaryType); }
private Response BuildMethodReturnType(List<Stack<IType>> types, IType headerType) { IType baseType = new PrimaryType(KnownPrimaryType.Object); // Return null if no response is specified if (types.Count == 0) { return new Response(null, headerType); } // Return first if only one return type if (types.Count == 1) { return new Response(types.First().Pop(), headerType); } // BuildParameter up type inheritance tree types.ForEach(typeStack => { IType type = typeStack.Peek(); while (!Equals(type, baseType)) { if (type is CompositeType && _swaggerModeler.ExtendedTypes.ContainsKey(type.Name)) { type = _swaggerModeler.GeneratedTypes[_swaggerModeler.ExtendedTypes[type.Name]]; } else { type = baseType; } typeStack.Push(type); } }); // Eliminate commonly shared base classes while (!types.First().IsNullOrEmpty()) { IType currentType = types.First().Peek(); foreach (var typeStack in types) { IType t = typeStack.Pop(); if (!Equals(t, currentType)) { return new Response(baseType, headerType); } } baseType = currentType; } return new Response(baseType, headerType); }
/// <summary> /// Constructs blueprint of the given <paramref name="type"/>. /// </summary> /// <param name="type">Type for which mapper being generated.</param> /// <param name="serializedName">Serialized name to be used.</param> /// <param name="parameter">Parameter of the composite type to construct the parameter constraints.</param> /// <param name="expandComposite">Expand composite type if <c>true</c> otherwise specify class_name in the mapper.</param> /// <returns>Mapper for the <paramref name="type"/> as string.</returns> /// <exception cref="ArgumentNullException">Thrown when a required parameter is null.</exception> /// <example> /// One of the example of the mapper is /// { /// required: false, /// serialized_name: 'Fish', /// type: { /// name: 'Composite', /// polymorphic_discriminator: 'fishtype', /// uber_parent: 'Fish', /// class_name: 'Fish', /// model_properties: { /// species: { /// required: false, /// serialized_name: 'species', /// type: { /// name: 'String' /// } /// }, /// length: { /// required: true, /// serialized_name: 'length', /// type: { /// name: 'Double' /// } /// }, /// siblings: { /// required: false, /// serialized_name: 'siblings', /// type: { /// name: 'Sequence', /// element: { /// required: false, /// serialized_name: 'FishElementType', /// type: { /// name: 'Composite', /// polymorphic_discriminator: 'fishtype', /// uber_parent: 'Fish', /// class_name: 'Fish' /// } /// } /// } /// } /// } /// } /// } /// </example> public static string ConstructMapper(this IType type, string serializedName, IParameter parameter, bool expandComposite) { if (type == null) { throw new ArgumentNullException(nameof(type)); } var builder = new IndentedStringBuilder(" "); CompositeType composite = type as CompositeType; SequenceType sequence = type as SequenceType; DictionaryType dictionary = type as DictionaryType; PrimaryType primary = type as PrimaryType; EnumType enumType = type as EnumType; if (enumType != null && enumType.ModelAsString) { primary = new PrimaryType(KnownPrimaryType.String); } builder.AppendLine("").Indent(); builder.AppendLine(type.AddMetaData(serializedName, parameter)); if (primary != null) { builder.AppendLine(primary.ContructMapperForPrimaryType()); } else if (enumType != null && enumType.Name != null) { builder.AppendLine(enumType.ContructMapperForEnumType()); } else if (sequence != null) { builder.AppendLine(sequence.ContructMapperForSequenceType()); } else if (dictionary != null) { builder.AppendLine(dictionary.ContructMapperForDictionaryType()); } else if (composite != null) { builder.AppendLine(composite.ContructMapperForCompositeType(expandComposite)); } else { throw new NotImplementedException(string.Format(CultureInfo.InvariantCulture, "{0} is not a supported Type.", type)); } return builder.ToString(); }
protected override IType NormalizePrimaryType(PrimaryType primaryType) { if (primaryType != null && primaryType.Type == KnownPrimaryType.Credentials) { primaryType.Name = "Microsoft.Rest.ServiceClientCredentials"; return primaryType; } else { return base.NormalizePrimaryType(primaryType); } }
private static IType NormalizePrimaryType(PrimaryType primaryType) { if (primaryType == null) { throw new ArgumentNullException("primaryType"); } if (primaryType.Type == KnownPrimaryType.Base64Url) { primaryType.Name = "bytes"; } else if (primaryType.Type == KnownPrimaryType.Boolean) { primaryType.Name = "bool"; } else if (primaryType.Type == KnownPrimaryType.ByteArray) { primaryType.Name = "bytearray"; } else if (primaryType.Type == KnownPrimaryType.Date) { primaryType.Name = "date"; } else if (primaryType.Type == KnownPrimaryType.DateTime) { primaryType.Name = "datetime"; } else if (primaryType.Type == KnownPrimaryType.DateTimeRfc1123) { primaryType.Name = "datetime"; } else if (primaryType.Type == KnownPrimaryType.Double) { primaryType.Name = "float"; } else if (primaryType.Type == KnownPrimaryType.Int) { primaryType.Name = "int"; } else if (primaryType.Type == KnownPrimaryType.Long) { primaryType.Name = "long"; } else if (primaryType.Type == KnownPrimaryType.Stream) // Revisit here { primaryType.Name = "Object"; } else if (primaryType.Type == KnownPrimaryType.String || primaryType.Type == KnownPrimaryType.Uuid) { primaryType.Name = "str"; } else if (primaryType.Type == KnownPrimaryType.TimeSpan) { primaryType.Name = "timedelta"; } else if (primaryType.Type == KnownPrimaryType.Decimal) { primaryType.Name = "Decimal"; } else if (primaryType.Type == KnownPrimaryType.UnixTime) { primaryType.Name = "datetime"; } else if (primaryType.Type == KnownPrimaryType.Object) // Revisit here { primaryType.Name = "object"; } return primaryType; }
protected virtual IType NormalizePrimaryType(PrimaryType primaryType) { switch (primaryType?.Type) { case KnownPrimaryType.Base64Url: primaryType.Name = "byte[]"; break; case KnownPrimaryType.Boolean: primaryType.Name = "bool"; break; case KnownPrimaryType.ByteArray: primaryType.Name = "byte[]"; break; case KnownPrimaryType.Date: primaryType.Name = "System.DateTime"; break; case KnownPrimaryType.DateTime: primaryType.Name = UseDateTimeOffset ? "System.DateTimeOffset" : "System.DateTime"; break; case KnownPrimaryType.DateTimeRfc1123: primaryType.Name = "System.DateTime"; break; case KnownPrimaryType.Double: primaryType.Name = "double"; break; case KnownPrimaryType.Decimal: primaryType.Name = "decimal"; break; case KnownPrimaryType.Int: primaryType.Name = "int"; break; case KnownPrimaryType.Long: primaryType.Name = "long"; break; case KnownPrimaryType.Stream: primaryType.Name = "System.IO.Stream"; break; case KnownPrimaryType.String: switch (KnownFormatExtensions.Parse( primaryType.Format ) ) { case KnownFormat.@char: primaryType.Name = "char"; break; default: primaryType.Name = "string"; break; } break; case KnownPrimaryType.TimeSpan: primaryType.Name = "System.TimeSpan"; break; case KnownPrimaryType.Object: primaryType.Name = "object"; break; case KnownPrimaryType.Credentials: primaryType.Name = "Microsoft.Rest.ServiceClientCredentials"; break; case KnownPrimaryType.UnixTime: primaryType.Name = "System.DateTime"; break; case KnownPrimaryType.Uuid: primaryType.Name = "System.Guid"; break; } return primaryType; }
/// <summary> /// Normalizes primary type. /// </summary> /// <param name="primaryType">Primary type to normalize.</param> /// <returns>Normalized primary type.</returns> private IType NormalizePrimaryType(PrimaryType primaryType) { if (primaryType == null) { throw new ArgumentNullException("primaryType"); } if (primaryType.Type == KnownPrimaryType.Base64Url) { primaryType.Name = "String"; } else if (primaryType.Type == KnownPrimaryType.Boolean) { primaryType.Name = "Boolean"; } else if (primaryType.Type == KnownPrimaryType.ByteArray) { primaryType.Name = "Array"; } else if (primaryType.Type == KnownPrimaryType.DateTime) { primaryType.Name = "DateTime"; } else if (primaryType.Type == KnownPrimaryType.DateTimeRfc1123) { primaryType.Name = "DateTime"; } else if (primaryType.Type == KnownPrimaryType.Double) { primaryType.Name = "Float"; } else if (primaryType.Type == KnownPrimaryType.Decimal) { primaryType.Name = "Float"; } else if (primaryType.Type == KnownPrimaryType.Int) { primaryType.Name = "Number"; } else if (primaryType.Type == KnownPrimaryType.Long) { primaryType.Name = "Bignum"; } else if (primaryType.Type == KnownPrimaryType.Stream) { // TODO: Ruby doesn't supports streams. primaryType.Name = "System.IO.Stream"; } else if (primaryType.Type == KnownPrimaryType.String) { primaryType.Name = "String"; } else if (primaryType.Type == KnownPrimaryType.TimeSpan) { primaryType.Name = "Duration"; } else if (primaryType.Type == KnownPrimaryType.UnixTime) { primaryType.Name = "DateTime"; } else if (primaryType.Type == KnownPrimaryType.Object) { primaryType.Name = "Object"; } return primaryType; }
private static JsonSchema ParsePrimaryType(Property property, PrimaryType primaryType) { JsonSchema result = new JsonSchema() { Format = primaryType.Format }; switch (primaryType.Type) { case KnownPrimaryType.Boolean: result.JsonType = "boolean"; break; case KnownPrimaryType.Int: case KnownPrimaryType.Long: result.JsonType = "integer"; break; case KnownPrimaryType.Double: result.JsonType = "number"; break; case KnownPrimaryType.Object: result.JsonType = "object"; break; case KnownPrimaryType.DateTime: case KnownPrimaryType.String: case KnownPrimaryType.TimeSpan: result.JsonType = "string"; break; default: Debug.Assert(false, "Unrecognized known property type: " + primaryType.Type); break; } if (property != null) { result.Description = property.Documentation; if (property.DefaultValue != null) { result.AddEnum(property.DefaultValue); } if (property.Constraints.Count > 0) { foreach (KeyValuePair<Constraint, string> entry in property.Constraints) { switch (entry.Key) { case Constraint.InclusiveMinimum: Debug.Assert(result.JsonType == "integer" || result.JsonType == "number", "Expected to only find an InclusiveMinimum constraint on an integer or number property."); result.Minimum = Double.Parse(entry.Value, CultureInfo.CurrentCulture); break; case Constraint.InclusiveMaximum: Debug.Assert(result.JsonType == "integer" || result.JsonType == "number", "Expected to only find an InclusiveMaximum constraint on an integer or number property."); result.Maximum = Double.Parse(entry.Value, CultureInfo.CurrentCulture); break; case Constraint.Pattern: Debug.Assert(result.JsonType == "string", "Expected to only find a Pattern constraint on a string property."); result.Pattern = entry.Value; break; default: Debug.Fail("Unrecognized property Constraint: " + entry.Key); break; } } } } return result; }
private void Initialize(PrimaryType primaryType) { if (primaryType.Type == KnownPrimaryType.None) { Name = "void"; } else if (primaryType.Type == KnownPrimaryType.Base64Url) { Name = "Base64Url"; _imports.Add("com.microsoft.rest.Base64Url"); } else if (primaryType.Type == KnownPrimaryType.Boolean) { Name = "boolean"; } else if (primaryType.Type == KnownPrimaryType.ByteArray) { Name = "byte[]"; } else if (primaryType.Type == KnownPrimaryType.Date) { Name = "LocalDate"; _imports.Add("org.joda.time.LocalDate"); } else if (primaryType.Type == KnownPrimaryType.DateTime) { Name = "DateTime"; _imports.Add("org.joda.time.DateTime"); } else if (primaryType.Type == KnownPrimaryType.DateTimeRfc1123) { Name = "DateTimeRfc1123"; _imports.Add("com.microsoft.rest.DateTimeRfc1123"); } else if (primaryType.Type == KnownPrimaryType.Double) { Name = "double"; } else if (primaryType.Type == KnownPrimaryType.Decimal) { Name = "BigDecimal"; _imports.Add("java.math.BigDecimal"); } else if (primaryType.Type == KnownPrimaryType.Int) { Name = "int"; } else if (primaryType.Type == KnownPrimaryType.Long) { Name = "long"; } else if (primaryType.Type == KnownPrimaryType.Stream) { Name = "InputStream"; _imports.Add("java.io.InputStream"); } else if (primaryType.Type == KnownPrimaryType.String) { Name = "String"; } else if (primaryType.Type == KnownPrimaryType.TimeSpan) { Name = "Period"; _imports.Add("org.joda.time.Period"); } else if (primaryType.Type == KnownPrimaryType.UnixTime) { Name = "long"; _imports.Add("org.joda.time.DateTime"); _imports.Add("org.joda.time.DateTimeZone"); } else if (primaryType.Type == KnownPrimaryType.Uuid) { Name = "UUID"; _imports.Add("java.util.UUID"); } else if (primaryType.Type == KnownPrimaryType.Object) { Name = "Object"; } else if (primaryType.Type == KnownPrimaryType.Credentials) { Name = "ServiceClientCredentials"; _imports.Add("com.microsoft.rest.ServiceClientCredentials"); } }