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

com.indeed.rabbitmq.admin.pojo.Policy Maven / Gradle / Ivy


package com.indeed.rabbitmq.admin.pojo;

import java.util.HashMap;
import java.util.Map;
import java.util.regex.Pattern;
import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyDescription;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.fasterxml.jackson.annotation.JsonValue;


/**
 * Describes a RabbitMQ policy on a set of exchanges or queues.
 * 
 */
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonPropertyOrder({
    "vhost",
    "name",
    "pattern",
    "apply-to",
    "definition",
    "priority"
})
public class Policy {

    /**
     * The virtual host that contains this policy.
     * 
     */
    @JsonProperty("vhost")
    @JsonPropertyDescription("The virtual host that contains this policy.")
    private String vhost;
    /**
     * The unique name of this policy.
     * 
     */
    @JsonProperty("name")
    @JsonPropertyDescription("The unique name of this policy.")
    private String name;
    /**
     * A pattern that matches the RabbitMQ entities to which this policy applies.
     * 
     */
    @JsonProperty("pattern")
    @JsonPropertyDescription("A pattern that matches the RabbitMQ entities to which this policy applies.")
    private Pattern pattern;
    /**
     * Indicates whether this policy applies to exchanges, queues or both.
     * 
     */
    @JsonProperty("apply-to")
    @JsonPropertyDescription("Indicates whether this policy applies to exchanges, queues or both.")
    private Policy.ApplyTo applyTo;
    /**
     * The definitions to apply to a RabbitMQ policy.
     * 
     */
    @JsonProperty("definition")
    @JsonPropertyDescription("The definitions to apply to a RabbitMQ policy.")
    private Definition definition;
    /**
     * The policy priority level.
     * 
     */
    @JsonProperty("priority")
    @JsonPropertyDescription("The policy priority level.")
    private Long priority;
    @JsonIgnore
    private Map additionalProperties = new HashMap();

    /**
     * The virtual host that contains this policy.
     * 
     */
    @JsonProperty("vhost")
    public String getVhost() {
        return vhost;
    }

    /**
     * The virtual host that contains this policy.
     * 
     */
    @JsonProperty("vhost")
    public void setVhost(String vhost) {
        this.vhost = vhost;
    }

    public Policy withVhost(String vhost) {
        this.vhost = vhost;
        return this;
    }

    /**
     * The unique name of this policy.
     * 
     */
    @JsonProperty("name")
    public String getName() {
        return name;
    }

    /**
     * The unique name of this policy.
     * 
     */
    @JsonProperty("name")
    public void setName(String name) {
        this.name = name;
    }

    public Policy withName(String name) {
        this.name = name;
        return this;
    }

    /**
     * A pattern that matches the RabbitMQ entities to which this policy applies.
     * 
     */
    @JsonProperty("pattern")
    public Pattern getPattern() {
        return pattern;
    }

    /**
     * A pattern that matches the RabbitMQ entities to which this policy applies.
     * 
     */
    @JsonProperty("pattern")
    public void setPattern(Pattern pattern) {
        this.pattern = pattern;
    }

    public Policy withPattern(Pattern pattern) {
        this.pattern = pattern;
        return this;
    }

    /**
     * Indicates whether this policy applies to exchanges, queues or both.
     * 
     */
    @JsonProperty("apply-to")
    public Policy.ApplyTo getApplyTo() {
        return applyTo;
    }

    /**
     * Indicates whether this policy applies to exchanges, queues or both.
     * 
     */
    @JsonProperty("apply-to")
    public void setApplyTo(Policy.ApplyTo applyTo) {
        this.applyTo = applyTo;
    }

    public Policy withApplyTo(Policy.ApplyTo applyTo) {
        this.applyTo = applyTo;
        return this;
    }

    /**
     * The definitions to apply to a RabbitMQ policy.
     * 
     */
    @JsonProperty("definition")
    public Definition getDefinition() {
        return definition;
    }

    /**
     * The definitions to apply to a RabbitMQ policy.
     * 
     */
    @JsonProperty("definition")
    public void setDefinition(Definition definition) {
        this.definition = definition;
    }

    public Policy withDefinition(Definition definition) {
        this.definition = definition;
        return this;
    }

    /**
     * The policy priority level.
     * 
     */
    @JsonProperty("priority")
    public Long getPriority() {
        return priority;
    }

    /**
     * The policy priority level.
     * 
     */
    @JsonProperty("priority")
    public void setPriority(Long priority) {
        this.priority = priority;
    }

    public Policy withPriority(Long priority) {
        this.priority = priority;
        return this;
    }

    @JsonAnyGetter
    public Map getAdditionalProperties() {
        return this.additionalProperties;
    }

    @JsonAnySetter
    public void setAdditionalProperty(String name, Object value) {
        this.additionalProperties.put(name, value);
    }

    public Policy withAdditionalProperty(String name, Object value) {
        this.additionalProperties.put(name, value);
        return this;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(Policy.class.getName()).append('@').append(Integer.toHexString(System.identityHashCode(this))).append('[');
        sb.append("vhost");
        sb.append('=');
        sb.append(((this.vhost == null)?"":this.vhost));
        sb.append(',');
        sb.append("name");
        sb.append('=');
        sb.append(((this.name == null)?"":this.name));
        sb.append(',');
        sb.append("pattern");
        sb.append('=');
        sb.append(((this.pattern == null)?"":this.pattern));
        sb.append(',');
        sb.append("applyTo");
        sb.append('=');
        sb.append(((this.applyTo == null)?"":this.applyTo));
        sb.append(',');
        sb.append("definition");
        sb.append('=');
        sb.append(((this.definition == null)?"":this.definition));
        sb.append(',');
        sb.append("priority");
        sb.append('=');
        sb.append(((this.priority == null)?"":this.priority));
        sb.append(',');
        sb.append("additionalProperties");
        sb.append('=');
        sb.append(((this.additionalProperties == null)?"":this.additionalProperties));
        sb.append(',');
        if (sb.charAt((sb.length()- 1)) == ',') {
            sb.setCharAt((sb.length()- 1), ']');
        } else {
            sb.append(']');
        }
        return sb.toString();
    }

    @Override
    public int hashCode() {
        int result = 1;
        result = ((result* 31)+((this.vhost == null)? 0 :this.vhost.hashCode()));
        result = ((result* 31)+((this.applyTo == null)? 0 :this.applyTo.hashCode()));
        result = ((result* 31)+((this.name == null)? 0 :this.name.hashCode()));
        result = ((result* 31)+((this.pattern == null)? 0 :this.pattern.hashCode()));
        result = ((result* 31)+((this.definition == null)? 0 :this.definition.hashCode()));
        result = ((result* 31)+((this.additionalProperties == null)? 0 :this.additionalProperties.hashCode()));
        result = ((result* 31)+((this.priority == null)? 0 :this.priority.hashCode()));
        return result;
    }

    @Override
    public boolean equals(Object other) {
        if (other == this) {
            return true;
        }
        if ((other instanceof Policy) == false) {
            return false;
        }
        Policy rhs = ((Policy) other);
        return ((((((((this.vhost == rhs.vhost)||((this.vhost!= null)&&this.vhost.equals(rhs.vhost)))&&((this.applyTo == rhs.applyTo)||((this.applyTo!= null)&&this.applyTo.equals(rhs.applyTo))))&&((this.name == rhs.name)||((this.name!= null)&&this.name.equals(rhs.name))))&&((this.pattern == rhs.pattern)||((this.pattern!= null)&&this.pattern.equals(rhs.pattern))))&&((this.definition == rhs.definition)||((this.definition!= null)&&this.definition.equals(rhs.definition))))&&((this.additionalProperties == rhs.additionalProperties)||((this.additionalProperties!= null)&&this.additionalProperties.equals(rhs.additionalProperties))))&&((this.priority == rhs.priority)||((this.priority!= null)&&this.priority.equals(rhs.priority))));
    }

    public enum ApplyTo {

        ALL("all"),
        EXCHANGES("exchanges"),
        QUEUES("queues");
        private final String value;
        private final static Map CONSTANTS = new HashMap();

        static {
            for (Policy.ApplyTo c: values()) {
                CONSTANTS.put(c.value, c);
            }
        }

        private ApplyTo(String value) {
            this.value = value;
        }

        @Override
        public String toString() {
            return this.value;
        }

        @JsonValue
        public String value() {
            return this.value;
        }

        @JsonCreator
        public static Policy.ApplyTo fromValue(String value) {
            Policy.ApplyTo constant = CONSTANTS.get(value);
            if (constant == null) {
                throw new IllegalArgumentException(value);
            } else {
                return constant;
            }
        }

    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy