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

org.openziti.edge.model.PostureResponseMacAddressCreate Maven / Gradle / Ivy

The newest version!
/*
 * Ziti Edge Client
 * OpenZiti Edge Client API
 *
 * The version of the OpenAPI document: 0.26.27
 * Contact: [email protected]
 *
 * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
 * https://openapi-generator.tech
 * Do not edit the class manually.
 */

package org.openziti.edge.model;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.StringJoiner;
import org.openziti.edge.ApiClient;
import org.openziti.edge.JSON;

/** PostureResponseMacAddressCreate */
@JsonPropertyOrder({PostureResponseMacAddressCreate.JSON_PROPERTY_MAC_ADDRESSES})
@javax.annotation.Generated(
        value = "org.openapitools.codegen.languages.JavaClientCodegen",
        date = "2024-09-04T10:11:22.635226-04:00[America/New_York]",
        comments = "Generator version: 7.8.0")
@JsonIgnoreProperties(
        value = "typeId", // ignore manually set typeId, it will be automatically generated by
        // Jackson during serialization
        allowSetters = true // allows the typeId to be set during deserialization
        )
@JsonTypeInfo(
        use = JsonTypeInfo.Id.NAME,
        include = JsonTypeInfo.As.PROPERTY,
        property = "typeId",
        visible = true)
public class PostureResponseMacAddressCreate extends PostureResponseCreate {
    public static final String JSON_PROPERTY_MAC_ADDRESSES = "macAddresses";
    private List macAddresses = new ArrayList<>();

    public PostureResponseMacAddressCreate() {}

    public PostureResponseMacAddressCreate macAddresses(List macAddresses) {
        this.macAddresses = macAddresses;
        return this;
    }

    public PostureResponseMacAddressCreate addMacAddressesItem(String macAddressesItem) {
        if (this.macAddresses == null) {
            this.macAddresses = new ArrayList<>();
        }
        this.macAddresses.add(macAddressesItem);
        return this;
    }

    /**
     * Get macAddresses
     *
     * @return macAddresses
     */
    @javax.annotation.Nonnull
    @JsonProperty(JSON_PROPERTY_MAC_ADDRESSES)
    @JsonInclude(value = JsonInclude.Include.ALWAYS)
    public List getMacAddresses() {
        return macAddresses;
    }

    @JsonProperty(JSON_PROPERTY_MAC_ADDRESSES)
    @JsonInclude(value = JsonInclude.Include.ALWAYS)
    public void setMacAddresses(List macAddresses) {
        this.macAddresses = macAddresses;
    }

    @Override
    public PostureResponseMacAddressCreate id(String id) {
        this.setId(id);
        return this;
    }

    @Override
    public PostureResponseMacAddressCreate typeId(PostureCheckType typeId) {
        this.setTypeId(typeId);
        return this;
    }

    /** Return true if this postureResponseMacAddressCreate object is equal to o. */
    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        PostureResponseMacAddressCreate postureResponseMacAddressCreate =
                (PostureResponseMacAddressCreate) o;
        return Objects.equals(this.macAddresses, postureResponseMacAddressCreate.macAddresses)
                && super.equals(o);
    }

    @Override
    public int hashCode() {
        return Objects.hash(macAddresses, super.hashCode());
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append("class PostureResponseMacAddressCreate {\n");
        sb.append("    ").append(toIndentedString(super.toString())).append("\n");
        sb.append("    macAddresses: ").append(toIndentedString(macAddresses)).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(Object o) {
        if (o == null) {
            return "null";
        }
        return o.toString().replace("\n", "\n    ");
    }

    /**
     * Convert the instance into URL query string.
     *
     * @return URL query string
     */
    public String toUrlQueryString() {
        return toUrlQueryString(null);
    }

    /**
     * Convert the instance into URL query string.
     *
     * @param prefix prefix of the query string
     * @return URL query string
     */
    public String toUrlQueryString(String prefix) {
        String suffix = "";
        String containerSuffix = "";
        String containerPrefix = "";
        if (prefix == null) {
            // style=form, explode=true, e.g. /pet?name=cat&type=manx
            prefix = "";
        } else {
            // deepObject style e.g. /pet?id[name]=cat&id[type]=manx
            prefix = prefix + "[";
            suffix = "]";
            containerSuffix = "]";
            containerPrefix = "[";
        }

        StringJoiner joiner = new StringJoiner("&");

        // add `id` to the URL query string
        if (getId() != null) {
            joiner.add(
                    String.format(
                            "%sid%s=%s",
                            prefix,
                            suffix,
                            URLEncoder.encode(
                                            ApiClient.valueToString(getId()),
                                            StandardCharsets.UTF_8)
                                    .replaceAll("\\+", "%20")));
        }

        // add `typeId` to the URL query string
        if (getTypeId() != null) {
            joiner.add(
                    String.format(
                            "%stypeId%s=%s",
                            prefix,
                            suffix,
                            URLEncoder.encode(
                                            ApiClient.valueToString(getTypeId()),
                                            StandardCharsets.UTF_8)
                                    .replaceAll("\\+", "%20")));
        }

        // add `macAddresses` to the URL query string
        if (getMacAddresses() != null) {
            for (int i = 0; i < getMacAddresses().size(); i++) {
                joiner.add(
                        String.format(
                                "%smacAddresses%s%s=%s",
                                prefix,
                                suffix,
                                "".equals(suffix)
                                        ? ""
                                        : String.format(
                                                "%s%d%s", containerPrefix, i, containerSuffix),
                                URLEncoder.encode(
                                                ApiClient.valueToString(getMacAddresses().get(i)),
                                                StandardCharsets.UTF_8)
                                        .replaceAll("\\+", "%20")));
            }
        }

        return joiner.toString();
    }

    static {
        // Initialize and register the discriminator mappings.
        Map> mappings = new HashMap>();
        mappings.put("postureResponseMacAddressCreate", PostureResponseMacAddressCreate.class);
        JSON.registerDiscriminator(PostureResponseMacAddressCreate.class, "typeId", mappings);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy