/** * Creates an {@link ExposedPort} for the given parameters. * * @param scheme * the {@link #getScheme() scheme}, <code>tcp</code> or <code>udp</code> * @param port * the {@link #getPort() port number} * @deprecated use {@link #ExposedPort(int, InternetProtocol)} */ @Deprecated public ExposedPort(String scheme, int port) { this(port, InternetProtocol.valueOf(scheme)); }
/** * Parses a string to an {@link InternetProtocol}. * * @param serialized * the protocol, e.g. <code>tcp</code> or <code>TCP</code> * @return an {@link InternetProtocol} described by the string * @throws IllegalArgumentException * if the argument cannot be parsed */ public static InternetProtocol parse(String serialized) throws IllegalArgumentException { try { return valueOf(serialized.toUpperCase()); } catch (Exception e) { throw new IllegalArgumentException("Error parsing Protocol '" + serialized + "'"); } }
/** * Creates an {@link ExposedPort} for the given parameters. * * @param scheme * the {@link #getScheme() scheme}, <code>tcp</code> or <code>udp</code> * @param port * the {@link #getPort() port number} * @deprecated use {@link #ExposedPort(int, InternetProtocol)} */ @Deprecated public ExposedPort(String scheme, int port) { this(port, InternetProtocol.valueOf(scheme)); }
/** * Parses a string to an {@link InternetProtocol}. * * @param serialized * the protocol, e.g. <code>tcp</code> or <code>TCP</code> * @return an {@link InternetProtocol} described by the string * @throws IllegalArgumentException * if the argument cannot be parsed */ public static InternetProtocol parse(String serialized) throws IllegalArgumentException { try { return valueOf(serialized.toUpperCase()); } catch (Exception e) { throw new IllegalArgumentException("Error parsing Protocol '" + serialized + "'"); } }