Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
add Integer customization:
  • Loading branch information
samvaity committed Jan 16, 2025
commit c6ce5b5bfb8ce938db290a7d275d7b25bd4aff2b
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.

package com.azure.messaging.eventgrid.systemevents;

import com.azure.core.annotation.Fluent;
Expand All @@ -18,6 +17,7 @@
*/
@Fluent
public final class AcsSmsReceivedEventData extends AcsSmsEventBaseProperties {

/*
* The SMS content
*/
Expand All @@ -31,7 +31,7 @@ public final class AcsSmsReceivedEventData extends AcsSmsEventBaseProperties {
/*
* Number of segments in the message
*/
private int segmentCount;
private Integer segmentCount;

/**
* Creates an instance of AcsSmsReceivedEventData class.
Expand All @@ -41,7 +41,7 @@ public AcsSmsReceivedEventData() {

/**
* Get the message property: The SMS content.
*
*
* @return the message value.
*/
public String getMessage() {
Expand All @@ -50,7 +50,7 @@ public String getMessage() {

/**
* Set the message property: The SMS content.
*
*
* @param message the message value to set.
* @return the AcsSmsReceivedEventData object itself.
*/
Expand All @@ -61,7 +61,7 @@ public AcsSmsReceivedEventData setMessage(String message) {

/**
* Get the receivedTimestamp property: The time at which the SMS was received.
*
*
* @return the receivedTimestamp value.
*/
public OffsetDateTime getReceivedTimestamp() {
Expand All @@ -70,7 +70,7 @@ public OffsetDateTime getReceivedTimestamp() {

/**
* Set the receivedTimestamp property: The time at which the SMS was received.
*
*
* @param receivedTimestamp the receivedTimestamp value to set.
* @return the AcsSmsReceivedEventData object itself.
*/
Expand All @@ -81,20 +81,20 @@ public AcsSmsReceivedEventData setReceivedTimestamp(OffsetDateTime receivedTimes

/**
* Get the segmentCount property: Number of segments in the message.
*
*
* @return the segmentCount value.
*/
public int getSegmentCount() {
public Integer getSegmentCount() {
return this.segmentCount;
}

/**
* Set the segmentCount property: Number of segments in the message.
*
*
* @param segmentCount the segmentCount value to set.
* @return the AcsSmsReceivedEventData object itself.
*/
public AcsSmsReceivedEventData setSegmentCount(int segmentCount) {
public AcsSmsReceivedEventData setSegmentCount(Integer segmentCount) {
this.segmentCount = segmentCount;
return this;
}
Expand Down Expand Up @@ -146,7 +146,7 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {

/**
* Reads an instance of AcsSmsReceivedEventData from the JsonReader.
*
*
* @param jsonReader The JsonReader being read.
* @return An instance of AcsSmsReceivedEventData if the JsonReader was pointing to an instance of it, or null if it
* was pointing to JSON null.
Expand All @@ -159,7 +159,6 @@ public static AcsSmsReceivedEventData fromJson(JsonReader jsonReader) throws IOE
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();

if ("messageId".equals(fieldName)) {
deserializedAcsSmsReceivedEventData.setMessageId(reader.getString());
} else if ("from".equals(fieldName)) {
Expand All @@ -177,7 +176,6 @@ public static AcsSmsReceivedEventData fromJson(JsonReader jsonReader) throws IOE
reader.skipChildren();
}
}

return deserializedAcsSmsReceivedEventData;
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,11 @@ public void customize(LibraryCustomization customization, Logger logger) {
public void customizeCommuicationSMSEvents(LibraryCustomization customization) {
PackageCustomization packageModels = customization.getPackage("com.azure.messaging.eventgrid.systemevents");
ClassCustomization classCustomization = packageModels.getClass("AcsSmsReceivedEventData");
classCustomization.customizeAst(ast -> {
ast.getClassByName("AcsSmsReceivedEventData").ifPresent(clazz -> {
clazz.getFieldByName("segmentCount").get().getVariable(0).setType("Integer");
});
});

classCustomization.customizeAst(comp -> {
ClassOrInterfaceDeclaration clazz = comp.getClassByName("AcsSmsReceivedEventData").get();
Expand Down
Loading