Skip to content

Commit

Permalink
Remove string-dates flag
Browse files Browse the repository at this point in the history
  • Loading branch information
Dan Schulte committed Mar 7, 2018
1 parent 9e99f4e commit 1f57f00
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 16 deletions.
4 changes: 0 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,6 @@ This project enables Java code generation in [AutoRest](https://github.com/Azure
- With Argument (`true`): `int Plus(@NonNull Integer val1, @NonNull Integer val2)`
- *--java.required-parameter-client-methods*: Whether or not Service and Method Group client method overloads that omit optional parameters will be created.
- Default: `true`
- *--java.string-dates*: Whether or not DateTime types should be represented as Strings (generally for better/different precision).
- Default: `false`
- Without Argument: `public DateTime duration(DateTime startTime, DateTime endTime)`
- With Argument (`true`): `public String duration(String startTime, String endTime)`

# Contributing

Expand Down
9 changes: 4 additions & 5 deletions src/JavaCodeGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,6 @@ public override Task Generate(AutoRestCodeModel codeModel)
package: codeModel.Namespace.ToLowerInvariant(),
shouldGenerateXmlSerialization: codeModel.ShouldGenerateXmlSerialization,
nonNullAnnotations: GetBoolSetting(autoRestSettings, "non-null-annotations", true),
stringDates: GetBoolSetting(autoRestSettings, "string-dates"),
clientTypePrefix: GetStringSetting(autoRestSettings, "client-type-prefix"),
generateClientInterfaces: GetBoolSetting(autoRestSettings, "generate-client-interfaces", true),
implementationSubpackage: GetStringSetting(autoRestSettings, "implementation-subpackage", "implementation"),
Expand Down Expand Up @@ -1428,13 +1427,13 @@ private static IType ParseType(AutoRestIModelType autoRestIModelType, JavaSettin
result = ArrayType.ByteArray;
break;
case AutoRestKnownPrimaryType.Date:
result = settings.StringDates ? ClassType.String : ClassType.JodaLocalDate;
result = ClassType.JodaLocalDate;
break;
case AutoRestKnownPrimaryType.DateTime:
result = settings.StringDates ? ClassType.String : ClassType.JodaDateTime;
result = ClassType.JodaDateTime;
break;
case AutoRestKnownPrimaryType.DateTimeRfc1123:
result = settings.StringDates ? ClassType.String : ClassType.DateTimeRfc1123;
result = ClassType.DateTimeRfc1123;
break;
case AutoRestKnownPrimaryType.Double:
result = PrimitiveType.Double;
Expand Down Expand Up @@ -1465,7 +1464,7 @@ private static IType ParseType(AutoRestIModelType autoRestIModelType, JavaSettin
result = ClassType.JodaPeriod;
break;
case AutoRestKnownPrimaryType.UnixTime:
result = settings.StringDates ? (IType)ClassType.String : PrimitiveType.UnixTimeLong;
result = PrimitiveType.UnixTimeLong;
break;
case AutoRestKnownPrimaryType.Uuid:
result = ClassType.UUID;
Expand Down
7 changes: 0 additions & 7 deletions src/JavaSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ public JavaSettings(
string package,
bool shouldGenerateXmlSerialization,
bool nonNullAnnotations,
bool stringDates,
string clientTypePrefix,
bool generateClientInterfaces,
string implementationSubpackage,
Expand All @@ -62,7 +61,6 @@ public JavaSettings(
Package = package;
ShouldGenerateXmlSerialization = shouldGenerateXmlSerialization;
NonNullAnnotations = nonNullAnnotations;
StringDates = stringDates;
ClientTypePrefix = clientTypePrefix;
GenerateClientInterfaces = generateClientInterfaces;
ImplementationSubpackage = implementationSubpackage;
Expand Down Expand Up @@ -100,11 +98,6 @@ public bool AddCredentials
/// </summary>
public bool NonNullAnnotations { get; }

/// <summary>
/// Whether or not DateTime types should be represented as Strings (generally for better/different precision).
/// </summary>
public bool StringDates { get; }

/// <summary>
/// The prefix that will be added to each generated client type.
/// </summary>
Expand Down

0 comments on commit 1f57f00

Please sign in to comment.