/*
* 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.manager.api.beans.apis;
import java.io.Serializable;
import java.util.Collection;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
/**
* Bean used when updating a version of an API.
*
* @author eric.wittmann@redhat.com
*/
@JsonInclude(Include.NON_NULL)
public class UpdateApiVersionBean implements Serializable {
private static final long serialVersionUID = 4126848584932708146L;
private String endpoint;
private EndpointType endpointType;
private EndpointContentType endpointContentType;
private Map<String, String> endpointProperties;
private Set<ApiGatewayBean> gateways;
private Boolean parsePayload;
private Boolean publicAPI;
private Set<ApiPlanBean> plans;
/**
* Constructor.
*/
public UpdateApiVersionBean() {
}
/**
* @return the endpoint
*/
public String getEndpoint() {
return endpoint;
}
/**
* @param endpoint the endpoint to set
*/
public void setEndpoint(String endpoint) {
this.endpoint = endpoint;
}
/**
* @return the endpointType
*/
public EndpointType getEndpointType() {
return endpointType;
}
/**
* @param endpointType the endpointType to set
*/
public void setEndpointType(EndpointType endpointType) {
this.endpointType = endpointType;
}
/**
* @return the gateways
*/
public Set<ApiGatewayBean> getGateways() {
return gateways;
}
/**
* @param gateways the gateways to set
*/
public void setGateways(Set<ApiGatewayBean> gateways) {
this.gateways = gateways;
}
/**
* @return the publicAPI
*/
public Boolean getPublicAPI() {
return publicAPI;
}
/**
* @param publicAPI the publicAPI to set
*/
public void setPublicAPI(Boolean publicAPI) {
this.publicAPI = publicAPI;
}
/**
* @return the plans
*/
public Set<ApiPlanBean> getPlans() {
return plans;
}
/**
* @param plans the plans to set
*/
public void setPlans(Set<ApiPlanBean> plans) {
this.plans = plans;
}
/**
* @return the endpointProperties
*/
public Map<String, String> getEndpointProperties() {
return endpointProperties;
}
/**
* @param endpointProperties the endpointProperties to set
*/
public void setEndpointProperties(Map<String, String> endpointProperties) {
this.endpointProperties = endpointProperties;
}
/**
* @return the endpointContentType
*/
public EndpointContentType getEndpointContentType() {
return endpointContentType;
}
/**
* @param endpointContentType the endpointContentType to set
*/
public void setEndpointContentType(EndpointContentType endpointContentType) {
this.endpointContentType = endpointContentType;
}
/**
* @return the parsePayload
*/
public Boolean getParsePayload() {
return parsePayload;
}
/**
* @param parsePayload the parsePayload to set
*/
public void setParsePayload(Boolean parsePayload) {
this.parsePayload = parsePayload;
}
/* (non-Javadoc)
* @see java.lang.Object#toString()
*/
@Override
@SuppressWarnings("nls")
public String toString() {
final int maxLen = 10;
return "UpdateApiVersionBean [endpoint=" + endpoint + ", endpointType=" + endpointType
+ ", endpointProperties=" + toString(this.endpointProperties.entrySet(), maxLen)
+ ", gateways=" + (gateways != null ? toString(gateways, maxLen) : null) + ", publicAPI="
+ publicAPI + ", plans=" + (plans != null ? toString(plans, 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();
}
}