/** * Constructs an {@link ImageReference} from the image reference components, consisting of an * optional registry, a repository, and an optional tag. * * @param registry the image registry, or {@code null} to use the default registry (Docker Hub) * @param repository the image repository * @param tag the image tag, or {@code null} to use the default tag ({@code latest}) * @return an {@link ImageReference} built from the given registry, repository, and tag */ public static ImageReference of( @Nullable String registry, String repository, @Nullable String tag) { Preconditions.checkArgument(Strings.isNullOrEmpty(registry) || isValidRegistry(registry)); Preconditions.checkArgument(isValidRepository(repository)); Preconditions.checkArgument(Strings.isNullOrEmpty(tag) || isValidTag(tag)); if (Strings.isNullOrEmpty(registry)) { registry = DOCKER_HUB_REGISTRY; } if (Strings.isNullOrEmpty(tag)) { tag = DEFAULT_TAG; } return new ImageReference(registry, repository, tag); }
/** * Constructs an {@link ImageReference} from the image reference components, consisting of an * optional registry, a repository, and an optional tag. * * @param registry the image registry, or {@code null} to use the default registry (Docker Hub) * @param repository the image repository * @param tag the image tag, or {@code null} to use the default tag ({@code latest}) * @return an {@link ImageReference} built from the given registry, repository, and tag */ public static ImageReference of( @Nullable String registry, String repository, @Nullable String tag) { Preconditions.checkArgument(Strings.isNullOrEmpty(registry) || isValidRegistry(registry)); Preconditions.checkArgument(isValidRepository(repository)); Preconditions.checkArgument(Strings.isNullOrEmpty(tag) || isValidTag(tag)); if (Strings.isNullOrEmpty(registry)) { registry = DOCKER_HUB_REGISTRY; } if (Strings.isNullOrEmpty(tag)) { tag = DEFAULT_TAG; } return new ImageReference(registry, repository, tag); }
/** * Constructs an {@link ImageReference} from the image reference components, consisting of an * optional registry, a repository, and an optional tag. * * @param registry the image registry, or {@code null} to use the default registry (Docker Hub) * @param repository the image repository * @param tag the image tag, or {@code null} to use the default tag ({@code latest}) * @return an {@link ImageReference} built from the given registry, repository, and tag */ public static ImageReference of( @Nullable String registry, String repository, @Nullable String tag) { Preconditions.checkArgument(Strings.isNullOrEmpty(registry) || isValidRegistry(registry)); Preconditions.checkArgument(isValidRepository(repository)); Preconditions.checkArgument(Strings.isNullOrEmpty(tag) || isValidTag(tag)); if (Strings.isNullOrEmpty(registry)) { registry = DOCKER_HUB_REGISTRY; } if (Strings.isNullOrEmpty(tag)) { tag = DEFAULT_TAG; } return new ImageReference(registry, repository, tag); }