public static ExposedPort parse(String serialized) throws IllegalArgumentException {
        try {
            String[] parts = serialized.split("/");
            switch (parts.length) {
                case 1:
                    return new ExposedPort(Integer.parseInt(parts[0]));
                case 2:
                    return new ExposedPort(Integer.parseInt(parts[0]), InternetProtocol.parse(parts[1]));
                default:
                    throw new IllegalArgumentException();
            }
        } catch (Exception e) {
            throw new IllegalArgumentException("Error parsing ExposedPort '" + serialized + "'");
        }
    }
public static ExposedPort parse ( String serialized ) throws IllegalArgumentException { try { String [ ] parts = serialized . split ( "/" ) ; switch ( parts . length ) { case 1 : return new ExposedPort ( Integer . parseInt ( parts [ 0 ] ) ) ; case 2 : return new ExposedPort ( Integer . parseInt ( parts [ 0 ] ) , InternetProtocol . parse ( parts [ 1 ] ) ) ; default : throw new IllegalArgumentException ( ) ; } } catch ( Exception e ) { throw new IllegalArgumentException ( "Error parsing ExposedPort '" + serialized + "'" ) ; } }
Parses a textual port specification (as used by the Docker CLI) to an {@link ExposedPort}.

@param serialized
the specification, e.g. <code>80/tcp</code>
@return an {@link ExposedPort} matching the specification
@throws IllegalArgumentException
if the specification cannot be parsed