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

brooklyn.rest.domain.UsageStatistics Maven / Gradle / Ivy

The newest version!
package brooklyn.rest.domain;

import java.net.URI;
import java.util.List;
import java.util.Map;

import org.codehaus.jackson.annotate.JsonProperty;

import com.google.common.base.Objects;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;

/**
 * @author Aled Sage
 */
public class UsageStatistics {
    
    // TODO populate links with /apps endpoint to link to /usage/applications/{id}, to make it more RESTy
    
    private final List statistics;
    private final Map links;

    public UsageStatistics(
            @JsonProperty("statistics") List statistics,
            @JsonProperty("links") Map links
    ) {
        this.statistics = statistics == null ? ImmutableList.of() : ImmutableList.copyOf(statistics);
        this.links = links == null ? ImmutableMap.of() : ImmutableMap.copyOf(links);
      }

    public List getStatistics() {
        return statistics;
    }

    public Map getLinks() {
        return links;
    }
    
    @Override
    public boolean equals(Object o) {
        if (!(o instanceof UsageStatistics)) return false;
        UsageStatistics other = (UsageStatistics) o;
        return Objects.equal(statistics,  other.statistics);
    }

    @Override
    public int hashCode() {
        return Objects.hashCode(statistics);
    }

    @Override
    public String toString() {
        return "UsageStatistics{" +
                "statistics=" + statistics +
                ", links=" + links +
                '}';
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy