@Nullable public static WebsiteAddress create(String originOrHostOrPattern){
  if (originOrHostOrPattern == null || originOrHostOrPattern.isEmpty()) {
    return null;
  }
  if (originOrHostOrPattern.startsWith(ANY_SUBDOMAIN_PATTERN)) {
    String origin=null;
    String scheme=null;
    String host=originOrHostOrPattern.substring(ANY_SUBDOMAIN_PATTERN.length());
    boolean omitProtocolAndPort=true;
    return new WebsiteAddress(originOrHostOrPattern,origin,scheme,host,omitProtocolAndPort);
  }
  if (originOrHostOrPattern.indexOf(SCHEME_SUFFIX) != -1) {
    Uri uri=Uri.parse(originOrHostOrPattern);
    String origin=trimTrailingBackslash(originOrHostOrPattern);
    boolean omitProtocolAndPort=HTTP_SCHEME.equals(uri.getScheme()) && (uri.getPort() == -1 || uri.getPort() == 80);
    return new WebsiteAddress(originOrHostOrPattern,origin,uri.getScheme(),uri.getHost(),omitProtocolAndPort);
  }
  String origin=null;
  String scheme=null;
  boolean omitProtocolAndPort=true;
  return new WebsiteAddress(originOrHostOrPattern,origin,scheme,originOrHostOrPattern,omitProtocolAndPort);
}

@ Nullable public static WebsiteAddress create ( String originOrHostOrPattern ) { if ( originOrHostOrPattern == null || originOrHostOrPattern . isEmpty ( ) ) { return null ; } if ( originOrHostOrPattern . startsWith ( ANY_SUBDOMAIN_PATTERN ) ) { String origin = null ; String scheme = null ; String host = originOrHostOrPattern . substring ( ANY_SUBDOMAIN_PATTERN . length ( ) ) ; boolean omitProtocolAndPort = true ; return new WebsiteAddress ( originOrHostOrPattern , origin , scheme , host , omitProtocolAndPort ) ; } if ( originOrHostOrPattern . indexOf ( SCHEME_SUFFIX ) != - 1 ) { Uri uri = Uri . parse ( originOrHostOrPattern ) ; String origin = trimTrailingBackslash ( originOrHostOrPattern ) ; boolean omitProtocolAndPort = HTTP_SCHEME . equals ( uri . getScheme ( ) ) && ( uri . getPort ( ) == - 1 || uri . getPort ( ) == 80 ) ; return new WebsiteAddress ( originOrHostOrPattern , origin , uri . getScheme ( ) , uri . getHost ( ) , omitProtocolAndPort ) ; } String origin = null ; String scheme = null ; boolean omitProtocolAndPort = true ; return new WebsiteAddress ( originOrHostOrPattern , origin , scheme , originOrHostOrPattern , omitProtocolAndPort ) ; }
creates a new websiteaddress from | originorhostorpattern | .
