com.sun.jersey.api.uri
Class UriTemplateParser

java.lang.Object
  extended by com.sun.jersey.api.uri.UriTemplateParser

public class UriTemplateParser
extends java.lang.Object

A URI template parser that parses JAX-RS specific URI templates.

Author:
[email protected]

Constructor Summary
UriTemplateParser(java.lang.String template)
          Parse a template.
 
Method Summary
protected  java.lang.String encodeLiteralCharacters(java.lang.String characters)
          Encode literal characters of a template.
 java.util.List<java.lang.Integer> getGroupCounts()
          Get the capturing group counts for each template variable.
 int[] getGroupIndexes()
          Get the group indexes to capturing groups.
 java.util.List<java.lang.String> getNames()
          Get the list of template names.
 java.util.Map<java.lang.String,java.util.regex.Pattern> getNameToPattern()
          Get the map of template names to patterns.
 java.lang.String getNormalizedTemplate()
          Get the normalized template.
 int getNumberOfExplicitRegexes()
          Get the number of explicit regular expressions.
 int getNumberOfLiteralCharacters()
          Get the number of literal characters.
 java.util.regex.Pattern getPattern()
          Get the pattern.
 java.lang.String getTemplate()
          Get the template.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UriTemplateParser

public UriTemplateParser(java.lang.String template)
                  throws java.lang.IllegalArgumentException
Parse a template.

Parameters:
template - the template.
Throws:
java.lang.IllegalArgumentException - if the template is null, an empty string or does not conform to a JAX-RS URI template.
Method Detail

getTemplate

public final java.lang.String getTemplate()
Get the template.

Returns:
the template.

getPattern

public final java.util.regex.Pattern getPattern()
Get the pattern.

Returns:
the pattern.

getNormalizedTemplate

public final java.lang.String getNormalizedTemplate()
Get the normalized template.

A normalized template is a template without any explicit regular expressions.

Returns:
the normalized template.

getNameToPattern

public final java.util.Map<java.lang.String,java.util.regex.Pattern> getNameToPattern()
Get the map of template names to patterns.

Returns:
the map of template names to patterns.

getNames

public final java.util.List<java.lang.String> getNames()
Get the list of template names.

Returns:
the list of template names.

getGroupCounts

public final java.util.List<java.lang.Integer> getGroupCounts()
Get the capturing group counts for each template variable.

Returns:
the capturing group counts.

getGroupIndexes

public final int[] getGroupIndexes()
Get the group indexes to capturing groups.

Any nested capturing groups will be ignored and the the group index will refer to the top-level capturing groups associated with the templates variables.

Returns:
the group indexes to capturing groups.

getNumberOfExplicitRegexes

public final int getNumberOfExplicitRegexes()
Get the number of explicit regular expressions.

Returns:
the number of explicit regular expressions.

getNumberOfLiteralCharacters

public final int getNumberOfLiteralCharacters()
Get the number of literal characters.

Returns:
the number of literal characters.

encodeLiteralCharacters

protected java.lang.String encodeLiteralCharacters(java.lang.String characters)
Encode literal characters of a template.

Parameters:
characters - the literal characters
Returns:
the encoded literal characters.


Copyright © 2011 Oracle Corporation. All Rights Reserved.