Skip to content

Commit 6446ac1

Browse files
authored
API cleanup of azure-core-v2 (Azure#44214)
1 parent 8bb1c15 commit 6446ac1

File tree

80 files changed

+75
-3384
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

80 files changed

+75
-3384
lines changed

sdk/clientcore/core/spotbugs-exclude.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
<Match>
1414
<Bug pattern="BC_UNCONFIRMED_CAST_OF_RETURN_VALUE" />
1515
<Or>
16+
<Class name="io.clientcore.core.http.models.HttpRange" />
1617
<Class name="io.clientcore.core.http.models.HttpRequest" />
1718
<Class name="io.clientcore.core.http.models.RequestOptions" />
1819
<Class name="io.clientcore.core.http.pipeline.HttpPipelineBuilder" />

sdk/core/azure-core-v2/src/main/java/com/azure/v2/core/utils/ETag.java renamed to sdk/clientcore/core/src/main/java/io/clientcore/core/http/models/ETag.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Copyright (c) Microsoft Corporation. All rights reserved.
22
// Licensed under the MIT License.
33

4-
package com.azure.v2.core.utils;
4+
package io.clientcore.core.http.models;
55

66
import io.clientcore.core.instrumentation.logging.ClientLogger;
77

sdk/core/azure-core-v2/src/main/java/com/azure/v2/core/http/MatchConditions.java renamed to sdk/clientcore/core/src/main/java/io/clientcore/core/http/models/HttpMatchConditions.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
// Copyright (c) Microsoft Corporation. All rights reserved.
22
// Licensed under the MIT License.
33

4-
package com.azure.v2.core.http;
4+
package io.clientcore.core.http.models;
55

6-
import com.azure.v2.core.annotations.Fluent;
7-
import io.clientcore.core.http.models.HttpRequest;
6+
import io.clientcore.core.annotations.Metadata;
7+
import io.clientcore.core.annotations.TypeConditions;
88

99
/**
1010
* <p>Specifies HTTP options for conditional requests based on ETag matching.</p>
@@ -17,15 +17,15 @@
1717
*
1818
* @see HttpRequest
1919
*/
20-
@Fluent
21-
public class MatchConditions {
20+
@Metadata(conditions = TypeConditions.FLUENT)
21+
public class HttpMatchConditions {
2222
private String ifMatch;
2323
private String ifNoneMatch;
2424

2525
/**
26-
* Creates a new instance of {@link MatchConditions}.
26+
* Creates a new instance of {@link HttpMatchConditions}.
2727
*/
28-
public MatchConditions() {
28+
public HttpMatchConditions() {
2929
}
3030

3131
/**
@@ -43,7 +43,7 @@ public String getIfMatch() {
4343
* @param ifMatch ETag that resources must match.
4444
* @return The updated MatchConditions object.
4545
*/
46-
public MatchConditions setIfMatch(String ifMatch) {
46+
public HttpMatchConditions setIfMatch(String ifMatch) {
4747
this.ifMatch = ifMatch;
4848
return this;
4949
}
@@ -63,7 +63,7 @@ public String getIfNoneMatch() {
6363
* @param ifNoneMatch ETag that resources must not match.
6464
* @return The updated MatchConditions object.
6565
*/
66-
public MatchConditions setIfNoneMatch(String ifNoneMatch) {
66+
public HttpMatchConditions setIfNoneMatch(String ifNoneMatch) {
6767
this.ifNoneMatch = ifNoneMatch;
6868
return this;
6969
}

sdk/core/azure-core-v2/src/main/java/com/azure/v2/core/http/HttpRange.java renamed to sdk/clientcore/core/src/main/java/io/clientcore/core/http/models/HttpRange.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
// Copyright (c) Microsoft Corporation. All rights reserved.
22
// Licensed under the MIT License.
33

4-
package com.azure.v2.core.http;
4+
package io.clientcore.core.http.models;
55

6-
import com.azure.v2.core.annotations.Immutable;
7-
import io.clientcore.core.http.models.HttpRequest;
6+
import io.clientcore.core.annotations.Metadata;
7+
import io.clientcore.core.annotations.TypeConditions;
88
import io.clientcore.core.instrumentation.logging.ClientLogger;
99

1010
import java.util.Objects;
@@ -22,7 +22,7 @@
2222
*
2323
* @see HttpRequest
2424
*/
25-
@Immutable
25+
@Metadata(conditions = TypeConditions.IMMUTABLE)
2626
public final class HttpRange {
2727
// HttpRange can be a highly used, short-lived class, use a static logger.
2828
private static final ClientLogger LOGGER = new ClientLogger(HttpRange.class);

sdk/core/azure-core-v2/src/main/java/com/azure/v2/core/http/RequestConditions.java renamed to sdk/clientcore/core/src/main/java/io/clientcore/core/http/models/HttpRequestConditions.java

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,37 @@
11
// Copyright (c) Microsoft Corporation. All rights reserved.
22
// Licensed under the MIT License.
33

4-
package com.azure.v2.core.http;
4+
package io.clientcore.core.http.models;
55

6-
import com.azure.v2.core.annotations.Fluent;
6+
import io.clientcore.core.annotations.Metadata;
7+
import io.clientcore.core.annotations.TypeConditions;
78

89
import java.time.OffsetDateTime;
910

1011
/**
1112
* <p>Specifies HTTP options for conditional requests based on modification time and ETag matching.</p>
1213
*
13-
* <p>This class extends {@link MatchConditions} and adds conditions based on the modification time of the resource.
14+
* <p>This class extends {@link HttpMatchConditions} and adds conditions based on the modification time of the resource.
1415
* It encapsulates conditions such as If-Modified-Since and If-Unmodified-Since, in addition to If-Match and
15-
* If-None-Match from {@link MatchConditions}.</p>
16+
* If-None-Match from {@link HttpMatchConditions}.</p>
1617
*
1718
* <p>This class is useful when you want to create an HTTP request with conditional headers based on the modification
1819
* time of the resource and ETag matching. For example, you can use it to create a GET request that only retrieves the
1920
* resource if it has been modified since a specific time, or a PUT request that only updates the resource if it
2021
* has not been modified by another client since a specific time.</p>
2122
*
22-
* @see MatchConditions
23+
* @see HttpMatchConditions
2324
* @see OffsetDateTime
2425
*/
25-
@Fluent
26-
public class RequestConditions extends MatchConditions {
26+
@Metadata(conditions = TypeConditions.FLUENT)
27+
public class HttpRequestConditions extends HttpMatchConditions {
2728
private OffsetDateTime ifModifiedSince;
2829
private OffsetDateTime ifUnmodifiedSince;
2930

3031
/**
31-
* Creates a new instance of {@link RequestConditions}.
32+
* Creates a new instance of {@link HttpRequestConditions}.
3233
*/
33-
public RequestConditions() {
34+
public HttpRequestConditions() {
3435
}
3536

3637
/**
@@ -40,7 +41,7 @@ public RequestConditions() {
4041
* @return The updated ResourceConditions object.
4142
*/
4243
@Override
43-
public RequestConditions setIfMatch(String ifMatch) {
44+
public HttpRequestConditions setIfMatch(String ifMatch) {
4445
super.setIfMatch(ifMatch);
4546
return this;
4647
}
@@ -52,7 +53,7 @@ public RequestConditions setIfMatch(String ifMatch) {
5253
* @return The updated ResourceConditions object.
5354
*/
5455
@Override
55-
public RequestConditions setIfNoneMatch(String ifNoneMatch) {
56+
public HttpRequestConditions setIfNoneMatch(String ifNoneMatch) {
5657
super.setIfNoneMatch(ifNoneMatch);
5758
return this;
5859
}
@@ -73,7 +74,7 @@ public OffsetDateTime getIfModifiedSince() {
7374
* @param ifModifiedSince The datetime that resources must have been modified since.
7475
* @return The updated ResourceConditions object.
7576
*/
76-
public RequestConditions setIfModifiedSince(OffsetDateTime ifModifiedSince) {
77+
public HttpRequestConditions setIfModifiedSince(OffsetDateTime ifModifiedSince) {
7778
this.ifModifiedSince = ifModifiedSince;
7879
return this;
7980
}
@@ -94,7 +95,7 @@ public OffsetDateTime getIfUnmodifiedSince() {
9495
* @param ifUnmodifiedSince The datetime that resources must have remained unmodified since.
9596
* @return The updated ResourceConditions object.
9697
*/
97-
public RequestConditions setIfUnmodifiedSince(OffsetDateTime ifUnmodifiedSince) {
98+
public HttpRequestConditions setIfUnmodifiedSince(OffsetDateTime ifUnmodifiedSince) {
9899
this.ifUnmodifiedSince = ifUnmodifiedSince;
99100
return this;
100101
}

sdk/core/azure-core-v2/src/main/java/com/azure/v2/core/utils/ProgressListener.java renamed to sdk/clientcore/core/src/main/java/io/clientcore/core/utils/ProgressListener.java

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,12 @@
11
// Copyright (c) Microsoft Corporation. All rights reserved.
22
// Licensed under the MIT License.
33

4-
package com.azure.v2.core.utils;
4+
package io.clientcore.core.utils;
55

66
/**
77
* A {@link ProgressListener} is an interface that can be used to listen to the progress of the I/O transfers.
88
* The {@link #handleProgress(long)} method will be called periodically with the total progress accumulated
99
* at the given point of time.
10-
*
11-
* <p>
12-
* <strong>Code samples</strong>
13-
* </p>
14-
*
15-
* <!-- src_embed com.azure.core.util.ProgressReportingE2ESample -->
16-
* <!-- end com.azure.core.util.ProgressReportingE2ESample -->
1710
*/
1811
@FunctionalInterface
1912
public interface ProgressListener {

sdk/core/azure-core-v2/src/main/java/com/azure/v2/core/utils/ProgressReporter.java renamed to sdk/clientcore/core/src/main/java/io/clientcore/core/utils/ProgressReporter.java

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Copyright (c) Microsoft Corporation. All rights reserved.
22
// Licensed under the MIT License.
33

4-
package com.azure.v2.core.utils;
4+
package io.clientcore.core.utils;
55

66
import java.util.Objects;
77
import java.util.concurrent.atomic.AtomicLongFieldUpdater;
@@ -15,13 +15,6 @@
1515
* complex operations that involve multiple sub-operations. In the latter case {@link ProgressReporter}
1616
* forms a tree where child nodes track the progress of sub-operations and report to the parent which in turn
1717
* aggregates the total progress. The reporting tree can have arbitrary level of nesting.
18-
*
19-
* <p>
20-
* <strong>Code samples</strong>
21-
* </p>
22-
*
23-
* <!-- src_embed com.azure.core.util.ProgressReportingE2ESample -->
24-
* <!-- end com.azure.core.util.ProgressReportingE2ESample -->
2518
*/
2619
public final class ProgressReporter {
2720

sdk/core/azure-core-test-v2/src/main/java/com/azure/v2/core/test/utils/HttpUrlConnectionHttpClient.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44
package com.azure.v2.core.test.utils;
55

6-
import com.azure.v2.core.utils.ProgressReporter;
76
import io.clientcore.core.http.client.HttpClient;
87
import io.clientcore.core.http.models.HttpHeader;
98
import io.clientcore.core.http.models.HttpHeaderName;
@@ -12,6 +11,7 @@
1211
import io.clientcore.core.http.models.Response;
1312
import io.clientcore.core.models.binarydata.BinaryData;
1413
import io.clientcore.core.models.binarydata.ByteArrayBinaryData;
14+
import io.clientcore.core.utils.ProgressReporter;
1515

1616
import java.io.BufferedInputStream;
1717
import java.io.BufferedOutputStream;

sdk/core/azure-core-v2/checkstyle-suppressions.xml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
<!-- This file is generated by the /eng/scripts/linting_suppression_generator.py script. -->
44

55
<suppressions>
6-
<suppress files="com.azure.v2.core.http.policy.CookiePolicy.java" checks="UnusedImportsCheck" />
7-
<suppress files="com.azure.v2.core.implementation.util.HttpUtils.java" checks="UnusedImportsCheck" />
86
<suppress files="com.azure.v2.core.utils.CoreUtils.java" checks="UnusedImportsCheck" />
97
<suppress files="com.azure.v2.core.utils.serializers.SerializerEncoding.java" checks="UnusedImportsCheck" />
108
<suppress files="com.azure.v2.core.http.policy.BearerTokenAuthenticationPolicy.java" checks="com.azure.tools.checkstyle.checks.ThrowFromClientLoggerCheck" />

sdk/core/azure-core-v2/src/main/java/com/azure/v2/core/annotations/Delete.java

Lines changed: 0 additions & 42 deletions
This file was deleted.

0 commit comments

Comments
 (0)