@Override public String toString() { return pattern.toString(); }
@Override public String toString() { return pattern.toString(); }
@Override public String toString() { return pattern.toString(); }
boolean hasSecondPattern() { return StringUtils.isNotEmpty(secondPattern.toString()); } }
/** * Construct a new URI pattern. * * @param regexPattern the regular expression pattern * @param groupIndexes the array of group indexes to capturing groups. * @throws IllegalArgumentException if the regexPattern is null. */ public UriPattern(Pattern regexPattern, int[] groupIndexes) { if (regexPattern == null) throw new IllegalArgumentException(); this.regex = regexPattern.toString(); this.regexPattern = regexPattern; this.groupIndexes = groupIndexes; }
public Entry(List<Pattern> regex, String type, Set<String> overwritableTypes, double priority) { this.regex = regex; this.type = type.intern(); this.overwritableTypes = overwritableTypes; this.priority = priority; // Efficiency shortcut for (Pattern p : regex) { if (p.toString().matches("[a-zA-Z0-9]+")) { exact.add(p.toString()); } else { exact.add(null); } } }
private static void addNamedGroups(Pattern pattern, HashSet<String> variables) { Matcher matcher = NAMED_GROUPS_PATTERN.matcher(pattern.toString()); while (matcher.find()) { String name = matcher.group(1); checkArgument(!variables.contains(name), "Multiple definitions found for variable ${" + name + "}"); variables.add(name); } }
public static List<String> topicsPatternFilter(List<String> original, Pattern topicsPattern) { final Pattern shortenedTopicsPattern = topicsPattern.toString().contains("://") ? Pattern.compile(topicsPattern.toString().split("\\:\\/\\/")[1]) : topicsPattern; return original.stream() .map(TopicName::get) .map(TopicName::toString) .filter(topic -> shortenedTopicsPattern.matcher(topic.split("\\:\\/\\/")[1]).matches()) .collect(Collectors.toList()); }
@Override public HTableDescriptor[] listTables(Pattern pattern) throws IOException { String regex = (pattern == null ? null : pattern.toString()); return listTables(regex); }
@Override public HTableDescriptor[] listTables(Pattern pattern, boolean includeSysTables) throws IOException { String regex = (pattern == null ? null : pattern.toString()); return listTables(regex, includeSysTables); }
@Override public TableName[] listTableNames(Pattern pattern, boolean includeSysTables) throws IOException { String regex = (pattern == null ? null : pattern.toString()); return listTableNames(regex, includeSysTables); }
@Override public Object check(Object val) throws NutValidateException { if(null==val) return null; String s = val.toString(); if (!p.matcher(s).find()) { throw new NutValidateException("InvalidString", p.toString(), s); } return val; }
@Override public String toString() { String result; switch(mode) { case FIXED: return label + '(' + children[0].toString() + ',' + newLabel + ')'; case REGEX: return label + '(' + children[0].toString() + ',' + labelRegex.toString() + ',' + replacementString + ')'; default: throw new AssertionError("Unsupported relabel mode " + mode); } }
@Override public List<TableDescriptor> listTableDescriptors(Pattern pattern, boolean includeSysTables) throws IOException { try { String regex = (pattern == null ? null : pattern.toString()); List<TTableDescriptor> tTableDescriptors = client .getTableDescriptorsByPattern(regex, includeSysTables); return ThriftUtilities.tableDescriptorsFromThrift(tTableDescriptors); } catch (TException e) { throw new IOException(e); } }
@Override public void describeTo( Description description ) { description.appendText( "a string matching /" ); description.appendText( pattern.toString() ); description.appendText( "/" ); } }
@Override public void describeTo( Description description ) { description.appendValue( SUCCESS ) .appendText( format( " with metadata %s ~ %s", key, pattern.toString() ) ); } };
@Override public void write(JsonWriter out, Pattern value) throws IOException { if (value == null) { out.nullValue(); } else if (out instanceof BsonWriter) { ((BsonWriter) out).unwrap() .writeRegularExpression(new BsonRegularExpression(value.pattern())); } else { out.value(value.toString()); } }
public static ListReplicationPeersRequest buildListReplicationPeersRequest(Pattern pattern) { ListReplicationPeersRequest.Builder builder = ListReplicationPeersRequest.newBuilder(); if (pattern != null) { builder.setRegex(pattern.toString()); } return builder.build(); }
public static void validatePartitionNameCharacters(List<String> partVals, Pattern partitionValidationPattern) throws MetaException { String invalidPartitionVal = getPartitionValWithInvalidCharacter(partVals, partitionValidationPattern); if (invalidPartitionVal != null) { throw new MetaException("Partition value '" + invalidPartitionVal + "' contains a character " + "not matched by whitelist pattern '" + partitionValidationPattern.toString() + "'. " + "(configure with " + MetastoreConf.ConfVars.PARTITION_NAME_WHITELIST_PATTERN.getVarname() + ")"); } }
@Override public Object visit(ASTEnumConstant node, Object data) { // This inlines checkMatches because there's no variable declarator id if (!getProperty(enumConstantRegex).matcher(node.getImage()).matches()) { addViolation(data, node, new Object[]{ "enum constant", node.getImage(), getProperty(enumConstantRegex).toString(), }); } return data; }