All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.huaweicloud.sdk.imagesearch.v2.model.AddDataParam Maven / Gradle / Ivy

There is a newer version: 3.1.114
Show newest version
package com.huaweicloud.sdk.imagesearch.v2.model;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.function.Consumer;

/**
 * AddDataParam
 */
public class AddDataParam {

    @JsonInclude(JsonInclude.Include.NON_NULL)
    @JsonProperty(value = "force")

    private Boolean force;

    @JsonInclude(JsonInclude.Include.NON_NULL)
    @JsonProperty(value = "item_id")

    private String itemId;

    @JsonInclude(JsonInclude.Include.NON_NULL)
    @JsonProperty(value = "desc")

    private String desc;

    @JsonInclude(JsonInclude.Include.NON_NULL)
    @JsonProperty(value = "custom_tags")

    private Map customTags = null;

    @JsonInclude(JsonInclude.Include.NON_NULL)
    @JsonProperty(value = "custom_num_tags")

    private Map customNumTags = null;

    @JsonInclude(JsonInclude.Include.NON_NULL)
    @JsonProperty(value = "image_base64")

    private String imageBase64;

    @JsonInclude(JsonInclude.Include.NON_NULL)
    @JsonProperty(value = "image_url")

    private String imageUrl;

    @JsonInclude(JsonInclude.Include.NON_NULL)
    @JsonProperty(value = "keywords")

    private List keywords = null;

    @JsonInclude(JsonInclude.Include.NON_NULL)
    @JsonProperty(value = "optional_params")

    private AddDataOptionalParam optionalParams;

    public AddDataParam withForce(Boolean force) {
        this.force = force;
        return this;
    }

    /**
     * 是否强制添加数据,默认为false。 - false: 数据已存在则不进行添加。 - true: 数据已存在仍然覆盖添加。
     * @return force
     */
    public Boolean getForce() {
        return force;
    }

    public void setForce(Boolean force) {
        this.force = force;
    }

    public AddDataParam withItemId(String itemId) {
        this.itemId = itemId;
        return this;
    }

    /**
     * 数据的服务实例级唯一标识,字符长度范围为[1, 256]。
     * @return itemId
     */
    public String getItemId() {
        return itemId;
    }

    public void setItemId(String itemId) {
        this.itemId = itemId;
    }

    public AddDataParam withDesc(String desc) {
        this.desc = desc;
        return this;
    }

    /**
     * 数据的描述信息,字符长度范围为[1, 2048]。
     * @return desc
     */
    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }

    public AddDataParam withCustomTags(Map customTags) {
        this.customTags = customTags;
        return this;
    }

    public AddDataParam putCustomTagsItem(String key, String customTagsItem) {
        if (this.customTags == null) {
            this.customTags = new HashMap<>();
        }
        this.customTags.put(key, customTagsItem);
        return this;
    }

    public AddDataParam withCustomTags(Consumer> customTagsSetter) {
        if (this.customTags == null) {
            this.customTags = new HashMap<>();
        }
        customTagsSetter.accept(this.customTags);
        return this;
    }

    /**
     * 数据的自定义字符标签,用于进行条件过滤。格式为键值对{key:value}。 - key: 必须为服务实例custom_tags中已存在的key,可在创建服务实例时进行配置,或在更新服务实例时进行新增。 - value: 类型为字符串,字符长度范围为[1, 64]。
     * @return customTags
     */
    public Map getCustomTags() {
        return customTags;
    }

    public void setCustomTags(Map customTags) {
        this.customTags = customTags;
    }

    public AddDataParam withCustomNumTags(Map customNumTags) {
        this.customNumTags = customNumTags;
        return this;
    }

    public AddDataParam putCustomNumTagsItem(String key, Double customNumTagsItem) {
        if (this.customNumTags == null) {
            this.customNumTags = new HashMap<>();
        }
        this.customNumTags.put(key, customNumTagsItem);
        return this;
    }

    public AddDataParam withCustomNumTags(Consumer> customNumTagsSetter) {
        if (this.customNumTags == null) {
            this.customNumTags = new HashMap<>();
        }
        customNumTagsSetter.accept(this.customNumTags);
        return this;
    }

    /**
     * 数据的自定义数值标签,用于进行条件过滤。格式为键值对{key:value}。 - key: 必须为服务实例custom_num_tags中已存在的key,可在创建服务实例时进行配置,或在更新服务实例时进行新增。 - value: 类型为数值,格式为double。
     * @return customNumTags
     */
    public Map getCustomNumTags() {
        return customNumTags;
    }

    public void setCustomNumTags(Map customNumTags) {
        this.customNumTags = customNumTags;
    }

    public AddDataParam withImageBase64(String imageBase64) {
        this.imageBase64 = imageBase64;
        return this;
    }

    /**
     * 图像文件的base64字符串,图像入库时,与image_url二选一。要求如下: - 格式:目前仅支持JPEG/JPG/PNG/BMP/WEBP格式的图像。 - 大小:图像文件大小要求不超过5M。 - 尺寸:默认情况下,要求图像的最短边大于64px,最长边小于4096px。部分服务类型有特殊要求,可参见服务类型说明。 - 其他:图片中不能包含旋转信息。
     * @return imageBase64
     */
    public String getImageBase64() {
        return imageBase64;
    }

    public void setImageBase64(String imageBase64) {
        this.imageBase64 = imageBase64;
    }

    public AddDataParam withImageUrl(String imageUrl) {
        this.imageUrl = imageUrl;
        return this;
    }

    /**
     * 图像文件的服务可访问URL,字符长度范围为[1, 4096]。图像入库时,与image_base64二选一。
     * @return imageUrl
     */
    public String getImageUrl() {
        return imageUrl;
    }

    public void setImageUrl(String imageUrl) {
        this.imageUrl = imageUrl;
    }

    public AddDataParam withKeywords(List keywords) {
        this.keywords = keywords;
        return this;
    }

    public AddDataParam addKeywordsItem(String keywordsItem) {
        if (this.keywords == null) {
            this.keywords = new ArrayList<>();
        }
        this.keywords.add(keywordsItem);
        return this;
    }

    public AddDataParam withKeywords(Consumer> keywordsSetter) {
        if (this.keywords == null) {
            this.keywords = new ArrayList<>();
        }
        keywordsSetter.accept(this.keywords);
        return this;
    }

    /**
     * 关键词列表,关键词数量范围为[1, 100],关键词字符长度范围为[1, 64]。支持关键词搜索的服务实例添加数据时,如给定此参数,则直接使用给定的keywords作为关键词,否则会自动生成对应的keywords。
     * @return keywords
     */
    public List getKeywords() {
        return keywords;
    }

    public void setKeywords(List keywords) {
        this.keywords = keywords;
    }

    public AddDataParam withOptionalParams(AddDataOptionalParam optionalParams) {
        this.optionalParams = optionalParams;
        return this;
    }

    public AddDataParam withOptionalParams(Consumer optionalParamsSetter) {
        if (this.optionalParams == null) {
            this.optionalParams = new AddDataOptionalParam();
            optionalParamsSetter.accept(this.optionalParams);
        }

        return this;
    }

    /**
     * Get optionalParams
     * @return optionalParams
     */
    public AddDataOptionalParam getOptionalParams() {
        return optionalParams;
    }

    public void setOptionalParams(AddDataOptionalParam optionalParams) {
        this.optionalParams = optionalParams;
    }

    @Override
    public boolean equals(java.lang.Object obj) {
        if (this == obj) {
            return true;
        }
        if (obj == null || getClass() != obj.getClass()) {
            return false;
        }
        AddDataParam that = (AddDataParam) obj;
        return Objects.equals(this.force, that.force) && Objects.equals(this.itemId, that.itemId)
            && Objects.equals(this.desc, that.desc) && Objects.equals(this.customTags, that.customTags)
            && Objects.equals(this.customNumTags, that.customNumTags)
            && Objects.equals(this.imageBase64, that.imageBase64) && Objects.equals(this.imageUrl, that.imageUrl)
            && Objects.equals(this.keywords, that.keywords) && Objects.equals(this.optionalParams, that.optionalParams);
    }

    @Override
    public int hashCode() {
        return Objects
            .hash(force, itemId, desc, customTags, customNumTags, imageBase64, imageUrl, keywords, optionalParams);
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append("class AddDataParam {\n");
        sb.append("    force: ").append(toIndentedString(force)).append("\n");
        sb.append("    itemId: ").append(toIndentedString(itemId)).append("\n");
        sb.append("    desc: ").append(toIndentedString(desc)).append("\n");
        sb.append("    customTags: ").append(toIndentedString(customTags)).append("\n");
        sb.append("    customNumTags: ").append(toIndentedString(customNumTags)).append("\n");
        sb.append("    imageBase64: ").append(toIndentedString(imageBase64)).append("\n");
        sb.append("    imageUrl: ").append(toIndentedString(imageUrl)).append("\n");
        sb.append("    keywords: ").append(toIndentedString(keywords)).append("\n");
        sb.append("    optionalParams: ").append(toIndentedString(optionalParams)).append("\n");
        sb.append("}");
        return sb.toString();
    }

    /**
     * Convert the given object to string with each line indented by 4 spaces
     * (except the first line).
     */
    private String toIndentedString(java.lang.Object o) {
        if (o == null) {
            return "null";
        }
        return o.toString().replace("\n", "\n    ");
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy