diff --git a/packages/http-client-java/generator/http-client-generator-core/src/main/java/com/microsoft/typespec/http/client/generator/core/model/clientmodel/ClassType.java b/packages/http-client-java/generator/http-client-generator-core/src/main/java/com/microsoft/typespec/http/client/generator/core/model/clientmodel/ClassType.java index 44628b04a0..a04f6fedb2 100644 --- a/packages/http-client-java/generator/http-client-generator-core/src/main/java/com/microsoft/typespec/http/client/generator/core/model/clientmodel/ClassType.java +++ b/packages/http-client-java/generator/http-client-generator-core/src/main/java/com/microsoft/typespec/http/client/generator/core/model/clientmodel/ClassType.java @@ -309,13 +309,18 @@ private static ClassType.Builder getClassTypeBuilder(Class classKey) { .jsonToken("JsonToken.STRING") .serializationValueGetterModifier(valueGetter -> valueGetter + " == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(" + valueGetter + ")") - .jsonDeserializationMethod("getNullable(nonNullReader -> " + CORE_UTILS.getName() - + ".parseBestOffsetDateTime(nonNullReader.getString()))") + .jsonDeserializationMethod(JavaSettings.getInstance().isBranded() + ? ("getNullable(nonNullReader -> " + CORE_UTILS.getName() + + ".parseBestOffsetDateTime(nonNullReader.getString()))") + : ("getNullable(nonNullReader -> OffsetDateTime.parse(nonNullReader.getString()))")) .serializationMethodBase("writeString") - .xmlElementDeserializationMethod( - "getNullableElement(dateString -> " + CORE_UTILS.getName() + ".parseBestOffsetDateTime(dateString))") - .xmlAttributeDeserializationTemplate("%s.getNullableAttribute(%s, %s, dateString -> " + CORE_UTILS.getName() - + ".parseBestOffsetDateTime(dateString))") + .xmlElementDeserializationMethod(JavaSettings.getInstance().isBranded() + ? ("getNullableElement(dateString -> " + CORE_UTILS.getName() + ".parseBestOffsetDateTime(dateString))") + : ("getNullableElement(dateString -> OffsetDateTime.parse(dateString))")) + .xmlAttributeDeserializationTemplate(JavaSettings.getInstance().isBranded() + ? ("%s.getNullableAttribute(%s, %s, dateString -> " + CORE_UTILS.getName() + + ".parseBestOffsetDateTime(dateString))") + : ("%s.getNullableAttribute(%s, %s, dateString -> OffsetDateTime.parse(dateString))")) .build(); public static final ClassType DURATION = new Builder(false).knownClass(Duration.class) diff --git a/packages/http-client-java/generator/http-client-generator/src/main/java/com/microsoft/typespec/http/client/generator/model/EmitterOptions.java b/packages/http-client-java/generator/http-client-generator/src/main/java/com/microsoft/typespec/http/client/generator/model/EmitterOptions.java index 910f8e3d38..3f3feb0cf6 100644 --- a/packages/http-client-java/generator/http-client-generator/src/main/java/com/microsoft/typespec/http/client/generator/model/EmitterOptions.java +++ b/packages/http-client-java/generator/http-client-generator/src/main/java/com/microsoft/typespec/http/client/generator/model/EmitterOptions.java @@ -17,7 +17,7 @@ public class EmitterOptions implements JsonSerializable { private String namespace; private String outputDir; - private String flavor = "Azure"; + private String flavor = "generic"; private String serviceName; private List serviceVersions; private Boolean generateTests = true;