Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -1851,8 +1851,12 @@ private static void handleSettingDeserializedValue(JavaBlock methodBlock, String
// If the property is defined in a super class use the setter as this will be able to set the value in the
// super class.
if (fromSuper
// If the property is flattened or read-only from parent, it will be shadowed in child class.
&& (!ClientModelUtil.readOnlyNotInCtor(model, property, JavaSettings.getInstance()) && !property.getClientFlatten())) {
// If the property is flattened or read-only from parent, and not all models in the inheritance hierarchy are
// in the same package, it will be shadowed in child class.
&& (
model.isAllPolymorphicModelsInSamePackage()
|| (!ClientModelUtil.readOnlyNotInCtor(model, property, JavaSettings.getInstance()) &&
!property.getClientFlatten()))) {
if (polymorphicJsonMergePatchScenario) {
// Polymorphic JSON merge patch needs special handling as the setter methods are used to track whether
// the property is included in patch serialization. To prevent deserialization from requiring parent
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) TypeSpec Code Generator.

package com.cadl.streamstyleserialization;

import com.azure.core.annotation.Generated;
import com.azure.core.annotation.ReturnType;
import com.azure.core.annotation.ServiceClient;
import com.azure.core.annotation.ServiceMethod;
import com.azure.core.exception.ClientAuthenticationException;
import com.azure.core.exception.HttpResponseException;
import com.azure.core.exception.ResourceModifiedException;
import com.azure.core.exception.ResourceNotFoundException;
import com.azure.core.http.rest.PagedFlux;
import com.azure.core.http.rest.PagedResponse;
import com.azure.core.http.rest.PagedResponseBase;
import com.azure.core.http.rest.RequestOptions;
import com.azure.core.util.BinaryData;
import com.cadl.streamstyleserialization.implementation.AssetsImpl;
import com.cadl.streamstyleserialization.models.AssetResource;
import java.util.stream.Collectors;
import reactor.core.publisher.Flux;

/**
* Initializes a new instance of the asynchronous StreamStyleSerializationClient type.
*/
@ServiceClient(builder = StreamStyleSerializationClientBuilder.class, isAsync = true)
public final class StreamStyleSerializationAsyncClient {
@Generated
private final AssetsImpl serviceClient;

/**
* Initializes an instance of StreamStyleSerializationAsyncClient class.
*
* @param serviceClient the service client implementation.
*/
@Generated
StreamStyleSerializationAsyncClient(AssetsImpl serviceClient) {
this.serviceClient = serviceClient;
}

/**
* Retrieve a list of assets for the provided search parameters.
* <p><strong>Response Body Schema</strong></p>
*
* <pre>{@code
* {
* kind: String (Required)
* id: String (Required)
* name: String (Optional)
* }
* }</pre>
*
* @param requestOptions The options to configure the HTTP request before HTTP client sends it.
* @throws HttpResponseException thrown if the request is rejected by server.
* @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
* @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
* @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
* @return paged collection of AssetResource items as paginated response with {@link PagedFlux}.
*/
@Generated
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedFlux<BinaryData> listAssetResource(RequestOptions requestOptions) {
return this.serviceClient.listAssetResourceAsync(requestOptions);
}

/**
* Retrieve a list of assets for the provided search parameters.
*
* @throws HttpResponseException thrown if the request is rejected by server.
* @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
* @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
* @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return paged collection of AssetResource items as paginated response with {@link PagedFlux}.
*/
@Generated
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedFlux<AssetResource> listAssetResource() {
// Generated convenience method for listAssetResource
RequestOptions requestOptions = new RequestOptions();
PagedFlux<BinaryData> pagedFluxResponse = listAssetResource(requestOptions);
return PagedFlux.create(() -> (continuationTokenParam, pageSizeParam) -> {
Flux<PagedResponse<BinaryData>> flux = (continuationTokenParam == null)
? pagedFluxResponse.byPage().take(1)
: pagedFluxResponse.byPage(continuationTokenParam).take(1);
return flux.map(pagedResponse -> new PagedResponseBase<Void, AssetResource>(pagedResponse.getRequest(),
pagedResponse.getStatusCode(), pagedResponse.getHeaders(),
pagedResponse.getValue()
.stream()
.map(protocolMethodData -> protocolMethodData.toObject(AssetResource.class))
.collect(Collectors.toList()),
pagedResponse.getContinuationToken(), null));
});
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) TypeSpec Code Generator.

package com.cadl.streamstyleserialization;

import com.azure.core.annotation.Generated;
import com.azure.core.annotation.ReturnType;
import com.azure.core.annotation.ServiceClient;
import com.azure.core.annotation.ServiceMethod;
import com.azure.core.exception.ClientAuthenticationException;
import com.azure.core.exception.HttpResponseException;
import com.azure.core.exception.ResourceModifiedException;
import com.azure.core.exception.ResourceNotFoundException;
import com.azure.core.http.rest.PagedIterable;
import com.azure.core.http.rest.RequestOptions;
import com.azure.core.util.BinaryData;
import com.cadl.streamstyleserialization.implementation.AssetsImpl;
import com.cadl.streamstyleserialization.models.AssetResource;

/**
* Initializes a new instance of the synchronous StreamStyleSerializationClient type.
*/
@ServiceClient(builder = StreamStyleSerializationClientBuilder.class)
public final class StreamStyleSerializationClient {
@Generated
private final AssetsImpl serviceClient;

/**
* Initializes an instance of StreamStyleSerializationClient class.
*
* @param serviceClient the service client implementation.
*/
@Generated
StreamStyleSerializationClient(AssetsImpl serviceClient) {
this.serviceClient = serviceClient;
}

/**
* Retrieve a list of assets for the provided search parameters.
* <p><strong>Response Body Schema</strong></p>
*
* <pre>{@code
* {
* kind: String (Required)
* id: String (Required)
* name: String (Optional)
* }
* }</pre>
*
* @param requestOptions The options to configure the HTTP request before HTTP client sends it.
* @throws HttpResponseException thrown if the request is rejected by server.
* @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
* @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
* @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
* @return paged collection of AssetResource items as paginated response with {@link PagedIterable}.
*/
@Generated
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedIterable<BinaryData> listAssetResource(RequestOptions requestOptions) {
return this.serviceClient.listAssetResource(requestOptions);
}

/**
* Retrieve a list of assets for the provided search parameters.
*
* @throws HttpResponseException thrown if the request is rejected by server.
* @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
* @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
* @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return paged collection of AssetResource items as paginated response with {@link PagedIterable}.
*/
@Generated
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedIterable<AssetResource> listAssetResource() {
// Generated convenience method for listAssetResource
RequestOptions requestOptions = new RequestOptions();
return serviceClient.listAssetResource(requestOptions)
.mapPage(bodyItemValue -> bodyItemValue.toObject(AssetResource.class));
}
}
Loading