![JAR search and dependency download from the Maven repository](/logo.png)
io.apiman.gateway.engine.beans.Client Maven / Gradle / Ivy
/*
* Copyright 2014 JBoss Inc
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.apiman.gateway.engine.beans;
import java.io.Serializable;
import java.util.Collection;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
/**
* Models a Client registered with the API Management runtime.
*
* @author [email protected]
*/
public class Client implements Serializable {
private static final long serialVersionUID = 4515000941548789924L;
private String organizationId;
private String clientId;
private String version;
private String apiKey;
private Set contracts = new HashSet<>();
/**
* Constructor.
*/
public Client() {
}
/**
* @return the organizationId
*/
public String getOrganizationId() {
return organizationId;
}
/**
* @param organizationId the organizationId to set
*/
public void setOrganizationId(String organizationId) {
this.organizationId = organizationId;
}
/**
* @return the clientId
*/
public String getClientId() {
return clientId;
}
/**
* @param clientId the clientId to set
*/
public void setClientId(String clientId) {
this.clientId = clientId;
}
/**
* @return the version
*/
public String getVersion() {
return version;
}
/**
* @param version the version to set
*/
public void setVersion(String version) {
this.version = version;
}
/**
* @return the contracts
*/
public Set getContracts() {
return contracts;
}
/**
* @param contract the contract to add
*/
public void addContract(Contract contract) {
contracts.add(contract);
}
/**
* @param contracts the contracts to set
*/
public void setContracts(Set contracts) {
this.contracts = contracts;
}
/**
* @see java.lang.Object#hashCode()
*/
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((organizationId == null) ? 0 : organizationId.hashCode());
result = prime * result + ((getClientId() == null) ? 0 : getClientId().hashCode());
result = prime * result + ((version == null) ? 0 : version.hashCode());
return result;
}
/**
* @see java.lang.Object#equals(java.lang.Object)
*/
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Client other = (Client) obj;
if (organizationId == null) {
if (other.organizationId != null)
return false;
} else if (!organizationId.equals(other.organizationId))
return false;
if (getClientId() == null) {
if (other.getClientId() != null)
return false;
} else if (!getClientId().equals(other.getClientId()))
return false;
if (version == null) {
if (other.version != null)
return false;
} else if (!version.equals(other.version))
return false;
return true;
}
/* (non-Javadoc)
* @see java.lang.Object#toString()
*/
@SuppressWarnings("nls")
@Override
public String toString() {
final int maxLen = 10;
return "Client [organizationId=" + organizationId + ", clientId=" + clientId
+ ", version=" + version + ", contracts="
+ (contracts != null ? toString(contracts, maxLen) : null) + "]";
}
@SuppressWarnings("nls")
private String toString(Collection> collection, int maxLen) {
StringBuilder builder = new StringBuilder();
builder.append("[");
int i = 0;
for (Iterator> iterator = collection.iterator(); iterator.hasNext() && i < maxLen; i++) {
if (i > 0)
builder.append(", ");
builder.append(iterator.next());
}
builder.append("]");
return builder.toString();
}
/**
* @return the apiKey
*/
public String getApiKey() {
return apiKey;
}
/**
* @param apiKey the apiKey to set
*/
public void setApiKey(String apiKey) {
this.apiKey = apiKey;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy