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

com.okta.sdk.resource.model.PermissionConditions Maven / Gradle / Ivy

Go to download

The Okta Java SDK API .jar provides a Java API that your code can use to make calls to the Okta API. This .jar is the only compile-time dependency within the Okta SDK project that your code should depend on. Implementations of this API (implementation .jars) should be runtime dependencies only.

There is a newer version: 21.0.0
Show newest version
package com.okta.sdk.resource.model;

import java.util.Objects;
import java.util.Arrays;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
import java.util.HashMap;
import java.util.Map;
import org.openapitools.jackson.nullable.JsonNullable;
import com.fasterxml.jackson.annotation.JsonIgnore;
import org.openapitools.jackson.nullable.JsonNullable;
import java.util.NoSuchElementException;
import java.io.Serializable;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.fasterxml.jackson.annotation.JsonTypeName;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiModel;

/**
 * Conditions for further restricting a permission
 */
@ApiModel(description = "Conditions for further restricting a permission")
@JsonPropertyOrder({ PermissionConditions.JSON_PROPERTY_EXCLUDE, PermissionConditions.JSON_PROPERTY_INCLUDE })
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-11-15T08:48:47.130589-06:00[America/Chicago]", comments = "Generator version: 7.8.0")
public class PermissionConditions implements Serializable {

    private static final long serialVersionUID = 1L;

    public static final String JSON_PROPERTY_EXCLUDE = "exclude";
    private JsonNullable> exclude = JsonNullable.> undefined();

    public static final String JSON_PROPERTY_INCLUDE = "include";
    private JsonNullable> include = JsonNullable.> undefined();

    public PermissionConditions() {
    }

    public PermissionConditions exclude(Map exclude) {
        this.exclude = JsonNullable.> of(exclude);

        return this;
    }

    public PermissionConditions putexcludeItem(String key, Object excludeItem) {
        if (this.exclude == null || !this.exclude.isPresent()) {
            this.exclude = JsonNullable.> of(null);
        }
        try {
            this.exclude.get().put(key, excludeItem);
        } catch (java.util.NoSuchElementException e) {
            // this can never happen, as we make sure above that the value is present
        }
        return this;
    }

    /**
     * Exclude attributes with specific values for the permission
     *
     * @return exclude
     **/
    @javax.annotation.Nullable
    @ApiModelProperty(value = "Exclude attributes with specific values for the permission")
    @JsonIgnore

    public Map getExclude() {
        return exclude.orElse(null);
    }

    @JsonProperty(JSON_PROPERTY_EXCLUDE)
    @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

    public JsonNullable> getExclude_JsonNullable() {
        return exclude;
    }

    @JsonProperty(JSON_PROPERTY_EXCLUDE)
    public void setExclude_JsonNullable(JsonNullable> exclude) {
        this.exclude = exclude;
    }

    public void setExclude(Map exclude) {
        this.exclude = JsonNullable.> of(exclude);
    }

    public PermissionConditions include(Map include) {
        this.include = JsonNullable.> of(include);

        return this;
    }

    public PermissionConditions putincludeItem(String key, Object includeItem) {
        if (this.include == null || !this.include.isPresent()) {
            this.include = JsonNullable.> of(null);
        }
        try {
            this.include.get().put(key, includeItem);
        } catch (java.util.NoSuchElementException e) {
            // this can never happen, as we make sure above that the value is present
        }
        return this;
    }

    /**
     * Include attributes with specific values for the permission
     *
     * @return include
     **/
    @javax.annotation.Nullable
    @ApiModelProperty(value = "Include attributes with specific values for the permission")
    @JsonIgnore

    public Map getInclude() {
        return include.orElse(null);
    }

    @JsonProperty(JSON_PROPERTY_INCLUDE)
    @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

    public JsonNullable> getInclude_JsonNullable() {
        return include;
    }

    @JsonProperty(JSON_PROPERTY_INCLUDE)
    public void setInclude_JsonNullable(JsonNullable> include) {
        this.include = include;
    }

    public void setInclude(Map include) {
        this.include = JsonNullable.> of(include);
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        PermissionConditions permissionConditions = (PermissionConditions) o;
        return equalsNullable(this.exclude, permissionConditions.exclude)
                && equalsNullable(this.include, permissionConditions.include);
        // ;
    }

    private static  boolean equalsNullable(JsonNullable a, JsonNullable b) {
        return a == b
                || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get()));
    }

    @Override
    public int hashCode() {
        return Objects.hash(hashCodeNullable(exclude), hashCodeNullable(include));
    }

    private static  int hashCodeNullable(JsonNullable a) {
        if (a == null) {
            return 1;
        }
        return a.isPresent() ? Arrays.deepHashCode(new Object[] { a.get() }) : 31;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append("class PermissionConditions {\n");
        sb.append("    exclude: ").append(toIndentedString(exclude)).append("\n");
        sb.append("    include: ").append(toIndentedString(include)).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    ");
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy