public class ExposedPort
extends java.lang.Object
implements java.io.Serializable
port number
and an
InternetProtocol
. It can be published by Docker by binding
it to a host port,
represented by a Ports.Binding
.Modifier and Type | Class and Description |
---|---|
static class |
ExposedPort.Deserializer |
static class |
ExposedPort.Serializer |
Constructor and Description |
---|
ExposedPort(int port)
|
ExposedPort(int port,
InternetProtocol protocol)
Creates an
ExposedPort for the given parameters. |
ExposedPort(java.lang.String scheme,
int port)
Deprecated.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object obj) |
int |
getPort() |
InternetProtocol |
getProtocol() |
java.lang.String |
getScheme()
Deprecated.
use
getProtocol() |
int |
hashCode() |
static ExposedPort |
parse(java.lang.String serialized)
Parses a textual port specification (as used by the Docker CLI) to an
ExposedPort . |
static ExposedPort |
tcp(int port)
Creates an
ExposedPort for InternetProtocol.TCP . |
java.lang.String |
toString()
Returns a string representation of this
ExposedPort suitable for inclusion in a JSON message. |
static ExposedPort |
udp(int port)
Creates an
ExposedPort for InternetProtocol.UDP . |
public ExposedPort(int port, InternetProtocol protocol)
ExposedPort
for the given parameters.port
- the port number
protocol
- the InternetProtocol
public ExposedPort(int port)
port
- the port number
@Deprecated public ExposedPort(java.lang.String scheme, int port)
ExposedPort(int, InternetProtocol)
ExposedPort
for the given parameters.scheme
- the scheme
, tcp
or udp
port
- the port number
public InternetProtocol getProtocol()
InternetProtocol
of the port
that the container exposes@Deprecated public java.lang.String getScheme()
getProtocol()
tcp
or udp
public int getPort()
public static ExposedPort tcp(int port)
ExposedPort
for InternetProtocol.TCP
. This is a shortcut for
new ExposedPort(port, InternetProtocol.TCP
)
public static ExposedPort udp(int port)
ExposedPort
for InternetProtocol.UDP
. This is a shortcut for
new ExposedPort(port, InternetProtocol.UDP
)
public static ExposedPort parse(java.lang.String serialized) throws java.lang.IllegalArgumentException
ExposedPort
.serialized
- the specification, e.g. 80/tcp
ExposedPort
matching the specificationjava.lang.IllegalArgumentException
- if the specification cannot be parsedpublic java.lang.String toString()
ExposedPort
suitable for inclusion in a JSON message. The format is
port/protocol
, like the argument in parse(String)
.toString
in class java.lang.Object
ExposedPort
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
Copyright © 2019. All Rights Reserved.