public Resource build() { if (built) throw new IllegalStateException("Resource already built"); built = true; resource.setCapabilities(capabilities); resource.setRequirements(requirements); return resource; }
@Override public int hashCode() { return getContentURIs().hashCode(); }
@Override public String toString() { final StringBuilder builder = new StringBuilder(); List<Capability> identities = getCapabilities(IdentityNamespace.IDENTITY_NAMESPACE); if (identities != null && identities.size() == 1) { Capability idCap = identities.get(0); Object id = idCap.getAttributes().get(IdentityNamespace.IDENTITY_NAMESPACE); Object version = idCap.getAttributes().get(IdentityNamespace.CAPABILITY_VERSION_ATTRIBUTE); builder.append(id).append(" version=").append(version); } else { // Generic toString builder.append("ResourceImpl [caps="); builder.append(allCapabilities); builder.append(", reqs="); builder.append(allRequirements); builder.append("]"); } return builder.toString(); }
@Override public String toString() { final StringBuilder builder = new StringBuilder(); List<Capability> identities = getCapabilities(IdentityNamespace.IDENTITY_NAMESPACE); if (identities != null && identities.size() == 1) { Capability idCap = identities.get(0); Object id = idCap.getAttributes().get(IdentityNamespace.IDENTITY_NAMESPACE); Object version = idCap.getAttributes().get(IdentityNamespace.CAPABILITY_VERSION_ATTRIBUTE); builder.append(id).append(" ver=").append(version); } else { // Generic toString builder.append("ResourceImpl [caps="); builder.append(allCapabilities); builder.append(", reqs="); builder.append(allRequirements); builder.append("]"); } return builder.toString(); }
public Resource build() { if (built) throw new IllegalStateException("Resource already built"); built = true; resource.setCapabilities(capabilities); resource.setRequirements(requirements); return resource; }
@Override public String toString() { final StringBuilder builder = new StringBuilder(); List<Capability> identities = getCapabilities(IdentityNamespace.IDENTITY_NAMESPACE); if (identities != null && identities.size() == 1) { Capability idCap = identities.get(0); Object id = idCap.getAttributes().get(IdentityNamespace.IDENTITY_NAMESPACE); Object version = idCap.getAttributes().get(IdentityNamespace.CAPABILITY_VERSION_ATTRIBUTE); builder.append(id).append(" version=").append(version); } else { // Generic toString builder.append("ResourceImpl [caps="); builder.append(allCapabilities); builder.append(", reqs="); builder.append(allRequirements); builder.append("]"); } return builder.toString(); }
@Override public int hashCode() { return getContentURIs().hashCode(); }
public Resource build() { if (built) throw new IllegalStateException("Resource already built"); built = true; resource.setCapabilities(capabilities); resource.setRequirements(requirements); return resource; }
@Override public String toString() { final StringBuilder builder = new StringBuilder(); List<Capability> identities = getCapabilities(IdentityNamespace.IDENTITY_NAMESPACE); if (identities.size() == 1) { Capability idCap = identities.get(0); Object id = idCap.getAttributes() .get(IdentityNamespace.IDENTITY_NAMESPACE); builder.append(id); Object version = idCap.getAttributes() .get(IdentityNamespace.CAPABILITY_VERSION_ATTRIBUTE); if (version != null) { builder.append(" version=") .append(version); } } else { // Generic toString builder.append("ResourceImpl [caps="); builder.append(allCapabilities); builder.append(", reqs="); builder.append(allRequirements); builder.append("]"); } return builder.toString(); }
@SuppressWarnings("unchecked") @Override public boolean equals(Object other) { if (this == other) return true; if (other == null || !(other instanceof Resource)) return false; Map<URI, String> thisLocations = getContentURIs(); Map<URI, String> otherLocations; if (other instanceof ResourceImpl) { otherLocations = ((ResourceImpl) other).getContentURIs(); } else { otherLocations = getLocations((Resource) other); } Collection<URI> overlap = retain(thisLocations.keySet(), otherLocations.keySet()); for (URI uri : overlap) { String thisSha = thisLocations.get(uri); String otherSha = otherLocations.get(uri); if (thisSha == otherSha) return true; if (thisSha != null && otherSha != null) { if (thisSha.equals(otherSha)) return true; } } return false; }
public Resource build() { if (built) throw new IllegalStateException("Resource already built"); built = true; resource.setCapabilities(capabilities); resource.setRequirements(requirements); return resource; }
@Override public String toString() { final StringBuilder builder = new StringBuilder(); List<Capability> identities = getCapabilities(IdentityNamespace.IDENTITY_NAMESPACE); if (identities.size() == 1) { Capability idCap = identities.get(0); Object id = idCap.getAttributes() .get(IdentityNamespace.IDENTITY_NAMESPACE); builder.append(id); Object version = idCap.getAttributes() .get(IdentityNamespace.CAPABILITY_VERSION_ATTRIBUTE); if (version != null) { builder.append(" version=") .append(version); } } else { // Generic toString builder.append("ResourceImpl [caps="); builder.append(allCapabilities); builder.append(", reqs="); builder.append(allRequirements); builder.append("]"); } return builder.toString(); }
@SuppressWarnings("unchecked") @Override public boolean equals(Object other) { if (this == other) return true; if (other == null || !(other instanceof Resource)) return false; Map<URI, String> thisLocations = getContentURIs(); Map<URI, String> otherLocations; if (other instanceof ResourceImpl) { otherLocations = ((ResourceImpl) other).getContentURIs(); } else { otherLocations = getLocations((Resource) other); } Collection<URI> overlap = retain(thisLocations.keySet(), otherLocations.keySet()); for (URI uri : overlap) { String thisSha = thisLocations.get(uri); String otherSha = otherLocations.get(uri); if (thisSha == otherSha) return true; if (thisSha != null && otherSha != null) { if (thisSha.equals(otherSha)) return true; } } return false; }
public Resource build() { if (built) throw new IllegalStateException("Resource already built"); built = true; resource.setCapabilities(capabilities); resource.setRequirements(requirements); return resource; }