/* * (non-Javadoc) * * @see java.lang.Object#hashCode() */ @Override public int hashCode() { final int prime = 31; int result = super.hashCode(); result = prime * result + ((container == null) ? 0 : container.hashCode()); return result; }
/** * Returns the set of projects that contain this object, and which the requesting user has * permissions to access. * * @return Mapping from project ID to the user's access level in that project. */ public Map<DXContainer, AccessLevel> listProjects() { Map<String, AccessLevel> rawMap = deserializeListProjectsMap(apiCallOnObject("listProjects", RetryStrategy.SAFE_TO_RETRY)); ImmutableMap.Builder<DXContainer, AccessLevel> resultBuilder = ImmutableMap.builder(); for (Map.Entry<String, AccessLevel> entry : rawMap.entrySet()) { resultBuilder.put(DXContainer.getInstance(entry.getKey()), entry.getValue()); } return resultBuilder.build(); }
/* * (non-Javadoc) * * @see java.lang.Object#equals(java.lang.Object) */ @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (!super.equals(obj)) { return false; } if (!(obj instanceof DXDataObject)) { return false; } DXDataObject other = (DXDataObject) obj; if (container == null) { if (other.container != null) { return false; } } else if (!container.equals(other.container)) { return false; } return true; }
/** * Returns a {@code DescribeOptions} that behaves like the current one, except that * project-specific metadata will be retrieved from the specified project or container. Attempts * to invoke accessors on the resulting {@link Describe} object corresponding to fields that * were not requested will throw {@link IllegalStateException}. * * @param project project or container from which to obtain project-specific metadata * @return a new {@code DescribeOptions} object */ public DescribeOptions inProject(DXContainer project) { return new DescribeOptions(project.getId(), this.fields, this.properties, this.details); }
/** * Returns the project or container from which user-provided metadata was retrieved. * * @return {@code DXProject} or {@code DXContainer} */ public DXContainer getProject() { Preconditions.checkState( this.project != null, "project is not accessible because it was not retrieved with the describe call"); return DXContainer.getInstance(this.project); }