/** * Converts the pattern constraints from <code>typedef</code> to the list of * the strings which represents these constraints. * * @param typedef * extended type in which are the pattern constraints sought * @return list of strings which represents the constraint patterns * @throws IllegalArgumentException * if <code>typedef</code> equals null * */ private List<String> resolveRegExpressionsFromTypedef(final ExtendedType typedef) { final List<String> regExps = new ArrayList<String>(); Preconditions.checkArgument(typedef != null, "typedef can't be null"); final TypeDefinition<?> strTypeDef = baseTypeDefForExtendedType(typedef); if (strTypeDef instanceof StringType) { final List<PatternConstraint> patternConstraints = typedef.getPatternConstraints(); if (!patternConstraints.isEmpty()) { String regEx; String modifiedRegEx; for (PatternConstraint patternConstraint : patternConstraints) { regEx = patternConstraint.getRegularExpression(); modifiedRegEx = StringEscapeUtils.escapeJava(regEx); regExps.add(modifiedRegEx); } } } return regExps; }