/** * Parse a template. * * @param template the template. * @throws IllegalArgumentException if the template is null, an empty string * or does not conform to a JAX-RS URI template. */ public UriTemplateParser(final String template) throws IllegalArgumentException { if (template == null || template.length() == 0) { throw new IllegalArgumentException(); } this.template = template; parse(new StringCharacterIterator(template)); try { pattern = Pattern.compile(regex.toString()); } catch (PatternSyntaxException ex) { throw new IllegalArgumentException("Invalid syntax for the template expression '" + regex + "'", ex); } }
/** * Parse a template. * * @param template the template. * @throws IllegalArgumentException if the template is null, an empty string * or does not conform to a JAX-RS URI template. */ public UriTemplateParser(final String template) throws IllegalArgumentException { if (template == null || template.length() == 0) { throw new IllegalArgumentException(); } this.template = template; parse(new StringCharacterIterator(template)); try { pattern = Pattern.compile(regex.toString()); } catch (PatternSyntaxException ex) { throw new IllegalArgumentException("Invalid syntax for the template expression '" + regex + "'", ex); } }