/** * Stringifies the {@link ImageReference}. When the tag is a digest, it is prepended with the at * {@code @} symbol instead of a colon {@code :}. * * @return the image reference in Docker-readable format (inverse of {@link #parse}) */ @Override public String toString() { StringBuilder referenceString = new StringBuilder(); if (!DOCKER_HUB_REGISTRY.equals(registry)) { // Use registry and repository if not Docker Hub. referenceString.append(registry).append('/').append(repository); } else if (repository.startsWith(LIBRARY_REPOSITORY_PREFIX)) { // If Docker Hub and repository has 'library/' prefix, remove the 'library/' prefix. referenceString.append(repository.substring(LIBRARY_REPOSITORY_PREFIX.length())); } else { // Use just repository if Docker Hub. referenceString.append(repository); } // Use tag if not the default tag. if (!DEFAULT_TAG.equals(tag)) { // Append with "@tag" instead of ":tag" if tag is a digest referenceString.append(isTagDigest() ? '@' : ':').append(tag); } return referenceString.toString(); }
/** * Stringifies the {@link ImageReference}. When the tag is a digest, it is prepended with the at * {@code @} symbol instead of a colon {@code :}. * * @return the image reference in Docker-readable format (inverse of {@link #parse}) */ @Override public String toString() { StringBuilder referenceString = new StringBuilder(); if (!DOCKER_HUB_REGISTRY.equals(registry)) { // Use registry and repository if not Docker Hub. referenceString.append(registry).append('/').append(repository); } else if (repository.startsWith(LIBRARY_REPOSITORY_PREFIX)) { // If Docker Hub and repository has 'library/' prefix, remove the 'library/' prefix. referenceString.append(repository.substring(LIBRARY_REPOSITORY_PREFIX.length())); } else { // Use just repository if Docker Hub. referenceString.append(repository); } // Use tag if not the default tag. if (!DEFAULT_TAG.equals(tag)) { // Append with "@tag" instead of ":tag" if tag is a digest referenceString.append(isTagDigest() ? '@' : ':').append(tag); } return referenceString.toString(); }
/** * Stringifies the {@link ImageReference}. When the tag is a digest, it is prepended with the at * {@code @} symbol instead of a colon {@code :}. * * @return the image reference in Docker-readable format (inverse of {@link #parse}) */ @Override public String toString() { StringBuilder referenceString = new StringBuilder(); if (!DOCKER_HUB_REGISTRY.equals(registry)) { // Use registry and repository if not Docker Hub. referenceString.append(registry).append('/').append(repository); } else if (repository.startsWith(LIBRARY_REPOSITORY_PREFIX)) { // If Docker Hub and repository has 'library/' prefix, remove the 'library/' prefix. referenceString.append(repository.substring(LIBRARY_REPOSITORY_PREFIX.length())); } else { // Use just repository if Docker Hub. referenceString.append(repository); } // Use tag if not the default tag. if (!DEFAULT_TAG.equals(tag)) { // Append with "@tag" instead of ":tag" if tag is a digest referenceString.append(isTagDigest() ? '@' : ':').append(tag); } return referenceString.toString(); }