@@ -91,7 +91,7 @@ public class JavaCodeGenerator : CodeGenerator
91
91
"byte[]" , "Byte[]" ,
92
92
"String" ,
93
93
"LocalDate" ,
94
- "DateTime " ,
94
+ "OffsetDateTime " ,
95
95
"DateTimeRfc1123" ,
96
96
"Duration" ,
97
97
"Period" ,
@@ -154,7 +154,6 @@ public override Task Generate(AutoRestCodeModel codeModel)
154
154
package : codeModel . Namespace . ToLowerInvariant ( ) ,
155
155
shouldGenerateXmlSerialization : codeModel . ShouldGenerateXmlSerialization ,
156
156
nonNullAnnotations : GetBoolSetting ( autoRestSettings , "non-null-annotations" , true ) ,
157
- stringDates : GetBoolSetting ( autoRestSettings , "string-dates" ) ,
158
157
clientTypePrefix : GetStringSetting ( autoRestSettings , "client-type-prefix" ) ,
159
158
generateClientInterfaces : GetBoolSetting ( autoRestSettings , "generate-client-interfaces" , true ) ,
160
159
implementationSubpackage : GetStringSetting ( autoRestSettings , "implementation-subpackage" , "implementation" ) ,
@@ -1428,13 +1427,13 @@ private static IType ParseType(AutoRestIModelType autoRestIModelType, JavaSettin
1428
1427
result = ArrayType . ByteArray ;
1429
1428
break ;
1430
1429
case AutoRestKnownPrimaryType . Date :
1431
- result = settings . StringDates ? ClassType . String : ClassType . JodaLocalDate ;
1430
+ result = ClassType . LocalDate ;
1432
1431
break ;
1433
1432
case AutoRestKnownPrimaryType . DateTime :
1434
- result = settings . StringDates ? ClassType . String : ClassType . JodaDateTime ;
1433
+ result = ClassType . DateTime ;
1435
1434
break ;
1436
1435
case AutoRestKnownPrimaryType . DateTimeRfc1123 :
1437
- result = settings . StringDates ? ClassType . String : ClassType . DateTimeRfc1123 ;
1436
+ result = ClassType . DateTimeRfc1123 ;
1438
1437
break ;
1439
1438
case AutoRestKnownPrimaryType . Double :
1440
1439
result = PrimitiveType . Double ;
@@ -1462,10 +1461,10 @@ private static IType ParseType(AutoRestIModelType autoRestIModelType, JavaSettin
1462
1461
}
1463
1462
break ;
1464
1463
case AutoRestKnownPrimaryType . TimeSpan :
1465
- result = ClassType . JodaPeriod ;
1464
+ result = ClassType . Duration ;
1466
1465
break ;
1467
1466
case AutoRestKnownPrimaryType . UnixTime :
1468
- result = settings . StringDates ? ( IType ) ClassType . String : PrimitiveType . UnixTimeLong ;
1467
+ result = PrimitiveType . UnixTimeLong ;
1469
1468
break ;
1470
1469
case AutoRestKnownPrimaryType . Uuid :
1471
1470
result = ClassType . UUID ;
@@ -2684,7 +2683,7 @@ public static JavaFile GetModelJavaFile(ServiceModel model, JavaSettings setting
2684
2683
string propertyConversion = null ;
2685
2684
switch ( sourceTypeName . ToLower ( ) )
2686
2685
{
2687
- case "datetime " :
2686
+ case "offsetdatetime " :
2688
2687
switch ( targetTypeName . ToLower ( ) )
2689
2688
{
2690
2689
case "datetimerfc1123" :
@@ -2696,7 +2695,7 @@ public static JavaFile GetModelJavaFile(ServiceModel model, JavaSettings setting
2696
2695
case "datetimerfc1123" :
2697
2696
switch ( targetTypeName . ToLower ( ) )
2698
2697
{
2699
- case "datetime " :
2698
+ case "offsetdatetime " :
2700
2699
propertyConversion = $ "{ expression } .dateTime()";
2701
2700
break ;
2702
2701
}
@@ -2742,7 +2741,7 @@ public static JavaFile GetModelJavaFile(ServiceModel model, JavaSettings setting
2742
2741
{
2743
2742
switch ( sourceTypeName . ToLower ( ) )
2744
2743
{
2745
- case "datetime " :
2744
+ case "offsetdatetime " :
2746
2745
switch ( targetTypeName . ToLower ( ) )
2747
2746
{
2748
2747
case "datetimerfc1123" :
@@ -2754,7 +2753,7 @@ public static JavaFile GetModelJavaFile(ServiceModel model, JavaSettings setting
2754
2753
case "datetimerfc1123" :
2755
2754
switch ( targetTypeName . ToLower ( ) )
2756
2755
{
2757
- case "datetime " :
2756
+ case "offsetdatetime " :
2758
2757
propertyConversion = $ "{ expression } .dateTime()";
2759
2758
break ;
2760
2759
}
@@ -3032,7 +3031,7 @@ private static IType ConvertToClientType(IType modelType)
3032
3031
}
3033
3032
else if ( modelType == ClassType . DateTimeRfc1123 )
3034
3033
{
3035
- clientType = ClassType . JodaDateTime ;
3034
+ clientType = ClassType . DateTime ;
3036
3035
}
3037
3036
else if ( modelType == PrimitiveType . UnixTimeLong )
3038
3037
{
@@ -3180,7 +3179,7 @@ private static string AutoRestIModelTypeName(AutoRestIModelType autoRestModelTyp
3180
3179
result = "LocalDate" ;
3181
3180
break ;
3182
3181
case AutoRestKnownPrimaryType . DateTime :
3183
- result = "DateTime " ;
3182
+ result = "OffsetDateTime " ;
3184
3183
break ;
3185
3184
case AutoRestKnownPrimaryType . DateTimeRfc1123 :
3186
3185
result = "DateTimeRfc1123" ;
@@ -3303,14 +3302,14 @@ private static void ParameterConvertClientTypeToWireType(JavaBlock block, JavaSe
3303
3302
{
3304
3303
if ( parameterIsRequired )
3305
3304
{
3306
- block . Line ( $ "Long { target } = { source } .toDateTime(DateTimeZone.UTC).getMillis() / 1000 ;") ;
3305
+ block . Line ( $ "Long { target } = { source } .toInstant().getEpochSecond() ;") ;
3307
3306
}
3308
3307
else
3309
3308
{
3310
3309
block . Line ( $ "Long { target } = null;") ;
3311
3310
block . If ( $ "{ source } != null", ifBlock =>
3312
3311
{
3313
- ifBlock . Line ( $ "{ target } = { source } .toDateTime(DateTimeZone.UTC).getMillis() / 1000 ;") ;
3312
+ ifBlock . Line ( $ "{ target } = { source } .toInstant().getEpochSecond() ;") ;
3314
3313
} ) ;
3315
3314
}
3316
3315
}
@@ -4597,10 +4596,10 @@ private static IEnumerable<string> GetExpressionsToValidate(RestAPIMethod restAP
4597
4596
parameterType != ClassType . Double &&
4598
4597
parameterType != ClassType . BigDecimal &&
4599
4598
parameterType != ClassType . String &&
4600
- parameterType != ClassType . JodaDateTime &&
4601
- parameterType != ClassType . JodaLocalDate &&
4599
+ parameterType != ClassType . DateTime &&
4600
+ parameterType != ClassType . LocalDate &&
4602
4601
parameterType != ClassType . DateTimeRfc1123 &&
4603
- parameterType != ClassType . JodaPeriod &&
4602
+ parameterType != ClassType . Duration &&
4604
4603
parameterType != ClassType . Boolean &&
4605
4604
parameterType != ClassType . ServiceClientCredentials &&
4606
4605
parameterType != ClassType . AzureTokenCredentials &&
0 commit comments