-
Notifications
You must be signed in to change notification settings - Fork 2.2k
[Draft]Labeled Training Data Support #48015
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
Show all changes
153 commits
Select commit
Hold shift + click to select a range
be4d761
Configurations: 'specification/ai/ContentUnderstanding/tspconfig.yam…
azure-sdk 876170a
Merge remote-tracking branch 'origin/main' into sdkauto/azure-ai-cont…
yungshinlintw c8df6ad
SDK-GEN: Re-generate SDK based on commmit e11e268a65224bd90f3aa450d44…
yungshinlintw 72993cc
Add sample tests for configuring defaults and analyzing binary docume…
e34b5f8
[ContentUnderstanding] Add Java samples (Sample00-Sample04) converted…
a9bd363
[ContentUnderstanding] Add Sample05 and Sample06
2d284fb
[ContentUnderstanding] Add Sample07 and Sample08
d180a18
[ContentUnderstanding] Fix Sample08 update conflict issue
3495c1f
[ContentUnderstanding] Add Sample09_DeleteAnalyzer
5be60e5
[ContentUnderstanding] Fix Sample09 and remove incompatible Sample10-16
fc4a36b
Add Sample10_AnalyzeConfigs and Sample11_AnalyzeReturnRawJson
a101b28
Add Sample12_GetResultFile and Sample13_DeleteResult
cbdc2ad
Add Sample14_CopyAnalyzer, Sample15_GrantCopyAuth, and Sample16_Creat…
92711c7
Refactor Content Understanding Samples to Use Updated Environment Var…
984b4df
Update Content Understanding Samples to Use DefaultAzureCredential fo…
24a9ff7
Update analyzer copy endpoint to use simplified path and expand expec…
5fefcc3
Enhance verification steps in Sample14_CopyAnalyzer to ensure accurat…
651ce86
Refactor Content Understanding Samples to Support API Key and Default…
aad4f2e
Refactor Content Understanding Samples to Use Single Line for Client …
9dd7d8a
Add samples for content understanding SDK
fedf711
Update assets.json to include specific tag for content understanding SDK
dd8ebf3
Update sample file paths and add new sample documents for content und…
8467d24
Disable JaCoCo coverage and Checkstyle for beta.1 - tests under devel…
420cb89
Fix JaCoCo coverage values: use 0 instead of 0.00
e2af7aa
Add UPCA and UPCE barcode terms to spelling dictionary
451a119
Enable Record/Playback test mode for Sample tests
bea9203
Fix surefire include pattern to only match generated/Sample*.java
61fc2a3
Fix double-slash issue in test recordings for Content Understanding
7b55d95
Fix double-slash issue in test recordings: update assets.json to new …
760866c
Strip trailing slash from endpoint to prevent double-slash in URLs
12b2364
Merge branch 'main' of https://github.com/azure-sdk/azure-sdk-for-jav…
1c490eb
Customize Content Understanding Java SDK to match .NET SDK patterns
022040a
Update tests/samples to use convenience methods (getValue, getFieldOr…
2279e7f
Fix Sample03 InvoiceDate type casting - DateField returns LocalDate n…
1433066
Fix CopyAnalyzer API issues and add test recordings
9cf932e
Update README.md with comprehensive documentation
3e586c8
Add cspell.json with custom words for spell checking
316b6e9
Add azure-ai-contentunderstanding to version_client.txt
45f30f2
Add customization to fix copyAnalyzer API path
f9369bc
Remove incompatible generated samples and tests
7155b72
Stop hiding beginAnalyze methods to fix sample compilation
1ce5028
Use ClientLogger for exception throwing to fix checkstyle linting errors
50b979b
TEST: Add test resource creation files and also tests.yml for CI
yungshinlintw 1512c2e
Address PR review feedback for azure-ai-contentunderstanding SDK
changjian-wang c10fdf5
Merge branch 'sdkauto/azure-ai-contentunderstanding-5634426' of https…
a171886
Add sample test for updating default configuration in Content Underst…
changjian-wang c26e48d
Update assets.json to match renamed Sample00_UpdateDefaults test
fd183d3
README: Fix incorrect reference
yungshinlintw 99305b6
Address PR review comments: use environment variables for model deplo…
a313f62
Update README.md with model deployment environment variables
355133d
Fix CI linting errors: update convenience methods to return typed obj…
31790c3
Update test recordings for Sample00, Sample08, Sample14
9071184
Update Sample12 to use getResultFile convenience method instead of ge…
fc3c0c5
Update Sample15 to use grantCopyAuthorization convenience method inst…
3327a1a
Fix Step 3 comment to show correct beginCopyAnalyzer convenience meth…
a5b42b9
Address PR review comments and standardize environment variables
cbe3663
README: Update sample running instructions
yungshinlintw 742d729
README: Update sample running instruction
yungshinlintw 39e9e16
Refactor sample code to use environment variables for endpoint config…
yungshinlintw 420e707
CI: Update pom.xml version
yungshinlintw 13edc5e
SAMPLE: Update invoice sample
yungshinlintw 7471695
CI: Fix cspell issue
yungshinlintw 917ac66
README: Update sample instruction
yungshinlintw 914bc3c
SAMPLE: Simplify CreateAnalyzer sample
yungshinlintw 03eaccc
SAMPLE: Refactor analyzer creation in samples for improved readabilit…
yungshinlintw 9d328fd
CI: UPdatecseppl.json for compiler instructions in README
yungshinlintw d5dafec
SAMPLE: Clean up messages
yungshinlintw 83b1f65
SAMPLE/TEST: Generated unused generated tests
yungshinlintw b9f5c4a
SDK-GEN: Update with latest commit for TypeSpec to address copyAnalyz…
yungshinlintw c3c2dc7
TEST: Upload recording
yungshinlintw 3e35e3b
SAMPLE: Update environment variable names in GrantCopyAuth sample for…
yungshinlintw 0f2d991
SDK-CUSTOMIZATION: Introduce simplified beginAnalyze methods in Conte…
yungshinlintw 432099a
TEST: Update recording in assets.json to reflect new tag version for …
yungshinlintw dd5891a
Refactor content understanding samples and tests for classifier creat…
c7b2771
Merge branch 'sdkauto/azure-ai-contentunderstanding-5634426' of https…
ff01c09
Refactor assertions in sample tests to use static imports for improve…
d6e4a08
Add async samples for deleting analysis results, copying analyzers, g…
1887270
Refactor sample tests to remove async suffix from method names and up…
wangchangjian1130 2be9c6c
Update classifier creation samples to include 'true' for enableSegmen…
wangchangjian1130 6d69aa2
Add retry mechanism for getResultFile in Sample12 tests and samples
wangchangjian1130 e8e24dc
Update asset tag in assets.json to reflect latest version
wangchangjian1130 d8f204f
Update assets.json tag and modify training data SAS URL handling in a…
wangchangjian1130 f459825
AGENT: Add agents for compiling CU SDK in place , run samples, and ru…
yungshinlintw d3bae81
SAMPLE: Update async sample to use reactive pattern. Add a create-cu-…
yungshinlintw b9385b6
SAMPLE: Fix CI issue
yungshinlintw 7f006a6
SAMPLE: Fix CI issue in skill md file
yungshinlintw 4e96ff4
Refactor samples to use reactive pattern for polling results
7c331a6
Update assets.json with new session recordings tag
aef157d
Update assets.json with Sample16 labeled training data recordings
cf0f7e2
Add SDK skills for recording and playback testing
eb41383
Add SDK skills for recording and playback testing
4e2285f
Refactor README and SKILL.md files to streamline content and remove o…
7d9e2a0
SAMPLE: Update Sample 02 to run video/audio/image too
yungshinlintw 0cf7bf3
SKILL: Add sample quality review skill
yungshinlintw 6b4d455
CI: Fix CI issues
yungshinlintw 6879383
CUSTOMIZATION: Update TypeSpec commit id and generate beginAnalyze[B…
yungshinlintw b2e11c0
Merge branch 'main' into sdkauto/azure-ai-contentunderstanding-5634426
yungshinlintw d6968ee
Add assertions and BEGIN/END markers to Sample00_UpdateDefaults tests
7a4ed28
Merge branch 'sdkauto/azure-ai-contentunderstanding-5634426' of https…
5a361b1
Update test recordings for Sample tests
f29e243
Update README.md to include full URLs for skills documentation
wangchangjian1130 a2ab500
CI: Fix cusotmization code that throw exception directly, instead of …
yungshinlintw 8eac9ef
CI: Fix javadoc issue
yungshinlintw ceb3470
Merge branch 'main' into sdkauto/azure-ai-contentunderstanding-5634426
yungshinlintw 08123ac
Update assets.json with new tag version and enhance error handling in…
yungshinlintw 31e5dc1
Merge branch 'sdkauto/azure-ai-contentunderstanding-5634426' of https…
yungshinlintw 9869a93
Updapte sample 16 and its tests. Push recording with updated tests
yungshinlintw 6deb8be
CI: Remove customization not required
yungshinlintw c125bcb
AGENT SKILL: Remove skills for better refacotring later
yungshinlintw 9965b0b
CUSTOMIZATION: Updates comments
yungshinlintw 7ea8d6c
POM: Update package name and description
yungshinlintw 744766d
Merge branch 'main' into sdkauto/azure-ai-contentunderstanding-5634426
chienyuanchang 9ba4a9e
CUSTOMIZATION: Improve ContentField access methods and update conveni…
yungshinlintw 95a5b8b
CUSTOMIZATION: Make the hidding of analyze/analyzeBinary to be robust
yungshinlintw df30ffa
Merge branch 'sdkauto/azure-ai-contentunderstanding-5634426' of https…
yungshinlintw a1a9973
README: Update pom.xml to remove test scope for azure-identity depend…
yungshinlintw f8666be
Merge branch 'main' into sdkauto/azure-ai-contentunderstanding-5634426
yungshinlintw db126ac
Merge branch 'main' into sdkauto/azure-ai-contentunderstanding-5634426
yungshinlintw a472f8c
TEST: Refactor sample file paths in tests to new directory structure …
yungshinlintw 4be21d4
Merge branch 'sdkauto/azure-ai-contentunderstanding-5634426' of https…
yungshinlintw dba5fe3
[ContentUnderstanding] Update SDK to latest TypeSpec commit
0055783
[ContentUnderstanding] Update SDK to latest TypeSpec commit (ff47dc5)
1000cee
Fix README formatting: add missing blank line before section heading
5bd2fc1
Merge remote-tracking branch 'origin/main' into cu_sdk/ga
bcb0aca
Regenerate SDK with emitter 0.39.1 after merging main
8578386
Fix polling context key mismatches and metadata issues in azure-ai-co…
Copilot 38a95e6
Merge branch 'main' into cu_sdk/ga
changjian-wang 3c31037
Merge branch 'main' into cu_sdk/ga
changjian-wang b0050eb
Fix polling strategy key consistency, error formatting, and async sam…
Copilot 950c643
Fix customization to produce correct polling strategy code
a33390e
Update sdk/contentunderstanding/azure-ai-contentunderstanding/pom.xml
changjian-wang 656d581
Update sdk/contentunderstanding/azure-ai-contentunderstanding/src/mai…
changjian-wang f14a45a
Update sdk/contentunderstanding/azure-ai-contentunderstanding/src/mai…
changjian-wang 6e6ba02
Fix typos in DocumentParagraph and initialize kind in KnowledgeSource
wangchangjian1130 a627f43
Refactor sample applications to use CountDownLatch for async operatio…
wangchangjian1130 656b892
Update sdk/contentunderstanding/azure-ai-contentunderstanding/src/sam…
yungshinlintw 73cf1eb
Update sdk/contentunderstanding/azure-ai-contentunderstanding/src/sam…
yungshinlintw fbab37e
Update version to 1.0.0 and finalize release notes for Azure Content …
3413eb8
Remove System.exit(1) from async samples (#47966)
Copilot e10f302
Update CODEOWNERS to add additional owners for Content Understanding …
be2f3b6
Remove no-op fixGeneratedAnalyzeBodiesToCallImplWithUtf16 customization
c381b36
Remove fixGeneratedPollingStrategyCode method and related calls
wangchangjian1130 52f3fb1
Fix generated polling strategy code for case sensitivity and error me…
wangchangjian1130 abc9e93
Add receipt2 image and associated label and result files; update anal…
afef6f7
Update asset tags and improve sample documentation for training data …
73cac91
Merge branches 'cu_sdk/ga-sample16-labels' and 'main' of https://gith…
add9142
Merge remote-tracking branch 'origin/main' into cu_sdk/ga-sample16-la…
dffc437
Refactor content understanding sample tests to use AnalysisResult and…
0f712de
Add sample for creating an analyzer with labels asynchronously
9b4aa45
Merge branch 'main' into cu_sdk/ga-sample16-labels
changjian-wang 80ce167
Merge branch 'main' into cu_sdk/ga-sample16-labels
changjian-wang 6fc914a
Merge branch 'main' into cu_sdk/ga-sample16-labels
changjian-wang 44af11b
Merge branch 'main' into cu_sdk/ga-sample16-labels
changjian-wang File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
...e/ai/contentunderstanding/implementation/ContentAnalyzerAnalyzeOperationStatusHelper.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| // Copyright (c) Microsoft Corporation. All rights reserved. | ||
| // Licensed under the MIT License. | ||
| package com.azure.ai.contentunderstanding.implementation; | ||
|
|
||
| import com.azure.ai.contentunderstanding.models.ContentAnalyzerAnalyzeOperationStatus; | ||
|
|
||
| /** | ||
| * Helper class to access private members of ContentAnalyzerAnalyzeOperationStatus. | ||
| */ | ||
| public final class ContentAnalyzerAnalyzeOperationStatusHelper { | ||
| private static ContentAnalyzerAnalyzeOperationStatusAccessor accessor; | ||
|
|
||
| /** | ||
| * Interface for accessing private members. | ||
| */ | ||
| public interface ContentAnalyzerAnalyzeOperationStatusAccessor { | ||
| void setOperationId(ContentAnalyzerAnalyzeOperationStatus status, String operationId); | ||
| } | ||
|
|
||
| /** | ||
| * Sets the accessor. | ||
| * | ||
| * @param accessorInstance the accessor instance. | ||
| */ | ||
| public static void setAccessor(ContentAnalyzerAnalyzeOperationStatusAccessor accessorInstance) { | ||
| accessor = accessorInstance; | ||
| } | ||
|
|
||
| /** | ||
| * Sets the operationId on a ContentAnalyzerAnalyzeOperationStatus instance. | ||
| * | ||
| * @param status the status instance. | ||
| * @param operationId the operationId to set. | ||
| */ | ||
| public static void setOperationId(ContentAnalyzerAnalyzeOperationStatus status, String operationId) { | ||
| accessor.setOperationId(status, operationId); | ||
| } | ||
|
|
||
| private ContentAnalyzerAnalyzeOperationStatusHelper() { | ||
| } | ||
| } | ||
136 changes: 136 additions & 0 deletions
136
...ntentunderstanding/src/main/java/com/azure/ai/contentunderstanding/models/ArrayField.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,136 @@ | ||
| // Copyright (c) Microsoft Corporation. All rights reserved. | ||
| // Licensed under the MIT License. | ||
| // Code generated by Microsoft (R) TypeSpec Code Generator. | ||
| package com.azure.ai.contentunderstanding.models; | ||
|
|
||
| import com.azure.core.annotation.Generated; | ||
| import com.azure.core.annotation.Immutable; | ||
| import com.azure.core.util.logging.ClientLogger; | ||
| import com.azure.json.JsonReader; | ||
| import com.azure.json.JsonToken; | ||
| import com.azure.json.JsonWriter; | ||
| import java.io.IOException; | ||
| import java.util.List; | ||
|
|
||
| /** | ||
| * Array field extracted from the content. | ||
| */ | ||
| @Immutable | ||
| public final class ArrayField extends ContentField { | ||
|
|
||
| /* | ||
| * Semantic data type of the field value. | ||
| */ | ||
| @Generated | ||
| private ContentFieldType type = ContentFieldType.ARRAY; | ||
|
|
||
| /* | ||
| * Array field value. | ||
| */ | ||
| @Generated | ||
| private List<ContentField> valueArray; | ||
|
|
||
| /** | ||
| * Creates an instance of ArrayField class. | ||
| */ | ||
| @Generated | ||
| private ArrayField() { | ||
| } | ||
|
|
||
| /** | ||
| * Get the type property: Semantic data type of the field value. | ||
| * | ||
| * @return the type value. | ||
| */ | ||
| @Generated | ||
| @Override | ||
| public ContentFieldType getType() { | ||
| return this.type; | ||
| } | ||
|
|
||
| /** | ||
| * Get the valueArray property: Array field value. | ||
| * | ||
| * @return the valueArray value. | ||
| */ | ||
| @Generated | ||
| public List<ContentField> getValueArray() { | ||
| return this.valueArray; | ||
| } | ||
|
|
||
| /** | ||
| * {@inheritDoc} | ||
| */ | ||
| @Generated | ||
| @Override | ||
| public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { | ||
| jsonWriter.writeStartObject(); | ||
| jsonWriter.writeArrayField("spans", getSpans(), (writer, element) -> writer.writeJson(element)); | ||
| jsonWriter.writeNumberField("confidence", getConfidence()); | ||
| jsonWriter.writeStringField("source", getSource()); | ||
| jsonWriter.writeStringField("type", this.type == null ? null : this.type.toString()); | ||
| jsonWriter.writeArrayField("valueArray", this.valueArray, (writer, element) -> writer.writeJson(element)); | ||
| return jsonWriter.writeEndObject(); | ||
| } | ||
|
|
||
| /** | ||
| * Reads an instance of ArrayField from the JsonReader. | ||
| * | ||
| * @param jsonReader The JsonReader being read. | ||
| * @return An instance of ArrayField if the JsonReader was pointing to an instance of it, or null if it was pointing | ||
| * to JSON null. | ||
| * @throws IOException If an error occurs while reading the ArrayField. | ||
| */ | ||
| @Generated | ||
| public static ArrayField fromJson(JsonReader jsonReader) throws IOException { | ||
| return jsonReader.readObject(reader -> { | ||
| ArrayField deserializedArrayField = new ArrayField(); | ||
| while (reader.nextToken() != JsonToken.END_OBJECT) { | ||
| String fieldName = reader.getFieldName(); | ||
| reader.nextToken(); | ||
| if ("spans".equals(fieldName)) { | ||
| List<ContentSpan> spans = reader.readArray(reader1 -> ContentSpan.fromJson(reader1)); | ||
| deserializedArrayField.setSpans(spans); | ||
| } else if ("confidence".equals(fieldName)) { | ||
| deserializedArrayField.setConfidence(reader.getNullable(JsonReader::getDouble)); | ||
| } else if ("source".equals(fieldName)) { | ||
| deserializedArrayField.setSource(reader.getString()); | ||
| } else if ("type".equals(fieldName)) { | ||
| deserializedArrayField.type = ContentFieldType.fromString(reader.getString()); | ||
| } else if ("valueArray".equals(fieldName)) { | ||
| List<ContentField> valueArray = reader.readArray(reader1 -> ContentField.fromJson(reader1)); | ||
| deserializedArrayField.valueArray = valueArray; | ||
| } else { | ||
| reader.skipChildren(); | ||
| } | ||
| } | ||
| return deserializedArrayField; | ||
| }); | ||
| } | ||
|
|
||
| private static final ClientLogger LOGGER = new ClientLogger(ArrayField.class); | ||
|
|
||
| /** | ||
| * Gets the number of items in the array. | ||
| * | ||
| * @return the number of items in the array, or 0 if the array is null. | ||
| */ | ||
| public int size() { | ||
| return getValueArray() != null ? getValueArray().size() : 0; | ||
| } | ||
|
|
||
| /** | ||
| * Gets a field from the array by index. | ||
| * | ||
| * @param index The zero-based index of the field to retrieve. | ||
| * @return The field at the specified index. | ||
| * @throws IndexOutOfBoundsException if the index is out of range. | ||
| */ | ||
| public ContentField get(int index) { | ||
| if (getValueArray() == null || index < 0 || index >= getValueArray().size()) { | ||
| throw LOGGER.logThrowableAsError(new IndexOutOfBoundsException( | ||
| "Index " + index + " is out of range. Array has " + size() + " elements.")); | ||
| } | ||
| return getValueArray().get(index); | ||
| } | ||
| } |
110 changes: 110 additions & 0 deletions
110
...entunderstanding/src/main/java/com/azure/ai/contentunderstanding/models/BooleanField.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,110 @@ | ||
| // Copyright (c) Microsoft Corporation. All rights reserved. | ||
| // Licensed under the MIT License. | ||
| // Code generated by Microsoft (R) TypeSpec Code Generator. | ||
|
|
||
| package com.azure.ai.contentunderstanding.models; | ||
|
|
||
| import com.azure.core.annotation.Generated; | ||
| import com.azure.core.annotation.Immutable; | ||
| import com.azure.json.JsonReader; | ||
| import com.azure.json.JsonToken; | ||
| import com.azure.json.JsonWriter; | ||
| import java.io.IOException; | ||
| import java.util.List; | ||
|
|
||
| /** | ||
| * Boolean field extracted from the content. | ||
| */ | ||
| @Immutable | ||
| public final class BooleanField extends ContentField { | ||
| /* | ||
| * Semantic data type of the field value. | ||
| */ | ||
| @Generated | ||
| private ContentFieldType type = ContentFieldType.BOOLEAN; | ||
|
|
||
| /* | ||
| * Boolean field value. | ||
| */ | ||
| @Generated | ||
| private Boolean valueBoolean; | ||
|
|
||
| /** | ||
| * Creates an instance of BooleanField class. | ||
| */ | ||
| @Generated | ||
| private BooleanField() { | ||
| } | ||
|
|
||
| /** | ||
| * Get the type property: Semantic data type of the field value. | ||
| * | ||
| * @return the type value. | ||
| */ | ||
| @Generated | ||
| @Override | ||
| public ContentFieldType getType() { | ||
| return this.type; | ||
| } | ||
|
|
||
| /** | ||
| * Get the valueBoolean property: Boolean field value. | ||
| * | ||
| * @return the valueBoolean value. | ||
| */ | ||
| @Generated | ||
| public Boolean isValueBoolean() { | ||
| return this.valueBoolean; | ||
| } | ||
|
|
||
| /** | ||
| * {@inheritDoc} | ||
| */ | ||
| @Generated | ||
| @Override | ||
| public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { | ||
| jsonWriter.writeStartObject(); | ||
| jsonWriter.writeArrayField("spans", getSpans(), (writer, element) -> writer.writeJson(element)); | ||
| jsonWriter.writeNumberField("confidence", getConfidence()); | ||
| jsonWriter.writeStringField("source", getSource()); | ||
| jsonWriter.writeStringField("type", this.type == null ? null : this.type.toString()); | ||
| jsonWriter.writeBooleanField("valueBoolean", this.valueBoolean); | ||
| return jsonWriter.writeEndObject(); | ||
| } | ||
|
|
||
| /** | ||
| * Reads an instance of BooleanField from the JsonReader. | ||
| * | ||
| * @param jsonReader The JsonReader being read. | ||
| * @return An instance of BooleanField if the JsonReader was pointing to an instance of it, or null if it was | ||
| * pointing to JSON null. | ||
| * @throws IOException If an error occurs while reading the BooleanField. | ||
| */ | ||
| @Generated | ||
| public static BooleanField fromJson(JsonReader jsonReader) throws IOException { | ||
| return jsonReader.readObject(reader -> { | ||
| BooleanField deserializedBooleanField = new BooleanField(); | ||
| while (reader.nextToken() != JsonToken.END_OBJECT) { | ||
| String fieldName = reader.getFieldName(); | ||
| reader.nextToken(); | ||
|
|
||
| if ("spans".equals(fieldName)) { | ||
| List<ContentSpan> spans = reader.readArray(reader1 -> ContentSpan.fromJson(reader1)); | ||
| deserializedBooleanField.setSpans(spans); | ||
| } else if ("confidence".equals(fieldName)) { | ||
| deserializedBooleanField.setConfidence(reader.getNullable(JsonReader::getDouble)); | ||
| } else if ("source".equals(fieldName)) { | ||
| deserializedBooleanField.setSource(reader.getString()); | ||
| } else if ("type".equals(fieldName)) { | ||
| deserializedBooleanField.type = ContentFieldType.fromString(reader.getString()); | ||
| } else if ("valueBoolean".equals(fieldName)) { | ||
| deserializedBooleanField.valueBoolean = reader.getNullable(JsonReader::getBoolean); | ||
| } else { | ||
| reader.skipChildren(); | ||
| } | ||
| } | ||
|
|
||
| return deserializedBooleanField; | ||
| }); | ||
| } | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
setOperationIdwill throw a NullPointerException ifsetAccessor(...)was never called (or is called later), sinceaccessoris not validated.Add a guard that throws a clear
IllegalStateExceptionwhen the accessor is not initialized, or initialize the accessor fromContentAnalyzerAnalyzeOperationStatusstatic initialization to ensure it is always set before use.