If you think the Android project android-rackspacecloud listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
Java Source Code
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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
*//fromwww.java2s.com
* 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 net.elasticgrid.rackspace.cloudservers;
import java.io.*;
import java.util.*;
/**
* Rackspace API limits.
* @author Jerome Bernard
*/publicclass Limits implements Serializable {
privatefinal List<RateLimit> rateLimits;
privatefinal List<AbsoluteLimit> absoluteLimits;
public Limits(List<RateLimit> rateLimits, List<AbsoluteLimit> absoluteLimits) {
this.rateLimits = Collections.unmodifiableList(rateLimits);
this.absoluteLimits = Collections.unmodifiableList(absoluteLimits);
}
public List<RateLimit> getRateLimits() {
return rateLimits;
}
public List<AbsoluteLimit> getAbsoluteLimits() {
return absoluteLimits;
}
}
class RateLimit implements Serializable {
privatefinal HTTPVerb verb;
privatefinal String URI;
privatefinal String regex;
privatefinalint value;
privatefinalint remaining;
privatefinal RateLimit.Unit unit;
privatefinallong resetTime;
RateLimit(HTTPVerb verb, String URI, String regex, int value, int remaining, RateLimit.Unit unit, long resetTime) {
this.verb = verb;
this.URI = URI;
this.regex = regex;
this.value = value;
this.remaining = remaining;
this.unit = unit;
this.resetTime = resetTime;
}
public HTTPVerb getVerb() {
return verb;
}
public String getURI() {
return URI;
}
public String getRegex() {
return regex;
}
publicint getValue() {
return value;
}
publicint getRemaining() {
return remaining;
}
public RateLimit.Unit getUnit() {
return unit;
}
publiclong getResetTime() {
return resetTime;
}
@Override
public String toString() {
final StringBuilder sb = new StringBuilder();
sb.append("RateLimit");
sb.append("{verb=").append(verb);
sb.append(", URI='").append(URI).append('\'');
sb.append(", regex='").append(regex).append('\'');
sb.append(", value=").append(value);
sb.append(", remaining=").append(remaining);
sb.append(", unit=").append(unit);
sb.append(", resetTime=").append(resetTime);
sb.append('}');
return sb.toString();
}
enum Unit implements Serializable {
MINUTE, HOUR, DAY
}
}
class AbsoluteLimit implements Serializable {
privatefinal String name;
privatefinalint value;
public AbsoluteLimit(String name, int value) {
this.name = name;
this.value = value;
}
public String getName() {
return name;
}
publicint getValue() {
return value;
}
@Override
public String toString() {
final StringBuilder sb = new StringBuilder();
sb.append("AbsoluteLimit");
sb.append("{name='").append(name).append('\'');
sb.append(", value=").append(value);
sb.append('}');
return sb.toString();
}
}