rewrite-impl-config 1.0.5.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
static interface ParameterizedPattern.Transposition
           
 
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(Rewrite event, EvaluationContext context)
          Use this expression to build a String from the given pattern.
 String build(Rewrite event, EvaluationContext context, Map<String,? extends Bindable<?>> parameters)
          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's pattern to build a String from the given values.
 Matcher getMatcher(String value)
           
 RegexCapture getParameter(String name)
          Get the Parameter with the given name.
 List<String> getParameterNames()
          Get a List of all defined Parameter names.
 Map<String,RegexCapture> 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<RegexCapture,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,RegexCapture> getParameters()
Get all Parameter instances detected during expression parsing.


build

public String build(Rewrite event,
                    EvaluationContext context,
                    Map<String,? extends Bindable<?>> parameters)
Use this expression to build a String from the given pattern. Extract needed values from registered Binding instances.


build

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


buildUnsafe

public String buildUnsafe(Object... values)
Use this expression's pattern to build a String from the given values. Enforces that the number of values 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<RegexCapture,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 RegexCapture 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 Parameter names.


toString

public String toString()
Overrides:
toString in class Object

rewrite-impl-config 1.0.5.Final

Copyright © 2012 OCPsoft. All Rights Reserved.