From 17c1df46c95e920eb177b0c91cbcdfce536b0c66 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ianar=C3=A9=20S=C3=A9vi?= Date: Thu, 9 Apr 2026 17:20:27 +0200 Subject: [PATCH] :recycle: use to simplify imports --- docs/code_samples/bank_account_details_v2.txt | 4 +- docs/code_samples/barcode_reader_v1.txt | 4 +- docs/code_samples/carte_grise_v1.txt | 4 +- docs/code_samples/cropper_v1.txt | 4 +- docs/code_samples/default.txt | 4 +- docs/code_samples/default_async.txt | 4 +- docs/code_samples/driver_license_v1_async.txt | 4 +- docs/code_samples/expense_receipts_v5.txt | 4 +- .../expense_receipts_v5_async.txt | 4 +- docs/code_samples/financial_document_v1.txt | 4 +- .../financial_document_v1_async.txt | 4 +- docs/code_samples/idcard_fr_v1.txt | 4 +- docs/code_samples/idcard_fr_v2.txt | 4 +- docs/code_samples/ind_passport_v1_async.txt | 4 +- .../international_id_v2_async.txt | 4 +- .../invoice_splitter_v1_async.txt | 4 +- docs/code_samples/invoices_v4.txt | 4 +- docs/code_samples/invoices_v4_async.txt | 4 +- .../multi_receipts_detector_v1.txt | 4 +- docs/code_samples/passport_v1.txt | 4 +- docs/code_samples/v2_classification.txt | 12 ++-- docs/code_samples/v2_crop.txt | 9 ++- docs/code_samples/v2_extraction.txt | 9 ++- docs/code_samples/v2_ocr.txt | 9 ++- docs/code_samples/v2_split.txt | 9 ++- docs/code_samples/workflow_execution.txt | 4 +- .../AutoInvoiceSplitterExtractionExample.java | 4 +- .../AutoMultiReceiptExtractionExample.java | 4 +- .../com/mindee/image/ImageCompressor.java | 6 +- .../java/com/mindee/image/ImageExtractor.java | 5 +- .../com/mindee/v1/CommandLineInterface.java | 10 +-- .../java/com/mindee/v2/http/MindeeApiV2.java | 4 +- .../com/mindee/v2/http/MindeeHttpApiV2.java | 61 +++++++++---------- .../com/mindee/v2/parsing/BaseInference.java | 4 +- .../inference/DataSchemaActiveOptions.java | 2 +- .../inference/InferenceActiveOptions.java | 2 +- .../v2/parsing/inference/InferenceFile.java | 2 +- .../v2/parsing/inference/InferenceJob.java | 2 +- .../v2/parsing/inference/InferenceModel.java | 2 +- .../mindee/v2/parsing/inference/RawText.java | 2 +- .../inference/field/InferenceFields.java | 2 +- .../v2/parsing/inference/field/ListField.java | 2 +- .../classification/ClassificationResult.java | 2 +- .../mindee/v2/product/crop/CropResult.java | 2 +- .../extraction/ExtractionInference.java | 2 +- .../product/extraction/ExtractionResult.java | 2 +- .../com/mindee/v2/product/ocr/OcrResult.java | 2 +- .../mindee/v2/product/split/SplitResult.java | 2 +- .../com/mindee/v1/workflow/WorkflowTest.java | 4 +- .../java/com/mindee/v2/MindeeClientTest.java | 4 +- 50 files changed, 127 insertions(+), 139 deletions(-) diff --git a/docs/code_samples/bank_account_details_v2.txt b/docs/code_samples/bank_account_details_v2.txt index 6e0682333..175bb9054 100644 --- a/docs/code_samples/bank_account_details_v2.txt +++ b/docs/code_samples/bank_account_details_v2.txt @@ -12,10 +12,10 @@ public class SimpleMindeeClientV1 { String filePath = "/path/to/the/file.ext"; // Init a new client - MindeeClient mindeeClient = new MindeeClient(apiKey); + var mindeeClient = new MindeeClient(apiKey); // Load a file from disk - LocalInputSource inputSource = new LocalInputSource(filePath); + var inputSource = new LocalInputSource(filePath); // Parse the file PredictResponse response = mindeeClient.parse( diff --git a/docs/code_samples/barcode_reader_v1.txt b/docs/code_samples/barcode_reader_v1.txt index b44cbacfa..676358a66 100644 --- a/docs/code_samples/barcode_reader_v1.txt +++ b/docs/code_samples/barcode_reader_v1.txt @@ -12,10 +12,10 @@ public class SimpleMindeeClientV1 { String filePath = "/path/to/the/file.ext"; // Init a new client - MindeeClient mindeeClient = new MindeeClient(apiKey); + var mindeeClient = new MindeeClient(apiKey); // Load a file from disk - LocalInputSource inputSource = new LocalInputSource(filePath); + var inputSource = new LocalInputSource(filePath); // Parse the file PredictResponse response = mindeeClient.parse( diff --git a/docs/code_samples/carte_grise_v1.txt b/docs/code_samples/carte_grise_v1.txt index fabb8ae1d..b619f3d63 100644 --- a/docs/code_samples/carte_grise_v1.txt +++ b/docs/code_samples/carte_grise_v1.txt @@ -12,10 +12,10 @@ public class SimpleMindeeClientV1 { String filePath = "/path/to/the/file.ext"; // Init a new client - MindeeClient mindeeClient = new MindeeClient(apiKey); + var mindeeClient = new MindeeClient(apiKey); // Load a file from disk - LocalInputSource inputSource = new LocalInputSource(filePath); + var inputSource = new LocalInputSource(filePath); // Parse the file PredictResponse response = mindeeClient.parse( diff --git a/docs/code_samples/cropper_v1.txt b/docs/code_samples/cropper_v1.txt index 906d1af16..6d2f40d5a 100644 --- a/docs/code_samples/cropper_v1.txt +++ b/docs/code_samples/cropper_v1.txt @@ -12,10 +12,10 @@ public class SimpleMindeeClientV1 { String filePath = "/path/to/the/file.ext"; // Init a new client - MindeeClient mindeeClient = new MindeeClient(apiKey); + var mindeeClient = new MindeeClient(apiKey); // Load a file from disk - LocalInputSource inputSource = new LocalInputSource(filePath); + var inputSource = new LocalInputSource(filePath); // Parse the file PredictResponse response = mindeeClient.parse( diff --git a/docs/code_samples/default.txt b/docs/code_samples/default.txt index 5ff7a6452..f40009473 100644 --- a/docs/code_samples/default.txt +++ b/docs/code_samples/default.txt @@ -13,10 +13,10 @@ public class SimpleMindeeClientV1 { String filePath = "/path/to/the/file.ext"; // Init a new client - MindeeClient mindeeClient = new MindeeClient(apiKey); + var mindeeClient = new MindeeClient(apiKey); // Load a file from disk - LocalInputSource inputSource = new LocalInputSource(new File(filePath)); + var inputSource = new LocalInputSource(new File(filePath)); // Configure the endpoint Endpoint endpoint = new Endpoint( diff --git a/docs/code_samples/default_async.txt b/docs/code_samples/default_async.txt index 735c0e02d..c7c55aed4 100644 --- a/docs/code_samples/default_async.txt +++ b/docs/code_samples/default_async.txt @@ -13,10 +13,10 @@ public class SimpleMindeeClientV1 { String filePath = "/path/to/the/file.ext"; // Init a new client - MindeeClient mindeeClient = new MindeeClient(apiKey); + var mindeeClient = new MindeeClient(apiKey); // Load a file from disk - LocalInputSource inputSource = new LocalInputSource(new File(filePath)); + var inputSource = new LocalInputSource(new File(filePath)); // Configure the endpoint Endpoint endpoint = new Endpoint( diff --git a/docs/code_samples/driver_license_v1_async.txt b/docs/code_samples/driver_license_v1_async.txt index ff8114bb3..5c3e32679 100644 --- a/docs/code_samples/driver_license_v1_async.txt +++ b/docs/code_samples/driver_license_v1_async.txt @@ -12,10 +12,10 @@ public class SimpleMindeeClientV1 { String filePath = "/path/to/the/file.ext"; // Init a new client - MindeeClient mindeeClient = new MindeeClient(apiKey); + var mindeeClient = new MindeeClient(apiKey); // Load a file from disk - LocalInputSource inputSource = new LocalInputSource(new File(filePath)); + var inputSource = new LocalInputSource(new File(filePath)); // Parse the file asynchronously AsyncPredictResponse response = mindeeClient.enqueueAndParse( diff --git a/docs/code_samples/expense_receipts_v5.txt b/docs/code_samples/expense_receipts_v5.txt index 21a66f4f7..683f29dee 100644 --- a/docs/code_samples/expense_receipts_v5.txt +++ b/docs/code_samples/expense_receipts_v5.txt @@ -12,10 +12,10 @@ public class SimpleMindeeClientV1 { String filePath = "/path/to/the/file.ext"; // Init a new client - MindeeClient mindeeClient = new MindeeClient(apiKey); + var mindeeClient = new MindeeClient(apiKey); // Load a file from disk - LocalInputSource inputSource = new LocalInputSource(filePath); + var inputSource = new LocalInputSource(filePath); // Parse the file PredictResponse response = mindeeClient.parse( diff --git a/docs/code_samples/expense_receipts_v5_async.txt b/docs/code_samples/expense_receipts_v5_async.txt index b2e797982..fb2d274ca 100644 --- a/docs/code_samples/expense_receipts_v5_async.txt +++ b/docs/code_samples/expense_receipts_v5_async.txt @@ -12,10 +12,10 @@ public class SimpleMindeeClientV1 { String filePath = "/path/to/the/file.ext"; // Init a new client - MindeeClient mindeeClient = new MindeeClient(apiKey); + var mindeeClient = new MindeeClient(apiKey); // Load a file from disk - LocalInputSource inputSource = new LocalInputSource(new File(filePath)); + var inputSource = new LocalInputSource(new File(filePath)); // Parse the file asynchronously AsyncPredictResponse response = mindeeClient.enqueueAndParse( diff --git a/docs/code_samples/financial_document_v1.txt b/docs/code_samples/financial_document_v1.txt index 73fda927b..bef3d69bf 100644 --- a/docs/code_samples/financial_document_v1.txt +++ b/docs/code_samples/financial_document_v1.txt @@ -12,10 +12,10 @@ public class SimpleMindeeClientV1 { String filePath = "/path/to/the/file.ext"; // Init a new client - MindeeClient mindeeClient = new MindeeClient(apiKey); + var mindeeClient = new MindeeClient(apiKey); // Load a file from disk - LocalInputSource inputSource = new LocalInputSource(filePath); + var inputSource = new LocalInputSource(filePath); // Parse the file PredictResponse response = mindeeClient.parse( diff --git a/docs/code_samples/financial_document_v1_async.txt b/docs/code_samples/financial_document_v1_async.txt index 1370a6416..bb06eed21 100644 --- a/docs/code_samples/financial_document_v1_async.txt +++ b/docs/code_samples/financial_document_v1_async.txt @@ -12,10 +12,10 @@ public class SimpleMindeeClientV1 { String filePath = "/path/to/the/file.ext"; // Init a new client - MindeeClient mindeeClient = new MindeeClient(apiKey); + var mindeeClient = new MindeeClient(apiKey); // Load a file from disk - LocalInputSource inputSource = new LocalInputSource(new File(filePath)); + var inputSource = new LocalInputSource(new File(filePath)); // Parse the file asynchronously AsyncPredictResponse response = mindeeClient.enqueueAndParse( diff --git a/docs/code_samples/idcard_fr_v1.txt b/docs/code_samples/idcard_fr_v1.txt index 7e531ecd7..3ce921ac1 100644 --- a/docs/code_samples/idcard_fr_v1.txt +++ b/docs/code_samples/idcard_fr_v1.txt @@ -12,10 +12,10 @@ public class SimpleMindeeClientV1 { String filePath = "/path/to/the/file.ext"; // Init a new client - MindeeClient mindeeClient = new MindeeClient(apiKey); + var mindeeClient = new MindeeClient(apiKey); // Load a file from disk - LocalInputSource inputSource = new LocalInputSource(filePath); + var inputSource = new LocalInputSource(filePath); // Parse the file PredictResponse response = mindeeClient.parse( diff --git a/docs/code_samples/idcard_fr_v2.txt b/docs/code_samples/idcard_fr_v2.txt index 88d22f1b1..bb2e409a0 100644 --- a/docs/code_samples/idcard_fr_v2.txt +++ b/docs/code_samples/idcard_fr_v2.txt @@ -12,10 +12,10 @@ public class SimpleMindeeClientV1 { String filePath = "/path/to/the/file.ext"; // Init a new client - MindeeClient mindeeClient = new MindeeClient(apiKey); + var mindeeClient = new MindeeClient(apiKey); // Load a file from disk - LocalInputSource inputSource = new LocalInputSource(filePath); + var inputSource = new LocalInputSource(filePath); // Parse the file PredictResponse response = mindeeClient.parse( diff --git a/docs/code_samples/ind_passport_v1_async.txt b/docs/code_samples/ind_passport_v1_async.txt index b64965cda..6fa8d2157 100644 --- a/docs/code_samples/ind_passport_v1_async.txt +++ b/docs/code_samples/ind_passport_v1_async.txt @@ -12,10 +12,10 @@ public class SimpleMindeeClientV1 { String filePath = "/path/to/the/file.ext"; // Init a new client - MindeeClient mindeeClient = new MindeeClient(apiKey); + var mindeeClient = new MindeeClient(apiKey); // Load a file from disk - LocalInputSource inputSource = new LocalInputSource(new File(filePath)); + var inputSource = new LocalInputSource(new File(filePath)); // Parse the file asynchronously AsyncPredictResponse response = mindeeClient.enqueueAndParse( diff --git a/docs/code_samples/international_id_v2_async.txt b/docs/code_samples/international_id_v2_async.txt index 3b6956c4f..458396fcc 100644 --- a/docs/code_samples/international_id_v2_async.txt +++ b/docs/code_samples/international_id_v2_async.txt @@ -12,10 +12,10 @@ public class SimpleMindeeClientV1 { String filePath = "/path/to/the/file.ext"; // Init a new client - MindeeClient mindeeClient = new MindeeClient(apiKey); + var mindeeClient = new MindeeClient(apiKey); // Load a file from disk - LocalInputSource inputSource = new LocalInputSource(new File(filePath)); + var inputSource = new LocalInputSource(new File(filePath)); // Parse the file asynchronously AsyncPredictResponse response = mindeeClient.enqueueAndParse( diff --git a/docs/code_samples/invoice_splitter_v1_async.txt b/docs/code_samples/invoice_splitter_v1_async.txt index ccbf64cf4..e766d43bc 100644 --- a/docs/code_samples/invoice_splitter_v1_async.txt +++ b/docs/code_samples/invoice_splitter_v1_async.txt @@ -12,10 +12,10 @@ public class SimpleMindeeClientV1 { String filePath = "/path/to/the/file.ext"; // Init a new client - MindeeClient mindeeClient = new MindeeClient(apiKey); + var mindeeClient = new MindeeClient(apiKey); // Load a file from disk - LocalInputSource inputSource = new LocalInputSource(new File(filePath)); + var inputSource = new LocalInputSource(new File(filePath)); // Parse the file asynchronously AsyncPredictResponse response = mindeeClient.enqueueAndParse( diff --git a/docs/code_samples/invoices_v4.txt b/docs/code_samples/invoices_v4.txt index 5d666e865..9c1491bd2 100644 --- a/docs/code_samples/invoices_v4.txt +++ b/docs/code_samples/invoices_v4.txt @@ -12,10 +12,10 @@ public class SimpleMindeeClientV1 { String filePath = "/path/to/the/file.ext"; // Init a new client - MindeeClient mindeeClient = new MindeeClient(apiKey); + var mindeeClient = new MindeeClient(apiKey); // Load a file from disk - LocalInputSource inputSource = new LocalInputSource(filePath); + var inputSource = new LocalInputSource(filePath); // Parse the file PredictResponse response = mindeeClient.parse( diff --git a/docs/code_samples/invoices_v4_async.txt b/docs/code_samples/invoices_v4_async.txt index ac52fd1be..5b906e05c 100644 --- a/docs/code_samples/invoices_v4_async.txt +++ b/docs/code_samples/invoices_v4_async.txt @@ -12,10 +12,10 @@ public class SimpleMindeeClientV1 { String filePath = "/path/to/the/file.ext"; // Init a new client - MindeeClient mindeeClient = new MindeeClient(apiKey); + var mindeeClient = new MindeeClient(apiKey); // Load a file from disk - LocalInputSource inputSource = new LocalInputSource(new File(filePath)); + var inputSource = new LocalInputSource(new File(filePath)); // Parse the file asynchronously AsyncPredictResponse response = mindeeClient.enqueueAndParse( diff --git a/docs/code_samples/multi_receipts_detector_v1.txt b/docs/code_samples/multi_receipts_detector_v1.txt index ec02e88e2..b1de23b3c 100644 --- a/docs/code_samples/multi_receipts_detector_v1.txt +++ b/docs/code_samples/multi_receipts_detector_v1.txt @@ -12,10 +12,10 @@ public class SimpleMindeeClientV1 { String filePath = "/path/to/the/file.ext"; // Init a new client - MindeeClient mindeeClient = new MindeeClient(apiKey); + var mindeeClient = new MindeeClient(apiKey); // Load a file from disk - LocalInputSource inputSource = new LocalInputSource(filePath); + var inputSource = new LocalInputSource(filePath); // Parse the file PredictResponse response = mindeeClient.parse( diff --git a/docs/code_samples/passport_v1.txt b/docs/code_samples/passport_v1.txt index 9ae473641..bb1491080 100644 --- a/docs/code_samples/passport_v1.txt +++ b/docs/code_samples/passport_v1.txt @@ -12,10 +12,10 @@ public class SimpleMindeeClientV1 { String filePath = "/path/to/the/file.ext"; // Init a new client - MindeeClient mindeeClient = new MindeeClient(apiKey); + var mindeeClient = new MindeeClient(apiKey); // Load a file from disk - LocalInputSource inputSource = new LocalInputSource(filePath); + var inputSource = new LocalInputSource(filePath); // Parse the file PredictResponse response = mindeeClient.parse( diff --git a/docs/code_samples/v2_classification.txt b/docs/code_samples/v2_classification.txt index f958f86e8..bc6b981a1 100644 --- a/docs/code_samples/v2_classification.txt +++ b/docs/code_samples/v2_classification.txt @@ -1,8 +1,6 @@ import com.mindee.input.LocalInputSource; import com.mindee.v2.MindeeClient; -import com.mindee.v2.product.classification.ClassificationClassifier; import com.mindee.v2.product.classification.ClassificationResponse; -import com.mindee.v2.product.classification.ClassificationResult; import com.mindee.v2.product.classification.params.ClassificationParameters; import java.io.IOException; @@ -16,17 +14,17 @@ public class SimpleMindeeClientV2 { String modelId = "MY_MODEL_ID"; // Init a new client - MindeeClient mindeeClient = new MindeeClient(apiKey); + var mindeeClient = new MindeeClient(apiKey); // Set inference parameters // Note: modelId is mandatory. - ClassificationParameters classificationParams = ClassificationParameters + var classificationParams = ClassificationParameters // ID of the model, required. .builder(modelId) .build(); // Load a file from disk - LocalInputSource inputSource = new LocalInputSource(filePath); + var inputSource = new LocalInputSource(filePath); // Send for processing using polling ClassificationResponse response = mindeeClient.enqueueAndGetResult( @@ -39,7 +37,7 @@ public class SimpleMindeeClientV2 { System.out.println(response.getInference().toString()); // Access the classification result - ClassificationResult result = response.getInference().getResult(); - ClassificationClassifier classification = result.getClassification(); + var result = response.getInference().getResult(); + var classification = result.getClassification(); } } diff --git a/docs/code_samples/v2_crop.txt b/docs/code_samples/v2_crop.txt index b7a9af692..436894376 100644 --- a/docs/code_samples/v2_crop.txt +++ b/docs/code_samples/v2_crop.txt @@ -1,7 +1,6 @@ import com.mindee.input.LocalInputSource; import com.mindee.v2.MindeeClient; import com.mindee.v2.product.crop.CropResponse; -import com.mindee.v2.product.crop.CropResult; import com.mindee.v2.product.crop.params.CropParameters; import java.io.IOException; @@ -15,16 +14,16 @@ public class SimpleMindeeClientV2 { String modelId = "MY_MODEL_ID"; // Init a new client - MindeeClient mindeeClient = new MindeeClient(apiKey); + var mindeeClient = new MindeeClient(apiKey); // Set inference parameters - CropParameters cropParams = CropParameters + var cropParams = CropParameters // ID of the model, required. .builder(modelId) .build(); // Load a file from disk - LocalInputSource inputSource = new LocalInputSource(filePath); + var inputSource = new LocalInputSource(filePath); // Send for processing using polling CropResponse response = mindeeClient.enqueueAndGetResult( @@ -37,6 +36,6 @@ public class SimpleMindeeClientV2 { System.out.println(response.getInference().toString()); // Access the crop results - CropResult result = response.getInference().getResult(); + var result = response.getInference().getResult(); } } diff --git a/docs/code_samples/v2_extraction.txt b/docs/code_samples/v2_extraction.txt index bcfba5ed9..1660c75f1 100644 --- a/docs/code_samples/v2_extraction.txt +++ b/docs/code_samples/v2_extraction.txt @@ -2,7 +2,6 @@ import com.mindee.input.LocalInputSource; import com.mindee.v2.MindeeClient; import com.mindee.v2.product.extraction.params.ExtractionParameters; import com.mindee.v2.product.extraction.ExtractionResponse; -import com.mindee.v2.parsing.inference.field.InferenceFields; import java.io.IOException; public class SimpleMindeeClientV2 { @@ -15,10 +14,10 @@ public class SimpleMindeeClientV2 { String modelId = "MY_MODEL_ID"; // Init a new client - MindeeClient mindeeClient = new MindeeClient(apiKey); + var mindeeClient = new MindeeClient(apiKey); // Set inference parameters - ExtractionParameters extractionParams = ExtractionParameters + var extractionParams = ExtractionParameters // ID of the model, required. .builder(modelId) @@ -37,7 +36,7 @@ public class SimpleMindeeClientV2 { .build(); // Load a file from disk - LocalInputSource inputSource = new LocalInputSource(filePath); + var inputSource = new LocalInputSource(filePath); // Send for processing using polling ExtractionResponse response = mindeeClient.enqueueAndGetResult( @@ -50,6 +49,6 @@ public class SimpleMindeeClientV2 { System.out.println(response.getInference().toString()); // Access the result fields - InferenceFields fields = response.getInference().getResult().getFields(); + var fields = response.getInference().getResult().getFields(); } } diff --git a/docs/code_samples/v2_ocr.txt b/docs/code_samples/v2_ocr.txt index 2401b2ddf..56729b69f 100644 --- a/docs/code_samples/v2_ocr.txt +++ b/docs/code_samples/v2_ocr.txt @@ -1,7 +1,6 @@ import com.mindee.input.LocalInputSource; import com.mindee.v2.MindeeClient; import com.mindee.v2.product.ocr.OcrResponse; -import com.mindee.v2.product.ocr.OcrResult; import com.mindee.v2.product.ocr.params.OcrParameters; import java.io.IOException; @@ -15,16 +14,16 @@ public class SimpleMindeeClientV2 { String modelId = "MY_MODEL_ID"; // Init a new client - MindeeClient mindeeClient = new MindeeClient(apiKey); + var mindeeClient = new MindeeClient(apiKey); // Set inference parameters - OcrParameters ocrParams = OcrParameters + var ocrParams = OcrParameters // ID of the model, required. .builder(modelId) .build(); // Load a file from disk - LocalInputSource inputSource = new LocalInputSource(filePath); + var inputSource = new LocalInputSource(filePath); // Send for processing using polling OcrResponse response = mindeeClient.enqueueAndGetResult( @@ -37,6 +36,6 @@ public class SimpleMindeeClientV2 { System.out.println(response.getInference().toString()); // Access the result OCR pages - OcrResult result = response.getInference().getResult(); + var result = response.getInference().getResult(); } } diff --git a/docs/code_samples/v2_split.txt b/docs/code_samples/v2_split.txt index a6acd3d29..7665b3dca 100644 --- a/docs/code_samples/v2_split.txt +++ b/docs/code_samples/v2_split.txt @@ -1,7 +1,6 @@ import com.mindee.input.LocalInputSource; import com.mindee.v2.MindeeClient; import com.mindee.v2.product.split.SplitResponse; -import com.mindee.v2.product.split.SplitResult; import com.mindee.v2.product.split.params.SplitParameters; import java.io.IOException; @@ -15,16 +14,16 @@ public class SimpleMindeeClientV2 { String modelId = "MY_MODEL_ID"; // Init a new client - MindeeClient mindeeClient = new MindeeClient(apiKey); + var mindeeClient = new MindeeClient(apiKey); // Set inference parameters - SplitParameters splitParams = SplitParameters + var splitParams = SplitParameters // ID of the model, required. .builder(modelId) .build(); // Load a file from disk - LocalInputSource inputSource = new LocalInputSource(filePath); + var inputSource = new LocalInputSource(filePath); // Send for processing using polling SplitResponse response = mindeeClient.enqueueAndGetResult( @@ -37,6 +36,6 @@ public class SimpleMindeeClientV2 { System.out.println(response.getInference().toString()); // Access the split result - SplitResult result = response.getInference().getResult(); + var result = response.getInference().getResult(); } } diff --git a/docs/code_samples/workflow_execution.txt b/docs/code_samples/workflow_execution.txt index 2f2dce7b0..719989855 100644 --- a/docs/code_samples/workflow_execution.txt +++ b/docs/code_samples/workflow_execution.txt @@ -13,10 +13,10 @@ public class SimpleMindeeClientV1 { String filePath = "/path/to/the/file.ext"; // Init a new client - MindeeClient mindeeClient = new MindeeClient(apiKey); + var mindeeClient = new MindeeClient(apiKey); // Load a file from disk - LocalInputSource inputSource = new LocalInputSource(filePath); + var inputSource = new LocalInputSource(filePath); // Send the file to a workflow WorkflowResponse response = mindeeClient.executeWorkflow( diff --git a/example/AutoInvoiceSplitterExtractionExample.java b/example/AutoInvoiceSplitterExtractionExample.java index 5b2a0c4ca..2cb78c78f 100644 --- a/example/AutoInvoiceSplitterExtractionExample.java +++ b/example/AutoInvoiceSplitterExtractionExample.java @@ -12,7 +12,7 @@ public class AutoInvoiceSplitterExtractionExample { private static final String API_KEY = "my-api-key"; - private static final MindeeClient mindeeClient = new MindeeClient(API_KEY); + private static final var mindeeClient = new MindeeClient(API_KEY); public static void main(String[] args) throws IOException, InterruptedException { String filePath = "/path/to/the/file.ext"; @@ -20,7 +20,7 @@ public static void main(String[] args) throws IOException, InterruptedException } private static void invoiceSplitterAutoExtraction(String filePath) throws IOException, InterruptedException { - LocalInputSource inputSource = new LocalInputSource(new File(filePath)); + var inputSource = new LocalInputSource(new File(filePath)); if (inputSource.isPdf() && new PDFExtractor(inputSource).getPageCount() > 1) { parseMultiPage(inputSource); diff --git a/example/AutoMultiReceiptExtractionExample.java b/example/AutoMultiReceiptExtractionExample.java index bf3553d4c..2556b7add 100644 --- a/example/AutoMultiReceiptExtractionExample.java +++ b/example/AutoMultiReceiptExtractionExample.java @@ -14,7 +14,7 @@ public class AutoMultiReceiptExtractionExample { private static final String API_KEY = "my-api-key"; - private static final MindeeClient mindeeClient = new MindeeClient(API_KEY); + private static final var mindeeClient = new MindeeClient(API_KEY); public static void main(String[] args) throws IOException, InterruptedException { String myFilePath = "/path/to/the/file.ext"; @@ -22,7 +22,7 @@ public static void main(String[] args) throws IOException, InterruptedException } private static void processMultiReceipts(String filePath) throws IOException, InterruptedException { - LocalInputSource inputSource = new LocalInputSource(new File(filePath)); + var inputSource = new LocalInputSource(new File(filePath)); PredictResponse resultSplit = mindeeClient.parse(MultiReceiptsDetectorV1.class, inputSource); diff --git a/src/main/java/com/mindee/image/ImageCompressor.java b/src/main/java/com/mindee/image/ImageCompressor.java index b56096322..d14a3df78 100644 --- a/src/main/java/com/mindee/image/ImageCompressor.java +++ b/src/main/java/com/mindee/image/ImageCompressor.java @@ -8,7 +8,6 @@ import javax.imageio.IIOImage; import javax.imageio.ImageIO; import javax.imageio.ImageWriteParam; -import javax.imageio.ImageWriter; /** * Image compression class. @@ -38,8 +37,7 @@ public static byte[] compressImage( var bis = new ByteArrayInputStream(imageData); var original = ImageIO.read(bis); - ImageUtils.Dimensions dimensions = ImageUtils - .calculateNewDimensions(original, maxWidth, maxHeight); + var dimensions = ImageUtils.calculateNewDimensions(original, maxWidth, maxHeight); return compressImage(original, quality, dimensions.width, dimensions.height); } @@ -94,7 +92,7 @@ public static byte[] encodeToJpegByteArray( var outputStream = new ByteArrayOutputStream(); var writers = ImageIO.getImageWritersByFormatName("jpg"); - ImageWriter writer = writers.next(); + var writer = writers.next(); var params = writer.getDefaultWriteParam(); params.setCompressionMode(ImageWriteParam.MODE_EXPLICIT); diff --git a/src/main/java/com/mindee/image/ImageExtractor.java b/src/main/java/com/mindee/image/ImageExtractor.java index 24ea7b15b..4b62e16ce 100644 --- a/src/main/java/com/mindee/image/ImageExtractor.java +++ b/src/main/java/com/mindee/image/ImageExtractor.java @@ -1,7 +1,6 @@ package com.mindee.image; import com.mindee.geometry.Bbox; -import com.mindee.geometry.Polygon; import com.mindee.geometry.PositionDataField; import com.mindee.input.InputSourceUtils; import com.mindee.input.LocalInputSource; @@ -144,7 +143,7 @@ public ExtractedImage extractImage( ) { String[] splitName = InputSourceUtils.splitNameStrict(filename); String saveFormat = splitName[1].toLowerCase(); - Polygon polygon = field.getPolygon(); + var polygon = field.getPolygon(); if (polygon == null) { return null; } @@ -165,7 +164,7 @@ public ExtractedImage extractImage( * @param Type of field (needs to support positioning data). * @param field The field to extract. * @param index The index to use for naming the extracted image. - * @param pageIndex The page index to extract, begins at 0. + * @param pageIndex The 0-based page index to extract. * @return The {@link ExtractedImage}, or null if the field does not have valid * position data. */ diff --git a/src/main/java/com/mindee/v1/CommandLineInterface.java b/src/main/java/com/mindee/v1/CommandLineInterface.java index 09c6bfa45..1ee63c98a 100644 --- a/src/main/java/com/mindee/v1/CommandLineInterface.java +++ b/src/main/java/com/mindee/v1/CommandLineInterface.java @@ -183,7 +183,7 @@ void generatedMethod( @Parameters(index = "0", scope = ScopeType.LOCAL, paramLabel = "") File file ) throws IOException, InterruptedException { - MindeeClient mindeeClient = new MindeeClient(apiKey); + var mindeeClient = new MindeeClient(apiKey); Endpoint endpoint = new Endpoint(endpointName, accountName, productVersion); @@ -244,8 +244,8 @@ private String wordsOutput(Ocr ocr) { Class productClass, File file ) throws IOException { - MindeeClient mindeeClient = new MindeeClient(apiKey); - LocalInputSource inputSource = new LocalInputSource(file); + var mindeeClient = new MindeeClient(apiKey); + var inputSource = new LocalInputSource(file); PredictResponse response; PredictOptions predictOptions = PredictOptions .builder() @@ -281,8 +281,8 @@ private String wordsOutput(Ocr ocr) { Class productClass, File file ) throws IOException, InterruptedException { - MindeeClient mindeeClient = new MindeeClient(apiKey); - LocalInputSource inputSource = new LocalInputSource(file); + var mindeeClient = new MindeeClient(apiKey); + var inputSource = new LocalInputSource(file); AsyncPredictResponse response; PredictOptions predictOptions = PredictOptions .builder() diff --git a/src/main/java/com/mindee/v2/http/MindeeApiV2.java b/src/main/java/com/mindee/v2/http/MindeeApiV2.java index 197e7b5fd..af79cd998 100644 --- a/src/main/java/com/mindee/v2/http/MindeeApiV2.java +++ b/src/main/java/com/mindee/v2/http/MindeeApiV2.java @@ -67,7 +67,7 @@ protected ErrorResponse makeUnknownError(int statusCode) { } protected ProductInfo getResponseProductInfo(Class responseClass) { - ProductInfo productInfo = responseClass.getAnnotation(ProductInfo.class); + var productInfo = responseClass.getAnnotation(ProductInfo.class); if (productInfo == null) { throw new MindeeException( "The class " + responseClass.getSimpleName() + " is not annotated with @ProductInfo" @@ -77,7 +77,7 @@ protected ProductInfo getResponseProductInfo(Class res } protected ProductInfo getParamsProductInfo(Class responseClass) { - ProductInfo productInfo = responseClass.getAnnotation(ProductInfo.class); + var productInfo = responseClass.getAnnotation(ProductInfo.class); if (productInfo == null) { throw new MindeeException( "The class " + responseClass.getSimpleName() + " is not annotated with @ProductInfo" diff --git a/src/main/java/com/mindee/v2/http/MindeeHttpApiV2.java b/src/main/java/com/mindee/v2/http/MindeeHttpApiV2.java index 0a01686d4..48669a4b1 100644 --- a/src/main/java/com/mindee/v2/http/MindeeHttpApiV2.java +++ b/src/main/java/com/mindee/v2/http/MindeeHttpApiV2.java @@ -19,11 +19,9 @@ import org.apache.hc.client5.http.config.RequestConfig; import org.apache.hc.client5.http.entity.mime.HttpMultipartMode; import org.apache.hc.client5.http.entity.mime.MultipartEntityBuilder; -import org.apache.hc.client5.http.impl.classic.CloseableHttpClient; import org.apache.hc.client5.http.impl.classic.HttpClientBuilder; import org.apache.hc.core5.http.ClassicHttpResponse; import org.apache.hc.core5.http.ContentType; -import org.apache.hc.core5.http.HttpEntity; import org.apache.hc.core5.http.HttpHeaders; import org.apache.hc.core5.http.io.entity.EntityUtils; import org.apache.hc.core5.net.URIBuilder; @@ -69,12 +67,12 @@ private MindeeHttpApiV2(MindeeSettings mindeeSettings, HttpClientBuilder httpCli */ @Override public JobResponse reqPostEnqueue(LocalInputSource inputSource, BaseParameters options) { - ProductInfo productInfo = getParamsProductInfo(options.getClass()); - String url = String + var productInfo = getParamsProductInfo(options.getClass()); + var url = String .format("%s/products/%s/enqueue", this.mindeeSettings.getBaseUrl(), productInfo.slug()); - HttpPost post = buildHttpPost(url); + var post = buildHttpPost(url); - MultipartEntityBuilder builder = MultipartEntityBuilder.create(); + var builder = MultipartEntityBuilder.create(); builder.setMode(HttpMultipartMode.EXTENDED); builder .addBinaryBody( @@ -96,12 +94,12 @@ public JobResponse reqPostEnqueue(LocalInputSource inputSource, BaseParameters o */ @Override public JobResponse reqPostEnqueue(URLInputSource inputSource, BaseParameters options) { - ProductInfo productInfo = getParamsProductInfo(options.getClass()); - String url = String + var productInfo = getParamsProductInfo(options.getClass()); + var url = String .format("%s/products/%s/enqueue", this.mindeeSettings.getBaseUrl(), productInfo.slug()); - HttpPost post = buildHttpPost(url); + var post = buildHttpPost(url); - MultipartEntityBuilder builder = MultipartEntityBuilder.create(); + var builder = MultipartEntityBuilder.create(); builder.setMode(HttpMultipartMode.EXTENDED); builder.addTextBody("url", inputSource.getUrl()); post.setEntity(options.buildHttpBody(builder).build()); @@ -115,16 +113,15 @@ public JobResponse reqPostEnqueue(URLInputSource inputSource, BaseParameters opt * @return a valid job response. */ private JobResponse executeEnqueue(HttpPost post) { - try (CloseableHttpClient httpClient = httpClientBuilder.build()) { + try (var httpClient = httpClientBuilder.build()) { return httpClient.execute(post, response -> { - HttpEntity responseEntity = response.getEntity(); - int statusCode = response.getCode(); + var responseEntity = response.getEntity(); + var statusCode = response.getCode(); if (isInvalidStatusCode(statusCode)) { throw getHttpError(response); } try { - String raw = EntityUtils.toString(response.getEntity(), StandardCharsets.UTF_8); - + var raw = EntityUtils.toString(response.getEntity(), StandardCharsets.UTF_8); return deserializeOrThrow(raw, JobResponse.class, response.getCode()); } finally { EntityUtils.consumeQuietly(responseEntity); @@ -138,25 +135,25 @@ private JobResponse executeEnqueue(HttpPost post) { @Override public JobResponse reqGetJob(String jobId) { - String url = this.mindeeSettings.getBaseUrl() + "/jobs/" + jobId; - HttpGet get = new HttpGet(url); + var url = this.mindeeSettings.getBaseUrl() + "/jobs/" + jobId; + var get = new HttpGet(url); if (this.mindeeSettings.getApiKey().isPresent()) { get.setHeader(HttpHeaders.AUTHORIZATION, this.mindeeSettings.getApiKey().get()); } get.setHeader(HttpHeaders.USER_AGENT, getUserAgent()); - RequestConfig noRedirect = RequestConfig.custom().setRedirectsEnabled(false).build(); + var noRedirect = RequestConfig.custom().setRedirectsEnabled(false).build(); get.setConfig(noRedirect); - try (CloseableHttpClient httpClient = httpClientBuilder.build()) { + try (var httpClient = httpClientBuilder.build()) { return httpClient.execute(get, response -> { - HttpEntity responseEntity = response.getEntity(); - int statusCode = response.getCode(); + var responseEntity = response.getEntity(); + var statusCode = response.getCode(); if (isInvalidStatusCode(statusCode)) { throw getHttpError(response); } try { - String raw = EntityUtils.toString(response.getEntity(), StandardCharsets.UTF_8); + var raw = EntityUtils.toString(response.getEntity(), StandardCharsets.UTF_8); return deserializeOrThrow(raw, JobResponse.class, response.getCode()); } finally { @@ -173,31 +170,31 @@ public TResponse reqGetResult( Class responseClass, String inferenceId ) { - ProductInfo productInfo = getResponseProductInfo(responseClass); - String url = String + var productInfo = getResponseProductInfo(responseClass); + var url = String .format( "%s/products/%s/results/%s", this.mindeeSettings.getBaseUrl(), productInfo.slug(), inferenceId ); - HttpGet get = new HttpGet(url); + var get = new HttpGet(url); if (this.mindeeSettings.getApiKey().isPresent()) { get.setHeader(HttpHeaders.AUTHORIZATION, this.mindeeSettings.getApiKey().get()); } get.setHeader(HttpHeaders.USER_AGENT, getUserAgent()); - try (CloseableHttpClient httpClient = httpClientBuilder.build()) { + try (var httpClient = httpClientBuilder.build()) { return httpClient.execute(get, response -> { - HttpEntity entity = response.getEntity(); - int status = response.getCode(); + var entity = response.getEntity(); + var status = response.getCode(); try { if (isInvalidStatusCode(status)) { throw getHttpError(response); } - String raw = EntityUtils.toString(entity, StandardCharsets.UTF_8); + var raw = EntityUtils.toString(entity, StandardCharsets.UTF_8); return deserializeOrThrow(raw, responseClass, status); } finally { EntityUtils.consumeQuietly(entity); @@ -215,7 +212,7 @@ private MindeeHttpExceptionV2 getHttpError(ClassicHttpResponse response) { ? "" : EntityUtils.toString(response.getEntity(), StandardCharsets.UTF_8); - ErrorResponse err = mapper.readValue(rawBody, ErrorResponse.class); + var err = mapper.readValue(rawBody, ErrorResponse.class); if (err.getDetail() == null) { err = makeUnknownError(response.getCode()); @@ -230,7 +227,7 @@ private MindeeHttpExceptionV2 getHttpError(ClassicHttpResponse response) { private HttpPost buildHttpPost(String url) { HttpPost post; try { - URIBuilder uriBuilder = new URIBuilder(url); + var uriBuilder = new URIBuilder(url); post = new HttpPost(uriBuilder.build()); } // This exception will never happen because we are providing the URL internally. @@ -254,7 +251,7 @@ private R deserializeOrThrow( if (httpStatus >= 200 && httpStatus < 400) { try { - R model = mapper.readerFor(clazz).readValue(body); + var model = mapper.readerFor(clazz).readValue(body); model.setRawResponse(body); return model; } catch (Exception exception) { diff --git a/src/main/java/com/mindee/v2/parsing/BaseInference.java b/src/main/java/com/mindee/v2/parsing/BaseInference.java index daa22b9fd..9c648e4c6 100644 --- a/src/main/java/com/mindee/v2/parsing/BaseInference.java +++ b/src/main/java/com/mindee/v2/parsing/BaseInference.java @@ -51,7 +51,7 @@ public abstract class BaseInference { protected TResult result; protected String toStringBase() { - StringJoiner joiner = new StringJoiner("\n"); + var joiner = new StringJoiner("\n"); joiner .add("Inference") .add("#########") @@ -65,7 +65,7 @@ protected String toStringBase() { @Override public String toString() { - StringJoiner joiner = new StringJoiner("\n"); + var joiner = new StringJoiner("\n"); joiner.add(toStringBase()).add(result.toString()); return joiner.toString().trim() + "\n"; } diff --git a/src/main/java/com/mindee/v2/parsing/inference/DataSchemaActiveOptions.java b/src/main/java/com/mindee/v2/parsing/inference/DataSchemaActiveOptions.java index 0b3898dde..18c0efcc8 100644 --- a/src/main/java/com/mindee/v2/parsing/inference/DataSchemaActiveOptions.java +++ b/src/main/java/com/mindee/v2/parsing/inference/DataSchemaActiveOptions.java @@ -26,7 +26,7 @@ public boolean getReplace() { @Override public String toString() { - StringJoiner joiner = new StringJoiner("\n"); + var joiner = new StringJoiner("\n"); return joiner .add("Data Schema") .add("-----------") diff --git a/src/main/java/com/mindee/v2/parsing/inference/InferenceActiveOptions.java b/src/main/java/com/mindee/v2/parsing/inference/InferenceActiveOptions.java index 5ecbdc047..ca67dd41e 100644 --- a/src/main/java/com/mindee/v2/parsing/inference/InferenceActiveOptions.java +++ b/src/main/java/com/mindee/v2/parsing/inference/InferenceActiveOptions.java @@ -74,7 +74,7 @@ public boolean getTextContext() { @Override public String toString() { - StringJoiner joiner = new StringJoiner("\n"); + var joiner = new StringJoiner("\n"); return joiner .add("Active Options") .add("==============") diff --git a/src/main/java/com/mindee/v2/parsing/inference/InferenceFile.java b/src/main/java/com/mindee/v2/parsing/inference/InferenceFile.java index f8c963601..68201bc38 100644 --- a/src/main/java/com/mindee/v2/parsing/inference/InferenceFile.java +++ b/src/main/java/com/mindee/v2/parsing/inference/InferenceFile.java @@ -43,7 +43,7 @@ public class InferenceFile { public String toString() { - StringJoiner joiner = new StringJoiner("\n"); + var joiner = new StringJoiner("\n"); joiner .add("File") .add("====") diff --git a/src/main/java/com/mindee/v2/parsing/inference/InferenceJob.java b/src/main/java/com/mindee/v2/parsing/inference/InferenceJob.java index 69c499a4a..9c469945d 100644 --- a/src/main/java/com/mindee/v2/parsing/inference/InferenceJob.java +++ b/src/main/java/com/mindee/v2/parsing/inference/InferenceJob.java @@ -25,7 +25,7 @@ public class InferenceJob { public String toString() { - StringJoiner joiner = new StringJoiner("\n"); + var joiner = new StringJoiner("\n"); joiner.add("Job").add("===").add(":ID: " + id); return joiner.toString(); } diff --git a/src/main/java/com/mindee/v2/parsing/inference/InferenceModel.java b/src/main/java/com/mindee/v2/parsing/inference/InferenceModel.java index a7ccc9647..edb5ac1c2 100644 --- a/src/main/java/com/mindee/v2/parsing/inference/InferenceModel.java +++ b/src/main/java/com/mindee/v2/parsing/inference/InferenceModel.java @@ -25,7 +25,7 @@ public class InferenceModel { private String id; public String toString() { - StringJoiner joiner = new StringJoiner("\n"); + var joiner = new StringJoiner("\n"); return joiner.add("Model").add("=====").add(":ID: " + id).toString(); } } diff --git a/src/main/java/com/mindee/v2/parsing/inference/RawText.java b/src/main/java/com/mindee/v2/parsing/inference/RawText.java index ba3b8953a..dc3936d46 100644 --- a/src/main/java/com/mindee/v2/parsing/inference/RawText.java +++ b/src/main/java/com/mindee/v2/parsing/inference/RawText.java @@ -27,7 +27,7 @@ public String toString() { if (pages == null || pages.isEmpty()) { return ""; } - StringJoiner joiner = new StringJoiner("\n\n"); + var joiner = new StringJoiner("\n\n"); for (RawTextPage page : pages) { joiner.add(page.toString()); } diff --git a/src/main/java/com/mindee/v2/parsing/inference/field/InferenceFields.java b/src/main/java/com/mindee/v2/parsing/inference/field/InferenceFields.java index 025e79d89..fa9101ce3 100644 --- a/src/main/java/com/mindee/v2/parsing/inference/field/InferenceFields.java +++ b/src/main/java/com/mindee/v2/parsing/inference/field/InferenceFields.java @@ -48,7 +48,7 @@ public String toString(int indent) { if (this.isEmpty()) { return ""; } - StringJoiner joiner = new StringJoiner("\n"); + var joiner = new StringJoiner("\n"); this.forEach((fieldKey, fieldInstance) -> { StringBuilder strBuilder = new StringBuilder(); diff --git a/src/main/java/com/mindee/v2/parsing/inference/field/ListField.java b/src/main/java/com/mindee/v2/parsing/inference/field/ListField.java index e21030611..adb7395dc 100644 --- a/src/main/java/com/mindee/v2/parsing/inference/field/ListField.java +++ b/src/main/java/com/mindee/v2/parsing/inference/field/ListField.java @@ -65,7 +65,7 @@ public String toString() { if (items == null || items.isEmpty()) { return "\n"; } - StringJoiner joiner = new StringJoiner("\n * "); + var joiner = new StringJoiner("\n * "); joiner.add(""); for (DynamicField item : items) { if (item != null) { diff --git a/src/main/java/com/mindee/v2/product/classification/ClassificationResult.java b/src/main/java/com/mindee/v2/product/classification/ClassificationResult.java index 77ccd1d82..2649bfd68 100644 --- a/src/main/java/com/mindee/v2/product/classification/ClassificationResult.java +++ b/src/main/java/com/mindee/v2/product/classification/ClassificationResult.java @@ -25,7 +25,7 @@ public final class ClassificationResult { @Override public String toString() { - StringJoiner joiner = new StringJoiner("\n"); + var joiner = new StringJoiner("\n"); joiner.add("Classification\n=============="); joiner.add(classification.toString()); diff --git a/src/main/java/com/mindee/v2/product/crop/CropResult.java b/src/main/java/com/mindee/v2/product/crop/CropResult.java index 7beea3e74..121e3f882 100644 --- a/src/main/java/com/mindee/v2/product/crop/CropResult.java +++ b/src/main/java/com/mindee/v2/product/crop/CropResult.java @@ -26,7 +26,7 @@ public final class CropResult { @Override public String toString() { - StringJoiner joiner = new StringJoiner("\n"); + var joiner = new StringJoiner("\n"); joiner.add("Crops\n====="); for (CropItem item : crops) { joiner.add(item.toString()); diff --git a/src/main/java/com/mindee/v2/product/extraction/ExtractionInference.java b/src/main/java/com/mindee/v2/product/extraction/ExtractionInference.java index 7a04169a4..62418bfd6 100644 --- a/src/main/java/com/mindee/v2/product/extraction/ExtractionInference.java +++ b/src/main/java/com/mindee/v2/product/extraction/ExtractionInference.java @@ -25,7 +25,7 @@ public class ExtractionInference extends BaseInference { @Override public String toString() { - StringJoiner joiner = new StringJoiner("\n"); + var joiner = new StringJoiner("\n"); joiner.add(toStringBase()).add(activeOptions.toString()).add("").add(result.toString()); return joiner.toString().trim() + "\n"; } diff --git a/src/main/java/com/mindee/v2/product/extraction/ExtractionResult.java b/src/main/java/com/mindee/v2/product/extraction/ExtractionResult.java index d0709eb70..00cb0e690 100644 --- a/src/main/java/com/mindee/v2/product/extraction/ExtractionResult.java +++ b/src/main/java/com/mindee/v2/product/extraction/ExtractionResult.java @@ -41,7 +41,7 @@ public final class ExtractionResult { @Override public String toString() { - StringJoiner joiner = new StringJoiner("\n"); + var joiner = new StringJoiner("\n"); joiner.add("Fields").add("======"); joiner.add(fields.toString()); diff --git a/src/main/java/com/mindee/v2/product/ocr/OcrResult.java b/src/main/java/com/mindee/v2/product/ocr/OcrResult.java index 7a5cfc286..a67f34a51 100644 --- a/src/main/java/com/mindee/v2/product/ocr/OcrResult.java +++ b/src/main/java/com/mindee/v2/product/ocr/OcrResult.java @@ -26,7 +26,7 @@ public final class OcrResult { @Override public String toString() { - StringJoiner joiner = new StringJoiner("\n"); + var joiner = new StringJoiner("\n"); joiner.add("Pages\n======"); for (OcrPage item : pages) { joiner.add(item.toString()); diff --git a/src/main/java/com/mindee/v2/product/split/SplitResult.java b/src/main/java/com/mindee/v2/product/split/SplitResult.java index 41deb8ecc..97c1e65c2 100644 --- a/src/main/java/com/mindee/v2/product/split/SplitResult.java +++ b/src/main/java/com/mindee/v2/product/split/SplitResult.java @@ -26,7 +26,7 @@ public final class SplitResult { @Override public String toString() { - StringJoiner joiner = new StringJoiner("\n"); + var joiner = new StringJoiner("\n"); joiner.add("Splits\n======"); for (SplitRange item : splits) { joiner.add(item.toString()); diff --git a/src/test/java/com/mindee/v1/workflow/WorkflowTest.java b/src/test/java/com/mindee/v1/workflow/WorkflowTest.java index 4c228fbb6..68b623ffc 100644 --- a/src/test/java/com/mindee/v1/workflow/WorkflowTest.java +++ b/src/test/java/com/mindee/v1/workflow/WorkflowTest.java @@ -49,7 +49,7 @@ void sendingADocumentToAnExecutionShouldDeserializeResponseCorrectly() throws IO var mindeeClient = new MindeeClient(new FakeMindeeApiV1<>(workflowResponse)); String workflowId = "07ebf237-ff27-4eee-b6a2-425df4a5cca6"; - LocalInputSource inputSource = new LocalInputSource( + var inputSource = new LocalInputSource( getV1ResourcePath("products/financial_document/default_sample.jpg") ); @@ -88,7 +88,7 @@ void sendingADocumentToAnExecutionWithPriorityAndAliasShouldDeserializeResponseC var mindeeClient = new MindeeClient(new FakeMindeeApiV1<>(workflowResponse)); String workflowId = "07ebf237-ff27-4eee-b6a2-425df4a5cca6"; - LocalInputSource inputSource = new LocalInputSource( + var inputSource = new LocalInputSource( getV1ResourcePath("products/financial_document/default_sample.jpg") ); diff --git a/src/test/java/com/mindee/v2/MindeeClientTest.java b/src/test/java/com/mindee/v2/MindeeClientTest.java index b3e5f1da6..9675c9e42 100644 --- a/src/test/java/com/mindee/v2/MindeeClientTest.java +++ b/src/test/java/com/mindee/v2/MindeeClientTest.java @@ -86,7 +86,7 @@ void document_getJob_async() throws JsonProcessingException { JobResponse processing = mapper.readValue(json, JobResponse.class); - MindeeClient mindeeClient = new MindeeClient(new FakeMindeeApiV2(processing, null)); + var mindeeClient = new MindeeClient(new FakeMindeeApiV2(processing, null)); JobResponse response = mindeeClient.getJob("dummy-id"); assertNotNull(response, "getJob() must return a response"); @@ -106,7 +106,7 @@ void document_getResult_async() throws IOException { mapper.findAndRegisterModules(); ExtractionResponse processing = mapper.readValue(json, ExtractionResponse.class); - MindeeClient mindeeClient = new MindeeClient(new FakeMindeeApiV2(null, processing)); + var mindeeClient = new MindeeClient(new FakeMindeeApiV2(null, processing)); ExtractionResponse response = mindeeClient .getResult(ExtractionResponse.class, "12345678-1234-1234-1234-123456789abc");