From 8e9ec107d8a40653c285530682bf9923db93dae6 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Mon, 27 Feb 2023 02:43:00 +0000 Subject: [PATCH] CodeGen from PR 3627 in openapi-env-test/azure-rest-api-specs Merge 55518ad9b4ef89697acaf143d5234cc8431b9a72 into beefd08bee3413e2be63bb72fa5f5883edc40422 --- .../AnomalyDetectorAsyncClient.java | 11 +-- .../AnomalyDetectorClient.java | 11 +-- .../AnomalyDetectorClientImpl.java | 8 +- .../ai/anomalydetector/models/AlignMode.java | 57 ++++++------- .../ai/anomalydetector/models/DataSchema.java | 10 ++- .../anomalydetector/models/FillNAMethod.java | 12 ++- .../ai/anomalydetector/models/ImputeMode.java | 8 ++ .../anomalydetector/models/ModelStatus.java | 65 +++++++------- .../MultivariateBatchDetectionStatus.java | 65 +++++++------- .../models/MultivariateDetectionResult.java | 2 +- .../models/TimeGranularity.java | 85 +++++++++---------- 11 files changed, 171 insertions(+), 163 deletions(-) diff --git a/sdk/anomalydetector/azure-ai-anomalydetector/src/main/java/com/azure/ai/anomalydetector/AnomalyDetectorAsyncClient.java b/sdk/anomalydetector/azure-ai-anomalydetector/src/main/java/com/azure/ai/anomalydetector/AnomalyDetectorAsyncClient.java index c4f93d00ce06..1c8810c30cdb 100644 --- a/sdk/anomalydetector/azure-ai-anomalydetector/src/main/java/com/azure/ai/anomalydetector/AnomalyDetectorAsyncClient.java +++ b/sdk/anomalydetector/azure-ai-anomalydetector/src/main/java/com/azure/ai/anomalydetector/AnomalyDetectorAsyncClient.java @@ -301,7 +301,7 @@ public Mono> detectUnivariateChangePointWithResponse( * @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 detection results for the given resultId along with {@link Response} on successful completion of {@link + * @return detections results for the given resultId along with {@link Response} on successful completion of {@link * Mono}. */ @Generated @@ -701,7 +701,7 @@ public Mono> getMultivariateModelWithResponse(String modelI * @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 detection results for the given resultId along with {@link Response} on successful completion of {@link + * @return detections results for the given resultId along with {@link Response} on successful completion of {@link * Mono}. */ @Generated @@ -885,7 +885,7 @@ public Mono detectUnivariateChangePoint( * @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 detection results for the given resultId on successful completion of {@link Mono}. + * @return detections results for the given resultId on successful completion of {@link Mono}. */ @Generated @ServiceMethod(returns = ReturnType.SINGLE) @@ -940,8 +940,9 @@ public Mono trainMultivariateModel(ModelInfo modelInfo) { * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return response of listing models as paginated response with {@link PagedFlux}. */ + @Generated @ServiceMethod(returns = ReturnType.COLLECTION) - PagedFlux listMultivariateModels(Integer skip, Integer top) { + public PagedFlux listMultivariateModels(Integer skip, Integer top) { // Generated convenience method for listMultivariateModels RequestOptions requestOptions = new RequestOptions(); if (skip != null) { @@ -1081,7 +1082,7 @@ public Mono getMultivariateModel(String modelId) { * @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 detection results for the given resultId on successful completion of {@link Mono}. + * @return detections results for the given resultId on successful completion of {@link Mono}. */ @Generated @ServiceMethod(returns = ReturnType.SINGLE) diff --git a/sdk/anomalydetector/azure-ai-anomalydetector/src/main/java/com/azure/ai/anomalydetector/AnomalyDetectorClient.java b/sdk/anomalydetector/azure-ai-anomalydetector/src/main/java/com/azure/ai/anomalydetector/AnomalyDetectorClient.java index 6cf43d0d3f13..14dcb61475d4 100644 --- a/sdk/anomalydetector/azure-ai-anomalydetector/src/main/java/com/azure/ai/anomalydetector/AnomalyDetectorClient.java +++ b/sdk/anomalydetector/azure-ai-anomalydetector/src/main/java/com/azure/ai/anomalydetector/AnomalyDetectorClient.java @@ -291,7 +291,7 @@ public Response detectUnivariateChangePointWithResponse( * @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 detection results for the given resultId along with {@link Response}. + * @return detections results for the given resultId along with {@link Response}. */ @Generated @ServiceMethod(returns = ReturnType.SINGLE) @@ -690,7 +690,7 @@ public Response getMultivariateModelWithResponse(String modelId, Req * @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 detection results for the given resultId along with {@link Response}. + * @return detections results for the given resultId along with {@link Response}. */ @Generated @ServiceMethod(returns = ReturnType.SINGLE) @@ -873,7 +873,7 @@ public UnivariateChangePointDetectionResult detectUnivariateChangePoint( * @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 detection results for the given resultId. + * @return detections results for the given resultId. */ @Generated @ServiceMethod(returns = ReturnType.SINGLE) @@ -928,8 +928,9 @@ public AnomalyDetectionModel trainMultivariateModel(ModelInfo modelInfo) { * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return response of listing models as paginated response with {@link PagedIterable}. */ + @Generated @ServiceMethod(returns = ReturnType.COLLECTION) - PagedIterable listMultivariateModels(Integer skip, Integer top) { + public PagedIterable listMultivariateModels(Integer skip, Integer top) { // Generated convenience method for listMultivariateModels return new PagedIterable<>(client.listMultivariateModels(skip, top)); } @@ -1016,7 +1017,7 @@ public AnomalyDetectionModel getMultivariateModel(String modelId) { * @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 detection results for the given resultId. + * @return detections results for the given resultId. */ @Generated @ServiceMethod(returns = ReturnType.SINGLE) diff --git a/sdk/anomalydetector/azure-ai-anomalydetector/src/main/java/com/azure/ai/anomalydetector/implementation/AnomalyDetectorClientImpl.java b/sdk/anomalydetector/azure-ai-anomalydetector/src/main/java/com/azure/ai/anomalydetector/implementation/AnomalyDetectorClientImpl.java index c691ab0a7989..7bf148c1c606 100644 --- a/sdk/anomalydetector/azure-ai-anomalydetector/src/main/java/com/azure/ai/anomalydetector/implementation/AnomalyDetectorClientImpl.java +++ b/sdk/anomalydetector/azure-ai-anomalydetector/src/main/java/com/azure/ai/anomalydetector/implementation/AnomalyDetectorClientImpl.java @@ -834,7 +834,7 @@ public Response detectUnivariateChangePointWithResponse( * @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 detection results for the given resultId along with {@link Response} on successful completion of {@link + * @return detections results for the given resultId along with {@link Response} on successful completion of {@link * Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) @@ -920,7 +920,7 @@ public Mono> getMultivariateBatchDetectionResultWithRespons * @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 detection results for the given resultId along with {@link Response}. + * @return detections results for the given resultId along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) public Response getMultivariateBatchDetectionResultWithResponse( @@ -1753,7 +1753,7 @@ public Response getMultivariateModelWithResponse(String modelId, Req * @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 detection results for the given resultId along with {@link Response} on successful completion of {@link + * @return detections results for the given resultId along with {@link Response} on successful completion of {@link * Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) @@ -1855,7 +1855,7 @@ public Mono> detectMultivariateBatchAnomalyWithResponseAsyn * @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 detection results for the given resultId along with {@link Response}. + * @return detections results for the given resultId along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) public Response detectMultivariateBatchAnomalyWithResponse( diff --git a/sdk/anomalydetector/azure-ai-anomalydetector/src/main/java/com/azure/ai/anomalydetector/models/AlignMode.java b/sdk/anomalydetector/azure-ai-anomalydetector/src/main/java/com/azure/ai/anomalydetector/models/AlignMode.java index 0f3275035816..051002ad0526 100644 --- a/sdk/anomalydetector/azure-ai-anomalydetector/src/main/java/com/azure/ai/anomalydetector/models/AlignMode.java +++ b/sdk/anomalydetector/azure-ai-anomalydetector/src/main/java/com/azure/ai/anomalydetector/models/AlignMode.java @@ -4,48 +4,43 @@ package com.azure.ai.anomalydetector.models; +import com.azure.core.util.ExpandableStringEnum; import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Collection; /** Defines values for AlignMode. */ -public enum AlignMode { - /** Enum value Inner. */ - INNER("Inner"), +public final class AlignMode extends ExpandableStringEnum { + /** Static value Inner for AlignMode. */ + public static final AlignMode INNER = fromString("Inner"); - /** Enum value Outer. */ - OUTER("Outer"); + /** Static value Outer for AlignMode. */ + public static final AlignMode OUTER = fromString("Outer"); - /** The actual serialized value for a AlignMode instance. */ - private final String value; - - AlignMode(String value) { - this.value = value; - } + /** + * Creates a new instance of AlignMode value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public AlignMode() {} /** - * Parses a serialized value to a AlignMode instance. + * Creates or finds a AlignMode from its string representation. * - * @param value the serialized value to parse. - * @return the parsed AlignMode object, or null if unable to parse. + * @param name a name to look for. + * @return the corresponding AlignMode. */ @JsonCreator - public static AlignMode fromString(String value) { - if (value == null) { - return null; - } - AlignMode[] items = AlignMode.values(); - for (AlignMode item : items) { - if (item.toString().equalsIgnoreCase(value)) { - return item; - } - } - return null; + public static AlignMode fromString(String name) { + return fromString(name, AlignMode.class); } - /** {@inheritDoc} */ - @JsonValue - @Override - public String toString() { - return this.value; + /** + * Gets known AlignMode values. + * + * @return known AlignMode values. + */ + public static Collection values() { + return values(AlignMode.class); } } diff --git a/sdk/anomalydetector/azure-ai-anomalydetector/src/main/java/com/azure/ai/anomalydetector/models/DataSchema.java b/sdk/anomalydetector/azure-ai-anomalydetector/src/main/java/com/azure/ai/anomalydetector/models/DataSchema.java index e46cc49ba461..d970e88666df 100644 --- a/sdk/anomalydetector/azure-ai-anomalydetector/src/main/java/com/azure/ai/anomalydetector/models/DataSchema.java +++ b/sdk/anomalydetector/azure-ai-anomalydetector/src/main/java/com/azure/ai/anomalydetector/models/DataSchema.java @@ -8,7 +8,7 @@ import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; -/** Defines values for DataSchema. */ +/** Data schema of input data source: OneTable or MultiTable. The default DataSchema is OneTable. */ public final class DataSchema extends ExpandableStringEnum { /** Static value OneTable for DataSchema. */ public static final DataSchema ONE_TABLE = fromString("OneTable"); @@ -16,6 +16,14 @@ public final class DataSchema extends ExpandableStringEnum { /** Static value MultiTable for DataSchema. */ public static final DataSchema MULTI_TABLE = fromString("MultiTable"); + /** + * Creates a new instance of DataSchema value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public DataSchema() {} + /** * Creates or finds a DataSchema from its string representation. * diff --git a/sdk/anomalydetector/azure-ai-anomalydetector/src/main/java/com/azure/ai/anomalydetector/models/FillNAMethod.java b/sdk/anomalydetector/azure-ai-anomalydetector/src/main/java/com/azure/ai/anomalydetector/models/FillNAMethod.java index 2b55dea587e0..136f6221d31d 100644 --- a/sdk/anomalydetector/azure-ai-anomalydetector/src/main/java/com/azure/ai/anomalydetector/models/FillNAMethod.java +++ b/sdk/anomalydetector/azure-ai-anomalydetector/src/main/java/com/azure/ai/anomalydetector/models/FillNAMethod.java @@ -8,7 +8,9 @@ import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; -/** Defines values for FillNAMethod. */ +/** + * An optional field, indicating how missing values will be filled. One of Previous, Subsequent, Linear, Zero, Fixed. + */ public final class FillNAMethod extends ExpandableStringEnum { /** Static value Previous for FillNAMethod. */ public static final FillNAMethod PREVIOUS = fromString("Previous"); @@ -25,6 +27,14 @@ public final class FillNAMethod extends ExpandableStringEnum { /** Static value Fixed for FillNAMethod. */ public static final FillNAMethod FIXED = fromString("Fixed"); + /** + * Creates a new instance of FillNAMethod value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public FillNAMethod() {} + /** * Creates or finds a FillNAMethod from its string representation. * diff --git a/sdk/anomalydetector/azure-ai-anomalydetector/src/main/java/com/azure/ai/anomalydetector/models/ImputeMode.java b/sdk/anomalydetector/azure-ai-anomalydetector/src/main/java/com/azure/ai/anomalydetector/models/ImputeMode.java index e71130dd0df8..f1b4891086cb 100644 --- a/sdk/anomalydetector/azure-ai-anomalydetector/src/main/java/com/azure/ai/anomalydetector/models/ImputeMode.java +++ b/sdk/anomalydetector/azure-ai-anomalydetector/src/main/java/com/azure/ai/anomalydetector/models/ImputeMode.java @@ -28,6 +28,14 @@ public final class ImputeMode extends ExpandableStringEnum { /** Static value notFill for ImputeMode. */ public static final ImputeMode NOT_FILL = fromString("notFill"); + /** + * Creates a new instance of ImputeMode value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ImputeMode() {} + /** * Creates or finds a ImputeMode from its string representation. * diff --git a/sdk/anomalydetector/azure-ai-anomalydetector/src/main/java/com/azure/ai/anomalydetector/models/ModelStatus.java b/sdk/anomalydetector/azure-ai-anomalydetector/src/main/java/com/azure/ai/anomalydetector/models/ModelStatus.java index 2ff7519fd5d9..7a1a5960b0d9 100644 --- a/sdk/anomalydetector/azure-ai-anomalydetector/src/main/java/com/azure/ai/anomalydetector/models/ModelStatus.java +++ b/sdk/anomalydetector/azure-ai-anomalydetector/src/main/java/com/azure/ai/anomalydetector/models/ModelStatus.java @@ -4,54 +4,49 @@ package com.azure.ai.anomalydetector.models; +import com.azure.core.util.ExpandableStringEnum; import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Collection; /** Defines values for ModelStatus. */ -public enum ModelStatus { - /** Enum value CREATED. */ - CREATED("CREATED"), +public final class ModelStatus extends ExpandableStringEnum { + /** Static value CREATED for ModelStatus. */ + public static final ModelStatus CREATED = fromString("CREATED"); - /** Enum value RUNNING. */ - RUNNING("RUNNING"), + /** Static value RUNNING for ModelStatus. */ + public static final ModelStatus RUNNING = fromString("RUNNING"); - /** Enum value READY. */ - READY("READY"), + /** Static value READY for ModelStatus. */ + public static final ModelStatus READY = fromString("READY"); - /** Enum value FAILED. */ - FAILED("FAILED"); + /** Static value FAILED for ModelStatus. */ + public static final ModelStatus FAILED = fromString("FAILED"); - /** The actual serialized value for a ModelStatus instance. */ - private final String value; - - ModelStatus(String value) { - this.value = value; - } + /** + * Creates a new instance of ModelStatus value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ModelStatus() {} /** - * Parses a serialized value to a ModelStatus instance. + * Creates or finds a ModelStatus from its string representation. * - * @param value the serialized value to parse. - * @return the parsed ModelStatus object, or null if unable to parse. + * @param name a name to look for. + * @return the corresponding ModelStatus. */ @JsonCreator - public static ModelStatus fromString(String value) { - if (value == null) { - return null; - } - ModelStatus[] items = ModelStatus.values(); - for (ModelStatus item : items) { - if (item.toString().equalsIgnoreCase(value)) { - return item; - } - } - return null; + public static ModelStatus fromString(String name) { + return fromString(name, ModelStatus.class); } - /** {@inheritDoc} */ - @JsonValue - @Override - public String toString() { - return this.value; + /** + * Gets known ModelStatus values. + * + * @return known ModelStatus values. + */ + public static Collection values() { + return values(ModelStatus.class); } } diff --git a/sdk/anomalydetector/azure-ai-anomalydetector/src/main/java/com/azure/ai/anomalydetector/models/MultivariateBatchDetectionStatus.java b/sdk/anomalydetector/azure-ai-anomalydetector/src/main/java/com/azure/ai/anomalydetector/models/MultivariateBatchDetectionStatus.java index c3f17996f22c..bd51e097ee1d 100644 --- a/sdk/anomalydetector/azure-ai-anomalydetector/src/main/java/com/azure/ai/anomalydetector/models/MultivariateBatchDetectionStatus.java +++ b/sdk/anomalydetector/azure-ai-anomalydetector/src/main/java/com/azure/ai/anomalydetector/models/MultivariateBatchDetectionStatus.java @@ -4,54 +4,49 @@ package com.azure.ai.anomalydetector.models; +import com.azure.core.util.ExpandableStringEnum; import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Collection; /** Defines values for MultivariateBatchDetectionStatus. */ -public enum MultivariateBatchDetectionStatus { - /** Enum value CREATED. */ - CREATED("CREATED"), +public final class MultivariateBatchDetectionStatus extends ExpandableStringEnum { + /** Static value CREATED for MultivariateBatchDetectionStatus. */ + public static final MultivariateBatchDetectionStatus CREATED = fromString("CREATED"); - /** Enum value RUNNING. */ - RUNNING("RUNNING"), + /** Static value RUNNING for MultivariateBatchDetectionStatus. */ + public static final MultivariateBatchDetectionStatus RUNNING = fromString("RUNNING"); - /** Enum value READY. */ - READY("READY"), + /** Static value READY for MultivariateBatchDetectionStatus. */ + public static final MultivariateBatchDetectionStatus READY = fromString("READY"); - /** Enum value FAILED. */ - FAILED("FAILED"); + /** Static value FAILED for MultivariateBatchDetectionStatus. */ + public static final MultivariateBatchDetectionStatus FAILED = fromString("FAILED"); - /** The actual serialized value for a MultivariateBatchDetectionStatus instance. */ - private final String value; - - MultivariateBatchDetectionStatus(String value) { - this.value = value; - } + /** + * Creates a new instance of MultivariateBatchDetectionStatus value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public MultivariateBatchDetectionStatus() {} /** - * Parses a serialized value to a MultivariateBatchDetectionStatus instance. + * Creates or finds a MultivariateBatchDetectionStatus from its string representation. * - * @param value the serialized value to parse. - * @return the parsed MultivariateBatchDetectionStatus object, or null if unable to parse. + * @param name a name to look for. + * @return the corresponding MultivariateBatchDetectionStatus. */ @JsonCreator - public static MultivariateBatchDetectionStatus fromString(String value) { - if (value == null) { - return null; - } - MultivariateBatchDetectionStatus[] items = MultivariateBatchDetectionStatus.values(); - for (MultivariateBatchDetectionStatus item : items) { - if (item.toString().equalsIgnoreCase(value)) { - return item; - } - } - return null; + public static MultivariateBatchDetectionStatus fromString(String name) { + return fromString(name, MultivariateBatchDetectionStatus.class); } - /** {@inheritDoc} */ - @JsonValue - @Override - public String toString() { - return this.value; + /** + * Gets known MultivariateBatchDetectionStatus values. + * + * @return known MultivariateBatchDetectionStatus values. + */ + public static Collection values() { + return values(MultivariateBatchDetectionStatus.class); } } diff --git a/sdk/anomalydetector/azure-ai-anomalydetector/src/main/java/com/azure/ai/anomalydetector/models/MultivariateDetectionResult.java b/sdk/anomalydetector/azure-ai-anomalydetector/src/main/java/com/azure/ai/anomalydetector/models/MultivariateDetectionResult.java index aa2938743296..d5fcc1a6e21c 100644 --- a/sdk/anomalydetector/azure-ai-anomalydetector/src/main/java/com/azure/ai/anomalydetector/models/MultivariateDetectionResult.java +++ b/sdk/anomalydetector/azure-ai-anomalydetector/src/main/java/com/azure/ai/anomalydetector/models/MultivariateDetectionResult.java @@ -9,7 +9,7 @@ import com.fasterxml.jackson.annotation.JsonProperty; import java.util.List; -/** Detection results for the given resultId. */ +/** Detections results for the given resultId. */ @Immutable public final class MultivariateDetectionResult { /* diff --git a/sdk/anomalydetector/azure-ai-anomalydetector/src/main/java/com/azure/ai/anomalydetector/models/TimeGranularity.java b/sdk/anomalydetector/azure-ai-anomalydetector/src/main/java/com/azure/ai/anomalydetector/models/TimeGranularity.java index fea416ba0eca..e817d059182f 100644 --- a/sdk/anomalydetector/azure-ai-anomalydetector/src/main/java/com/azure/ai/anomalydetector/models/TimeGranularity.java +++ b/sdk/anomalydetector/azure-ai-anomalydetector/src/main/java/com/azure/ai/anomalydetector/models/TimeGranularity.java @@ -4,69 +4,64 @@ package com.azure.ai.anomalydetector.models; +import com.azure.core.util.ExpandableStringEnum; import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Collection; /** Defines values for TimeGranularity. */ -public enum TimeGranularity { - /** Enum value yearly. */ - YEARLY("yearly"), +public final class TimeGranularity extends ExpandableStringEnum { + /** Static value yearly for TimeGranularity. */ + public static final TimeGranularity YEARLY = fromString("yearly"); - /** Enum value monthly. */ - MONTHLY("monthly"), + /** Static value monthly for TimeGranularity. */ + public static final TimeGranularity MONTHLY = fromString("monthly"); - /** Enum value weekly. */ - WEEKLY("weekly"), + /** Static value weekly for TimeGranularity. */ + public static final TimeGranularity WEEKLY = fromString("weekly"); - /** Enum value daily. */ - DAILY("daily"), + /** Static value daily for TimeGranularity. */ + public static final TimeGranularity DAILY = fromString("daily"); - /** Enum value hourly. */ - HOURLY("hourly"), + /** Static value hourly for TimeGranularity. */ + public static final TimeGranularity HOURLY = fromString("hourly"); - /** Enum value minutely. */ - PER_MINUTE("minutely"), + /** Static value minutely for TimeGranularity. */ + public static final TimeGranularity PER_MINUTE = fromString("minutely"); - /** Enum value secondly. */ - PER_SECOND("secondly"), + /** Static value secondly for TimeGranularity. */ + public static final TimeGranularity PER_SECOND = fromString("secondly"); - /** Enum value microsecond. */ - MICROSECOND("microsecond"), + /** Static value microsecond for TimeGranularity. */ + public static final TimeGranularity MICROSECOND = fromString("microsecond"); - /** Enum value none. */ - NONE("none"); + /** Static value none for TimeGranularity. */ + public static final TimeGranularity NONE = fromString("none"); - /** The actual serialized value for a TimeGranularity instance. */ - private final String value; - - TimeGranularity(String value) { - this.value = value; - } + /** + * Creates a new instance of TimeGranularity value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public TimeGranularity() {} /** - * Parses a serialized value to a TimeGranularity instance. + * Creates or finds a TimeGranularity from its string representation. * - * @param value the serialized value to parse. - * @return the parsed TimeGranularity object, or null if unable to parse. + * @param name a name to look for. + * @return the corresponding TimeGranularity. */ @JsonCreator - public static TimeGranularity fromString(String value) { - if (value == null) { - return null; - } - TimeGranularity[] items = TimeGranularity.values(); - for (TimeGranularity item : items) { - if (item.toString().equalsIgnoreCase(value)) { - return item; - } - } - return null; + public static TimeGranularity fromString(String name) { + return fromString(name, TimeGranularity.class); } - /** {@inheritDoc} */ - @JsonValue - @Override - public String toString() { - return this.value; + /** + * Gets known TimeGranularity values. + * + * @return known TimeGranularity values. + */ + public static Collection values() { + return values(TimeGranularity.class); } }