src/main/java/org/owasp/url/QueryClassifierBuilder.java
public QueryClassifier build() {
    ImmutableSet<String> mayKeySet = mayKeys.build();
    Predicate<? super String> mayKeyClassifier;
    if (mayClassifier != null) {
      mayKeyClassifier = mayClassifier;
    } else if (mayKeySet.isEmpty()) {
        // If nothing specified, assume permissive.
      mayKeyClassifier = Predicates.alwaysTrue();
    } else {
      // If a set specified, defer to the set.
      mayKeyClassifier = Predicates.<String>alwaysFalse();
    }

    ImmutableSet<String> onceKeySet = onceKeys.build();
    Predicate<? super String> onceKeyClassifier;
    if (onceClassifier != null) {
      onceKeyClassifier = onceClassifier;
    } else {
      onceKeyClassifier = Predicates.<String>alwaysFalse();
    }

    ImmutableSet<String> mustKeySet = mustKeys.build();
    ImmutableMap<String, Predicate<? super Optional<String>>> valueClassifierMap =
        ImmutableMap.copyOf(valueClassifiers);

    // If something may appear once or must appear, then it may appear.
    if (!Predicates.alwaysTrue().equals(mayKeyClassifier)) {
      if (!Predicates.alwaysFalse().equals(onceKeyClassifier)) {
        mayKeyClassifier = Predicates.or(mayKeyClassifier, onceKeyClassifier);
      }
      mayKeySet = ImmutableSet.<String>builder()
          .addAll(mayKeySet)
          .addAll(onceKeySet)
          .addAll(mustKeySet)
          .build();
    }

    return new QueryClassifierImpl(
        mayKeySet,
        mayKeyClassifier,
        onceKeySet,
        onceKeyClassifier,
        mustKeySet,
        valueClassifierMap);
  }
/**
   * 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 QueryClassifier build() {
    ImmutableSet<String> mayKeySet = mayKeys.build();
    Predicate<? super String> mayKeyClassifier;
    if (mayClassifier != null) {
      mayKeyClassifier = mayClassifier;
    } else if (mayKeySet.isEmpty()) {
      mayKeyClassifier = Predicates.alwaysTrue();
    } else {
      mayKeyClassifier = Predicates.<String>alwaysFalse();
    }
    ImmutableSet<String> onceKeySet = onceKeys.build();
    Predicate<? super String> onceKeyClassifier;
    if (onceClassifier != null) {
      onceKeyClassifier = onceClassifier;
    } else {
      onceKeyClassifier = Predicates.<String>alwaysFalse();
    }
    ImmutableSet<String> mustKeySet = mustKeys.build();
    ImmutableMap<String, Predicate<? super Optional<String>>> valueClassifierMap =
        ImmutableMap.copyOf(valueClassifiers);
    if (!Predicates.alwaysTrue().equals(mayKeyClassifier)) {
      if (!Predicates.alwaysFalse().equals(onceKeyClassifier)) {
        mayKeyClassifier = Predicates.or(mayKeyClassifier, onceKeyClassifier);
      }
      mayKeySet = ImmutableSet.<String>builder()
          .addAll(mayKeySet)
          .addAll(onceKeySet)
          .addAll(mustKeySet)
          .build();
    }
    return new QueryClassifierImpl(
        mayKeySet,
        mayKeyClassifier,
        onceKeySet,
        onceKeyClassifier,
        mustKeySet,
        valueClassifierMap);
  }
public QueryClassifier build ( ) { ImmutableSet < String > mayKeySet = mayKeys . build ( ) ; Predicate < ? super String > mayKeyClassifier ; if ( mayClassifier != null ) { mayKeyClassifier = mayClassifier ; } else if ( mayKeySet . isEmpty ( ) ) { mayKeyClassifier = Predicates . alwaysTrue ( ) ; } else { mayKeyClassifier = Predicates . < String > alwaysFalse ( ) ; } ImmutableSet < String > onceKeySet = onceKeys . build ( ) ; Predicate < ? super String > onceKeyClassifier ; if ( onceClassifier != null ) { onceKeyClassifier = onceClassifier ; } else { onceKeyClassifier = Predicates . < String > alwaysFalse ( ) ; } ImmutableSet < String > mustKeySet = mustKeys . build ( ) ; ImmutableMap < String , Predicate < ? super Optional < String > > > valueClassifierMap = ImmutableMap . copyOf ( valueClassifiers ) ; if ( ! Predicates . alwaysTrue ( ) . equals ( mayKeyClassifier ) ) { if ( ! Predicates . alwaysFalse ( ) . equals ( onceKeyClassifier ) ) { mayKeyClassifier = Predicates . or ( mayKeyClassifier , onceKeyClassifier ) ; } mayKeySet = ImmutableSet . < String > builder ( ) . addAll ( mayKeySet ) . addAll ( onceKeySet ) . addAll ( mustKeySet ) . build ( ) ; } return new QueryClassifierImpl ( mayKeySet , mayKeyClassifier , onceKeySet , onceKeyClassifier , mustKeySet , valueClassifierMap ) ; }
Builds a classifier based on previous allow/match decisions.
Builds a classifier based on previous allow / match decisions .
// If nothing specified, assume permissive. // If a set specified, defer to the set. // If something may appear once or must appear, then it may appear.