public final class DockerImageName
extends java.lang.Object
Constructor and Description |
---|
DockerImageName(java.lang.String fullImageName)
Deprecated.
use
parse(String) instead |
DockerImageName(java.lang.String nameWithoutTag,
@NotNull java.lang.String version)
Deprecated.
use
parse(String) .withTag(String) instead |
Modifier and Type | Method and Description |
---|---|
java.lang.String |
asCanonicalNameString() |
DockerImageName |
asCompatibleSubstituteFor(DockerImageName otherImageName)
Declare that this
DockerImageName is a compatible substitute for another image - i.e. |
DockerImageName |
asCompatibleSubstituteFor(java.lang.String otherImageName)
Declare that this
DockerImageName is a compatible substitute for another image - i.e. |
void |
assertCompatibleWith(DockerImageName... anyOthers)
Behaves as
isCompatibleWith(DockerImageName) but throws an exception
rather than returning false if a mismatch is detected. |
void |
assertValid()
Is the image name valid?
|
boolean |
equals(java.lang.Object o) |
java.lang.String |
getRegistry() |
java.lang.String |
getRepository() |
java.lang.String |
getUnversionedPart() |
java.lang.String |
getVersionPart() |
int |
hashCode() |
boolean |
isCompatibleWith(DockerImageName other)
Test whether this
DockerImageName has declared compatibility with another image (set using
asCompatibleSubstituteFor(String) or
asCompatibleSubstituteFor(DockerImageName) . |
static DockerImageName |
parse(java.lang.String fullImageName)
Parses a docker image name from a provided string.
|
java.lang.String |
toString() |
DockerImageName |
withRegistry(java.lang.String registry) |
DockerImageName |
withRepository(java.lang.String repository) |
DockerImageName |
withTag(java.lang.String newTag) |
@Deprecated public DockerImageName(java.lang.String fullImageName)
parse(String)
insteadfullImageName
- in standard Docker format, e.g. name:tag
,
some.registry/path/name:tag
,
some.registry/path/name@sha256:abcdef...
, etc.@Deprecated public DockerImageName(java.lang.String nameWithoutTag, @NotNull @NotNull java.lang.String version)
parse(String)
.withTag(String)
insteadnameWithoutTag
- in standard Docker format, e.g. name
,
some.registry/path/name
,
some.registry/path/name
, etc.version
- a docker image version identifier, either as a tag or sha256 checksum, e.g.
tag
,
sha256:abcdef...
.public static DockerImageName parse(java.lang.String fullImageName)
fullImageName
- in standard Docker format, e.g. name:tag
,
some.registry/path/name:tag
,
some.registry/path/name@sha256:abcdef...
, etc.public java.lang.String getUnversionedPart()
public java.lang.String getVersionPart()
public java.lang.String asCanonicalNameString()
public java.lang.String toString()
toString
in class java.lang.Object
public void assertValid()
java.lang.IllegalArgumentException
- if not validpublic DockerImageName withTag(java.lang.String newTag)
newTag
- version tag for the copy to useDockerImageName
with the new version tagpublic DockerImageName asCompatibleSubstituteFor(java.lang.String otherImageName)
DockerImageName
is a compatible substitute for another image - i.e. that this image
behaves as the other does, and is compatible with Testcontainers' assumptions about the other image.otherImageName
- the image name of the other imageDockerImageName
with the compatibility declaration attached.public DockerImageName asCompatibleSubstituteFor(DockerImageName otherImageName)
DockerImageName
is a compatible substitute for another image - i.e. that this image
behaves as the other does, and is compatible with Testcontainers' assumptions about the other image.otherImageName
- the image name of the other imageDockerImageName
with the compatibility declaration attached.public boolean isCompatibleWith(DockerImageName other)
DockerImageName
has declared compatibility with another image (set using
asCompatibleSubstituteFor(String)
or
asCompatibleSubstituteFor(DockerImageName)
.
If a version tag part is present in the other
image name, the tags must exactly match, unless it
is 'latest'. If a version part is not present in the other
image name, the tag contents are ignored.
other
- the other image that we are trying to test compatibility withpublic void assertCompatibleWith(DockerImageName... anyOthers)
isCompatibleWith(DockerImageName)
but throws an exception
rather than returning false if a mismatch is detected.anyOthers
- the other image(s) that we are trying to check compatibility with. If more
than one is provided, this method will check compatibility with at least one
of them.java.lang.IllegalStateException
- if isCompatibleWith(DockerImageName)
returns falsepublic boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public DockerImageName withRegistry(java.lang.String registry)
public java.lang.String getRegistry()
public DockerImageName withRepository(java.lang.String repository)
public java.lang.String getRepository()