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

com.dell.cpsd.identity.service.api.BusinessKey Maven / Gradle / Ivy

The newest version!

package com.dell.cpsd.identity.service.api;

import java.util.HashMap;
import java.util.Map;
import com.fasterxml.jackson.annotation.JsonCreator;
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({
    "businessKeyType",
    "key",
    "value"
})
public class BusinessKey {

    /**
     * 
     * (Required)
     * 
     */
    @JsonProperty("businessKeyType")
    private BusinessKey.BusinessKeyType businessKeyType;
    /**
     * 
     * (Required)
     * 
     */
    @JsonProperty("key")
    private String key;
    /**
     * 
     * (Required)
     * 
     */
    @JsonProperty("value")
    private String value;

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

    /**
     * 
     * @param businessKeyType
     * @param value
     * @param key
     */
    public BusinessKey(BusinessKey.BusinessKeyType businessKeyType, String key, String value) {
        super();
        this.businessKeyType = businessKeyType;
        this.key = key;
        this.value = value;
    }

    /**
     * 
     * (Required)
     * 
     * @return
     *     The businessKeyType
     */
    @JsonProperty("businessKeyType")
    public BusinessKey.BusinessKeyType getBusinessKeyType() {
        return businessKeyType;
    }

    /**
     * 
     * (Required)
     * 
     * @param businessKeyType
     *     The businessKeyType
     */
    @JsonProperty("businessKeyType")
    public void setBusinessKeyType(BusinessKey.BusinessKeyType businessKeyType) {
        this.businessKeyType = businessKeyType;
    }

    /**
     * 
     * (Required)
     * 
     * @return
     *     The key
     */
    @JsonProperty("key")
    public String getKey() {
        return key;
    }

    /**
     * 
     * (Required)
     * 
     * @param key
     *     The key
     */
    @JsonProperty("key")
    public void setKey(String key) {
        this.key = key;
    }

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

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

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

    @Override
    public int hashCode() {
        return new HashCodeBuilder().append(businessKeyType).append(key).append(value).toHashCode();
    }

    @Override
    public boolean equals(Object other) {
        if (other == this) {
            return true;
        }
        if ((other instanceof BusinessKey) == false) {
            return false;
        }
        BusinessKey rhs = ((BusinessKey) other);
        return new EqualsBuilder().append(businessKeyType, rhs.businessKeyType).append(key, rhs.key).append(value, rhs.value).isEquals();
    }

    public enum BusinessKeyType {

        CONTEXTUAL("CONTEXTUAL"),
        ASSOCIATION("ASSOCIATION"),
        ABSOLUTE("ABSOLUTE");
        private final String value;
        private final static Map CONSTANTS = new HashMap();

        static {
            for (BusinessKey.BusinessKeyType c: values()) {
                CONSTANTS.put(c.value, c);
            }
        }

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

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

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

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

    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy