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

com.dell.cpsd.vcenter.capabilities.api.Query Maven / Gradle / Ivy

Go to download

This repository contains the source code for the virtualization capabilities API. This repository is used to define a data contract in JSON that is agnostic of the Adapter.

The newest version!

package com.dell.cpsd.vcenter.capabilities.api;

import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;
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.JsonPropertyOrder;
import com.fasterxml.jackson.annotation.JsonValue;
import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.commons.lang3.builder.ToStringBuilder;

@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonPropertyOrder({
    "field",
    "type",
    "value"
})
public class Query implements Serializable
{

    /**
     * 
     * (Required)
     * 
     */
    @JsonProperty("field")
    private Query.Field field;
    /**
     * 
     * (Required)
     * 
     */
    @JsonProperty("type")
    private Query.Type type;
    /**
     * 
     * (Required)
     * 
     */
    @JsonProperty("value")
    private String value;
    @JsonIgnore
    private Map additionalProperties = new HashMap();
    private final static long serialVersionUID = 6642751992358643287L;

    /**
     * No args constructor for use in serialization
     * 
     */
    public Query() {
    }

    /**
     * 
     * @param field
     * @param type
     * @param value
     */
    public Query(Query.Field field, Query.Type type, String value) {
        super();
        this.field = field;
        this.type = type;
        this.value = value;
    }

    /**
     * 
     * (Required)
     * 
     */
    @JsonProperty("field")
    public Query.Field getField() {
        return field;
    }

    /**
     * 
     * (Required)
     * 
     */
    @JsonProperty("field")
    public void setField(Query.Field field) {
        this.field = field;
    }

    /**
     * 
     * (Required)
     * 
     */
    @JsonProperty("type")
    public Query.Type getType() {
        return type;
    }

    /**
     * 
     * (Required)
     * 
     */
    @JsonProperty("type")
    public void setType(Query.Type type) {
        this.type = type;
    }

    /**
     * 
     * (Required)
     * 
     */
    @JsonProperty("value")
    public String getValue() {
        return value;
    }

    /**
     * 
     * (Required)
     * 
     */
    @JsonProperty("value")
    public void setValue(String value) {
        this.value = value;
    }

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

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

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

    @Override
    public int hashCode() {
        return new HashCodeBuilder().append(field).append(type).append(value).append(additionalProperties).toHashCode();
    }

    @Override
    public boolean equals(Object other) {
        if (other == this) {
            return true;
        }
        if ((other instanceof Query) == false) {
            return false;
        }
        Query rhs = ((Query) other);
        return new EqualsBuilder().append(field, rhs.field).append(type, rhs.type).append(value, rhs.value).append(additionalProperties, rhs.additionalProperties).isEquals();
    }

    public enum Field {

        IP("ip"),
        NAME("name"),
        ID("id");
        private final String value;
        private final static Map CONSTANTS = new HashMap();

        static {
            for (Query.Field c: values()) {
                CONSTANTS.put(c.value, c);
            }
        }

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

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

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

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

    }

    public enum Type {

        STRING("string"),
        REGEX("regex");
        private final String value;
        private final static Map CONSTANTS = new HashMap();

        static {
            for (Query.Type c: values()) {
                CONSTANTS.put(c.value, c);
            }
        }

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

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

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

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

    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy