src/main/java/org/owasp/url/AuthorityClassifierBuilder.java
public AuthorityClassifier build() {
    ImmutableSet<Inet4Address> ipv4Set = ipv4s.build();
    ImmutableSet<Inet6Address> ipv6Set = ipv6s.build();
    ImmutableSet<InternetDomainName> domainNameSet = domainNames.build();
    HostGlobMatcher hostGlobMatcher = new HostGlobMatcher(hostGlobs.build());
    int[] allowedPortsSorted;
    {
      ImmutableSet<Integer> allowedPortIntSet = allowedPorts.build();
      int n = allowedPortIntSet.size();
      allowedPortsSorted = new int[n];
      Iterator<Integer> allowedPortIt = allowedPortIntSet.iterator();
      for (int i = 0; i < n; ++i) {
        allowedPortsSorted[i] = allowedPortIt.next();
      }
      Arrays.sort(allowedPortsSorted);
    }
    Predicate<? super Integer> portClassifier =
        allowedPortsSorted.length == 0  // No exclusion specified
        ? Predicates.alwaysTrue()
        : Predicates.alwaysFalse();
    if (this.allowedPortClassifier != null) {
      portClassifier = this.allowedPortClassifier;
    }
    UserInfoClassifier userInfoClassifier =
        this.allowedUserInfoClassifier != null
        ? this.allowedUserInfoClassifier
        : UserInfoClassifiers.NO_PASSWORD_BUT_USERNAME_IF_ALLOWED_BY_SCHEME;
    return new AuthorityClassifierImpl(
        ipv4Set,
        ipv6Set,
        domainNameSet,
        hostGlobMatcher,
        matchesAnyHost,
        allowedPortsSorted,
        portClassifier,
        userInfoClassifier);
  }
/**
   * Builds a classifier based on previous allow/match decisions.
   * This may be reused after a call to build and subsequent calls to
   * allow/match methods will not affect previously built classifiers.
   */
Builds a classifier based on previous allow/match decisions.
This may be reused after a call to build and subsequent calls to
allow/match methods will not affect previously built classifiers.
Builds a classifier based on previous allow / match decisions . This may be reused after a call to build and subsequent calls to allow / match methods will not affect previously built classifiers .
public AuthorityClassifier build() {
    ImmutableSet<Inet4Address> ipv4Set = ipv4s.build();
    ImmutableSet<Inet6Address> ipv6Set = ipv6s.build();
    ImmutableSet<InternetDomainName> domainNameSet = domainNames.build();
    HostGlobMatcher hostGlobMatcher = new HostGlobMatcher(hostGlobs.build());
    int[] allowedPortsSorted;
    {
      ImmutableSet<Integer> allowedPortIntSet = allowedPorts.build();
      int n = allowedPortIntSet.size();
      allowedPortsSorted = new int[n];
      Iterator<Integer> allowedPortIt = allowedPortIntSet.iterator();
      for (int i = 0; i < n; ++i) {
        allowedPortsSorted[i] = allowedPortIt.next();
      }
      Arrays.sort(allowedPortsSorted);
    }
    Predicate<? super Integer> portClassifier =
        allowedPortsSorted.length == 0  
        ? Predicates.alwaysTrue()
        : Predicates.alwaysFalse();
    if (this.allowedPortClassifier != null) {
      portClassifier = this.allowedPortClassifier;
    }
    UserInfoClassifier userInfoClassifier =
        this.allowedUserInfoClassifier != null
        ? this.allowedUserInfoClassifier
        : UserInfoClassifiers.NO_PASSWORD_BUT_USERNAME_IF_ALLOWED_BY_SCHEME;
    return new AuthorityClassifierImpl(
        ipv4Set,
        ipv6Set,
        domainNameSet,
        hostGlobMatcher,
        matchesAnyHost,
        allowedPortsSorted,
        portClassifier,
        userInfoClassifier);
  }
public AuthorityClassifier build ( ) { ImmutableSet < Inet4Address > ipv4Set = ipv4s . build ( ) ; ImmutableSet < Inet6Address > ipv6Set = ipv6s . build ( ) ; ImmutableSet < InternetDomainName > domainNameSet = domainNames . build ( ) ; HostGlobMatcher hostGlobMatcher = new HostGlobMatcher ( hostGlobs . build ( ) ) ; int [ ] allowedPortsSorted ; { ImmutableSet < Integer > allowedPortIntSet = allowedPorts . build ( ) ; int n = allowedPortIntSet . size ( ) ; allowedPortsSorted = new int [ n ] ; Iterator < Integer > allowedPortIt = allowedPortIntSet . iterator ( ) ; for ( int i = 0 ; i < n ; ++ i ) { allowedPortsSorted [ i ] = allowedPortIt . next ( ) ; } Arrays . sort ( allowedPortsSorted ) ; } Predicate < ? super Integer > portClassifier = allowedPortsSorted . length == 0 ? Predicates . alwaysTrue ( ) : Predicates . alwaysFalse ( ) ; if ( this . allowedPortClassifier != null ) { portClassifier = this . allowedPortClassifier ; } UserInfoClassifier userInfoClassifier = this . allowedUserInfoClassifier != null ? this . allowedUserInfoClassifier : UserInfoClassifiers . NO_PASSWORD_BUT_USERNAME_IF_ALLOWED_BY_SCHEME ; return new AuthorityClassifierImpl ( ipv4Set , ipv6Set , domainNameSet , hostGlobMatcher , matchesAnyHost , allowedPortsSorted , portClassifier , userInfoClassifier ) ; }
Builds a classifier based on previous allow/match decisions.
Builds a classifier based on previous allow / match decisions .
// No exclusion specified