public static UrlBuilder parse ( URL url ) { final UrlBuilder result = new UrlBuilder ( ) ; if ( url != null ) { final String protocol = url . getProtocol ( ) ; if ( protocol != null && ! protocol . isEmpty ( ) ) { result . withScheme ( protocol ) ; } final String host = url . getHost ( ) ; if ( host != null && ! host . isEmpty ( ) ) { result . withHost ( host ) ; } final int port = url . getPort ( ) ; if ( port != - 1 ) { result . withPort ( port ) ; } final String path = url . getPath ( ) ; if ( path != null && ! path . isEmpty ( ) ) { result . withPath ( path ) ; } final String query = url . getQuery ( ) ; if ( query != null && ! query . isEmpty ( ) ) { result . withQuery ( query ) ; } } return result ; }
Parse a UrlBuilder from the provided URL object .