rewrite-impl-config 1.0.3.Final

org.ocpsoft.rewrite.bind
Class ParameterizedPattern

java.lang.Object
  extended by org.ocpsoft.rewrite.bind.ParameterizedPattern

public class ParameterizedPattern
extends Object

An Parameterized regular expression Pattern.

Author:
Lincoln Baxter, III

Nested Class Summary
 class ParameterizedPattern.RegexParameter
           
 
Constructor Summary
ParameterizedPattern(CaptureType type, String pattern)
          Create a new ParameterizedPattern instance with the default parameter regex of ".*".
ParameterizedPattern(CaptureType type, String parameterPattern, String pattern)
          Create a new ParameterizedPattern instance.
ParameterizedPattern(String pattern)
          Create a new ParameterizedPattern instance with the default CaptureType.BRACE and parameter pattern of ".*".
ParameterizedPattern(String parameterPattern, String pattern)
          Create a new ParameterizedPattern instance with the default CaptureType.BRACE.
 
Method Summary
 String build(Map<String,List<Object>> values)
          Use this expression to build a String from the given pattern and values.
 String build(Object... values)
          Use this expression to build a String from the given pattern and values.
 String build(Rewrite event, EvaluationContext context)
          Use this expression to build a String from the given pattern.
 String buildUnsafe(Map<String,List<Object>> values)
          Use this expression to build a String from the given pattern and values.
 String buildUnsafe(Object... values)
          Use this expression to build a String from the given pattern and values.
 Matcher getMatcher(String value)
           
 ParameterizedPattern.RegexParameter getParameter(String name)
          Get the Parameter with the given name.
 List<String> getParameterNames()
          Get a List of all defined ParameterizedPattern.RegexParameter names.
 Map<String,ParameterizedPattern.RegexParameter> getParameters()
          Get all Parameter instances detected during expression parsing.
 boolean matches(Rewrite event, EvaluationContext context, String value)
          Return true if this expression matches the given String.
 Map<ParameterizedPattern.RegexParameter,String[]> parse(Rewrite event, EvaluationContext context, String path)
          Parses the given string if it matches this expression.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ParameterizedPattern

public ParameterizedPattern(String pattern)
Create a new ParameterizedPattern instance with the default CaptureType.BRACE and parameter pattern of ".*".


ParameterizedPattern

public ParameterizedPattern(String parameterPattern,
                            String pattern)
Create a new ParameterizedPattern instance with the default CaptureType.BRACE.


ParameterizedPattern

public ParameterizedPattern(CaptureType type,
                            String pattern)
Create a new ParameterizedPattern instance with the default parameter regex of ".*".


ParameterizedPattern

public ParameterizedPattern(CaptureType type,
                            String parameterPattern,
                            String pattern)
Create a new ParameterizedPattern instance.

Method Detail

getParameters

public Map<String,ParameterizedPattern.RegexParameter> getParameters()
Get all Parameter instances detected during expression parsing.


build

public String build(Rewrite event,
                    EvaluationContext context)
Use this expression to build a String from the given pattern. Extract needed values from registered Binding instances.


build

public String build(Object... values)
Use this expression to build a String from the given pattern and values.


buildUnsafe

public String buildUnsafe(Object... values)
Use this expression to build a String from the given pattern and values. Enforces that the number of values passed must equal the number of expression parameters.


build

public String build(Map<String,List<Object>> values)
Use this expression to build a String from the given pattern and values. Enforces that the number of keys passed must equal the number of expression parameters.


buildUnsafe

public String buildUnsafe(Map<String,List<Object>> values)
Use this expression to build a String from the given pattern and values.


matches

public boolean matches(Rewrite event,
                       EvaluationContext context,
                       String value)
Return true if this expression matches the given String.


getMatcher

public Matcher getMatcher(String value)

parse

public Map<ParameterizedPattern.RegexParameter,String[]> parse(Rewrite event,
                                                               EvaluationContext context,
                                                               String path)
Parses the given string if it matches this expression. Returns a Parameter-value map of parsed values.


getParameter

public ParameterizedPattern.RegexParameter getParameter(String name)
Get the Parameter with the given name. Return null if no such Parameter exists.


getParameterNames

public List<String> getParameterNames()
Get a List of all defined ParameterizedPattern.RegexParameter names.


toString

public String toString()
Overrides:
toString in class Object

rewrite-impl-config 1.0.3.Final

Copyright © 2012 OCPsoft. All Rights Reserved.