Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@
import com.azure.core.util.logging.ClientLogger;
import com.azure.search.documents.indexes.models.EntityCategory;

import static com.azure.search.documents.implementation.util.Constants.ENUM_EXTERNAL_ERROR_MSG;
import static com.azure.search.documents.implementation.util.Constants.ENUM_INTERNAL_ERROR_MSG;

/**
* A converter between {@link com.azure.search.documents.indexes.implementation.models.EntityCategory} and
* {@link EntityCategory}.
Expand All @@ -24,24 +21,7 @@ public static EntityCategory map(com.azure.search.documents.indexes.implementati
if (obj == null) {
return null;
}
switch (obj) {
case LOCATION:
return EntityCategory.LOCATION;
case ORGANIZATION:
return EntityCategory.ORGANIZATION;
case PERSON:
return EntityCategory.PERSON;
case QUANTITY:
return EntityCategory.QUANTITY;
case DATETIME:
return EntityCategory.DATETIME;
case URL:
return EntityCategory.URL;
case EMAIL:
return EntityCategory.EMAIL;
default:
throw LOGGER.logExceptionAsError(new RuntimeException(String.format(ENUM_EXTERNAL_ERROR_MSG, obj)));
}
return EntityCategory.fromString(obj.toString());
}

/**
Expand All @@ -52,24 +32,7 @@ public static com.azure.search.documents.indexes.implementation.models.EntityCat
if (obj == null) {
return null;
}
switch (obj) {
case LOCATION:
return com.azure.search.documents.indexes.implementation.models.EntityCategory.LOCATION;
case ORGANIZATION:
return com.azure.search.documents.indexes.implementation.models.EntityCategory.ORGANIZATION;
case PERSON:
return com.azure.search.documents.indexes.implementation.models.EntityCategory.PERSON;
case QUANTITY:
return com.azure.search.documents.indexes.implementation.models.EntityCategory.QUANTITY;
case DATETIME:
return com.azure.search.documents.indexes.implementation.models.EntityCategory.DATETIME;
case URL:
return com.azure.search.documents.indexes.implementation.models.EntityCategory.URL;
case EMAIL:
return com.azure.search.documents.indexes.implementation.models.EntityCategory.EMAIL;
default:
throw LOGGER.logExceptionAsError(new RuntimeException(String.format(ENUM_INTERNAL_ERROR_MSG, obj)));
}
return com.azure.search.documents.indexes.implementation.models.EntityCategory.fromString(obj.toString());
}

private EntityCategoryConverter() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,12 @@

package com.azure.search.documents.implementation.converters;

import com.azure.core.util.logging.ClientLogger;
import com.azure.search.documents.indexes.models.ImageDetail;

import static com.azure.search.documents.implementation.util.Constants.ENUM_EXTERNAL_ERROR_MSG;
import static com.azure.search.documents.implementation.util.Constants.ENUM_INTERNAL_ERROR_MSG;

/**
* A converter between {@link com.azure.search.documents.indexes.implementation.models.ImageDetail} and {@link ImageDetail}.
*/
public final class ImageDetailConverter {
private static final ClientLogger LOGGER = new ClientLogger(ImageDetailConverter.class);

/**
* Maps from enum {@link com.azure.search.documents.indexes.implementation.models.ImageDetail} to enum {@link ImageDetail}.
Expand All @@ -22,14 +17,7 @@ public static ImageDetail map(com.azure.search.documents.indexes.implementation.
if (obj == null) {
return null;
}
switch (obj) {
case CELEBRITIES:
return ImageDetail.CELEBRITIES;
case LANDMARKS:
return ImageDetail.LANDMARKS;
default:
throw LOGGER.logExceptionAsError(new RuntimeException(String.format(ENUM_EXTERNAL_ERROR_MSG, obj)));
}
return ImageDetail.fromString(obj.toString());
}

/**
Expand All @@ -39,14 +27,7 @@ public static com.azure.search.documents.indexes.implementation.models.ImageDeta
if (obj == null) {
return null;
}
switch (obj) {
case CELEBRITIES:
return com.azure.search.documents.indexes.implementation.models.ImageDetail.CELEBRITIES;
case LANDMARKS:
return com.azure.search.documents.indexes.implementation.models.ImageDetail.LANDMARKS;
default:
throw LOGGER.logExceptionAsError(new RuntimeException(String.format(ENUM_INTERNAL_ERROR_MSG, obj)));
}
return com.azure.search.documents.indexes.implementation.models.ImageDetail.fromString(obj.toString());
}

private ImageDetailConverter() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import com.azure.search.documents.indexes.models.OcrSkill;
import com.azure.search.documents.indexes.models.OcrSkillLanguage;
import com.azure.search.documents.indexes.models.OutputFieldMappingEntry;
import com.azure.search.documents.indexes.models.TextExtractionAlgorithm;

import java.util.List;
import java.util.stream.Collectors;
Expand Down Expand Up @@ -46,19 +45,14 @@ public static OcrSkill map(com.azure.search.documents.indexes.implementation.mod
String description = obj.getDescription();
ocrSkill.setDescription(description);

if (obj.getTextExtractionAlgorithm() != null) {
TextExtractionAlgorithm textExtractionAlgorithm =
TextExtractionAlgorithmConverter.map(obj.getTextExtractionAlgorithm());
ocrSkill.setTextExtractionAlgorithm(textExtractionAlgorithm);
}

if (obj.getDefaultLanguageCode() != null) {
OcrSkillLanguage defaultLanguageCode = OcrSkillLanguageConverter.map(obj.getDefaultLanguageCode());
ocrSkill.setDefaultLanguageCode(defaultLanguageCode);
}

Boolean shouldDetectOrientation = obj.isShouldDetectOrientation();
ocrSkill.setShouldDetectOrientation(shouldDetectOrientation);
ocrSkill.shouldDetectOrientation(shouldDetectOrientation);
return ocrSkill;
}

Expand Down Expand Up @@ -93,12 +87,6 @@ public static com.azure.search.documents.indexes.implementation.models.OcrSkill
String description = obj.getDescription();
ocrSkill.setDescription(description);

if (obj.getTextExtractionAlgorithm() != null) {
com.azure.search.documents.indexes.implementation.models.TextExtractionAlgorithm textExtractionAlgorithm =
TextExtractionAlgorithmConverter.map(obj.getTextExtractionAlgorithm());
ocrSkill.setTextExtractionAlgorithm(textExtractionAlgorithm);
}

if (obj.getDefaultLanguageCode() != null) {
com.azure.search.documents.indexes.implementation.models.OcrSkillLanguage defaultLanguageCode =
OcrSkillLanguageConverter.map(obj.getDefaultLanguageCode());
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@
import com.azure.core.util.logging.ClientLogger;
import com.azure.search.documents.indexes.models.TextSplitMode;

import static com.azure.search.documents.implementation.util.Constants.ENUM_EXTERNAL_ERROR_MSG;
import static com.azure.search.documents.implementation.util.Constants.ENUM_INTERNAL_ERROR_MSG;

/**
* A converter between {@link com.azure.search.documents.indexes.implementation.models.TextSplitMode} and {@link TextSplitMode}.
*/
Expand All @@ -23,14 +20,7 @@ public static TextSplitMode map(com.azure.search.documents.indexes.implementatio
if (obj == null) {
return null;
}
switch (obj) {
case PAGES:
return TextSplitMode.PAGES;
case SENTENCES:
return TextSplitMode.SENTENCES;
default:
throw LOGGER.logExceptionAsError(new RuntimeException(String.format(ENUM_EXTERNAL_ERROR_MSG, obj)));
}
return TextSplitMode.fromString(obj.toString());
}

/**
Expand All @@ -41,14 +31,7 @@ public static com.azure.search.documents.indexes.implementation.models.TextSplit
if (obj == null) {
return null;
}
switch (obj) {
case PAGES:
return com.azure.search.documents.indexes.implementation.models.TextSplitMode.PAGES;
case SENTENCES:
return com.azure.search.documents.indexes.implementation.models.TextSplitMode.SENTENCES;
default:
throw LOGGER.logExceptionAsError(new RuntimeException(String.format(ENUM_INTERNAL_ERROR_MSG, obj)));
}
return com.azure.search.documents.indexes.implementation.models.TextSplitMode.fromString(obj.toString());
}

private TextSplitModeConverter() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@
import com.azure.core.util.logging.ClientLogger;
import com.azure.search.documents.indexes.models.VisualFeature;

import static com.azure.search.documents.implementation.util.Constants.ENUM_EXTERNAL_ERROR_MSG;
import static com.azure.search.documents.implementation.util.Constants.ENUM_INTERNAL_ERROR_MSG;

/**
* A converter between {@link com.azure.search.documents.indexes.implementation.models.VisualFeature} and {@link VisualFeature}.
*/
Expand All @@ -23,24 +20,7 @@ public static VisualFeature map(com.azure.search.documents.indexes.implementatio
if (obj == null) {
return null;
}
switch (obj) {
case ADULT:
return VisualFeature.ADULT;
case BRANDS:
return VisualFeature.BRANDS;
case CATEGORIES:
return VisualFeature.CATEGORIES;
case DESCRIPTION:
return VisualFeature.DESCRIPTION;
case FACES:
return VisualFeature.FACES;
case OBJECTS:
return VisualFeature.OBJECTS;
case TAGS:
return VisualFeature.TAGS;
default:
throw LOGGER.logExceptionAsError(new RuntimeException(String.format(ENUM_EXTERNAL_ERROR_MSG, obj)));
}
return VisualFeature.fromString(obj.toString());
}

/**
Expand All @@ -51,26 +31,6 @@ public static com.azure.search.documents.indexes.implementation.models.VisualFea
if (obj == null) {
return null;
}
switch (obj) {
case ADULT:
return com.azure.search.documents.indexes.implementation.models.VisualFeature.ADULT;
case BRANDS:
return com.azure.search.documents.indexes.implementation.models.VisualFeature.BRANDS;
case CATEGORIES:
return com.azure.search.documents.indexes.implementation.models.VisualFeature.CATEGORIES;
case DESCRIPTION:
return com.azure.search.documents.indexes.implementation.models.VisualFeature.DESCRIPTION;
case FACES:
return com.azure.search.documents.indexes.implementation.models.VisualFeature.FACES;
case OBJECTS:
return com.azure.search.documents.indexes.implementation.models.VisualFeature.OBJECTS;
case TAGS:
return com.azure.search.documents.indexes.implementation.models.VisualFeature.TAGS;
default:
throw LOGGER.logExceptionAsError(new RuntimeException(String.format(ENUM_INTERNAL_ERROR_MSG, obj)));
}
}

private VisualFeatureConverter() {
return com.azure.search.documents.indexes.implementation.models.VisualFeature.fromString(obj.toString());
}
}
Loading