@Test public void testDoNotParse2() { _exception.expect(BatfishException.class); RegexConstraint.parse("^40:/"); }
@JsonCreator @Nonnull public static RegexConstraint parse(@Nonnull String s) { String curr = s; boolean negated; if (curr.startsWith("!")) { negated = true; curr = curr.substring(1); } else { negated = false; } String regex; boolean startRegex = curr.startsWith("/"); boolean endRegex = curr.endsWith("/"); if (startRegex && endRegex && curr.length() > 1) { regex = curr.substring(1, curr.length() - 1); } else if (!startRegex && !endRegex) { regex = "^" + curr + "$"; } else { throw new BatfishException("Invalid regex constraint: " + s); } return new RegexConstraint(regex, negated); }
RegexConstraint { @JsonCreator @Nonnull public static RegexConstraint parse(@Nonnull String s) { String curr = s; boolean negated; if (curr.startsWith("!")) { negated = true; curr = curr.substring(1); } else { negated = false; } String regex; boolean startRegex = curr.startsWith("/"); boolean endRegex = curr.endsWith("/"); if (startRegex && endRegex && curr.length() > 1) { regex = curr.substring(1, curr.length() - 1); } else if (!startRegex && !endRegex) { regex = "^" + curr + "$"; } else { throw new BatfishException("Invalid regex constraint: " + s); } return new RegexConstraint(regex, negated); } }
RegexConstraint { @JsonCreator @Nonnull public static RegexConstraint parse(@Nonnull String s) { String curr = s; boolean negated; if (curr.startsWith("!")) { negated = true; curr = curr.substring(1); } else { negated = false; } String regex; boolean startRegex = curr.startsWith("/"); boolean endRegex = curr.endsWith("/"); if (startRegex && endRegex && curr.length() > 1) { regex = curr.substring(1, curr.length() - 1); } else if (!startRegex && !endRegex) { regex = "^" + curr + "$"; } else { throw new BatfishException("Invalid regex constraint: " + s); } return new RegexConstraint(regex, negated); } @JsonCreator  RegexConstraint(
      @JsonProperty(PROP_REGEX) String regex, @JsonProperty(PROP_NEGATED) boolean negated); }
RegexConstraint { @JsonCreator @Nonnull public static RegexConstraint parse(@Nonnull String s) { String curr = s; boolean negated; if (curr.startsWith("!")) { negated = true; curr = curr.substring(1); } else { negated = false; } String regex; boolean startRegex = curr.startsWith("/"); boolean endRegex = curr.endsWith("/"); if (startRegex && endRegex && curr.length() > 1) { regex = curr.substring(1, curr.length() - 1); } else if (!startRegex && !endRegex) { regex = "^" + curr + "$"; } else { throw new BatfishException("Invalid regex constraint: " + s); } return new RegexConstraint(regex, negated); } @JsonCreator  RegexConstraint(
      @JsonProperty(PROP_REGEX) String regex, @JsonProperty(PROP_NEGATED) boolean negated); @JsonCreator @Nonnull static RegexConstraint parse(@Nonnull String s); @JsonProperty(PROP_REGEX) String getRegex(); @JsonProperty(PROP_NEGATED) boolean getNegated(); @Override boolean equals(@Nullable Object o); @Override int hashCode(); }
RegexConstraint { @JsonCreator @Nonnull public static RegexConstraint parse(@Nonnull String s) { String curr = s; boolean negated; if (curr.startsWith("!")) { negated = true; curr = curr.substring(1); } else { negated = false; } String regex; boolean startRegex = curr.startsWith("/"); boolean endRegex = curr.endsWith("/"); if (startRegex && endRegex && curr.length() > 1) { regex = curr.substring(1, curr.length() - 1); } else if (!startRegex && !endRegex) { regex = "^" + curr + "$"; } else { throw new BatfishException("Invalid regex constraint: " + s); } return new RegexConstraint(regex, negated); } @JsonCreator  RegexConstraint(
      @JsonProperty(PROP_REGEX) String regex, @JsonProperty(PROP_NEGATED) boolean negated); @JsonCreator @Nonnull static RegexConstraint parse(@Nonnull String s); @JsonProperty(PROP_REGEX) String getRegex(); @JsonProperty(PROP_NEGATED) boolean getNegated(); @Override boolean equals(@Nullable Object o); @Override int hashCode();  }