package geniusweb.partiesserver.repository; import java.net.URI; import com.fasterxml.jackson.annotation.JsonAutoDetect; import com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility; import geniusweb.party.Capabilities; /** * Contains general info about party that can be collected from a party after it * was instantiated */ @JsonAutoDetect(fieldVisibility = Visibility.ANY, getterVisibility = Visibility.NONE, setterVisibility = Visibility.NONE) public class GeneralPartyInfo { private final URI uri; private final Capabilities capabilities; private final String description; private GeneralPartyInfo() { uri = null; capabilities = null; description = null; } public GeneralPartyInfo(URI iri, Capabilities caps, String descr) { this.uri = iri; this.capabilities = caps; this.description = descr; } /** * @return the URI used to create a new instance of this party. */ public URI getURI() { return uri; } public Capabilities getCapabilities() { return capabilities; } public String getDescription() { return description; } @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((capabilities == null) ? 0 : capabilities.hashCode()); result = prime * result + ((description == null) ? 0 : description.hashCode()); result = prime * result + ((uri == null) ? 0 : uri.hashCode()); return result; } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; GeneralPartyInfo other = (GeneralPartyInfo) obj; if (capabilities == null) { if (other.capabilities != null) return false; } else if (!capabilities.equals(other.capabilities)) return false; if (description == null) { if (other.description != null) return false; } else if (!description.equals(other.description)) return false; if (uri == null) { if (other.uri != null) return false; } else if (!uri.equals(other.uri)) return false; return true; } @Override public String toString() { return "GeneralPartyInfo[" + uri + "," + capabilities + "," + description + "]"; } }