Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.mule.util
Class TemplateParser

    java.lang.Object
      org.mule.util.TemplateParser

    public final class TemplateParser

extends Object

`TemplateParser` is a simple string parser that will substitute tokens in a string with values supplied in a Map.

Nested Class Summary
`static class` | `TemplateParser.PatternInfo`
`static interface` | `TemplateParser.TemplateCallback`

Field Summary
`static Pattern` | `ANT_TEMPLATE_PATTERN`
`static String` | `ANT_TEMPLATE_STYLE`
`static Pattern` | `CURLY_TEMPLATE_PATTERN`
`static String` | `CURLY_TEMPLATE_STYLE`
`protected static Log` | `logger` logger used by this class
`static Pattern` | `SQUARE_TEMPLATE_PATTERN`
`static String` | `SQUARE_TEMPLATE_STYLE`
`static Pattern` | `WIGGLY_MULE_TEMPLATE_PATTERN`
`static String` | `WIGGLY_MULE_TEMPLATE_STYLE`

Method Summary
`static TemplateParser` | `createAntStyleParser()`
`static TemplateParser` | `createCurlyBracesStyleParser()`
`static TemplateParser` | `createMuleStyleParser()`
`static TemplateParser` | `createSquareBracesStyleParser()`
`TemplateParser.PatternInfo` | `getStyle()`
`boolean` | `isContainsTemplate(String value)`
`boolean` | `isValid(String expression)`
`List` | `parse(Map props, List templates)` Matches one or more templates against a Map of key value pairs.
`Map` | `parse(Map props, Map templates)` Matches one or more templates against a Map of key value pairs.
`String` | `parse(Map props, String template)` Matches one or more templates against a Map of key value pairs.
`protected String` | `parse(Map props, String template, TemplateParser.TemplateCallback callback)`
`Map` | `parse(TemplateParser.TemplateCallback callback, Map templates)`
`String` | `parse(TemplateParser.TemplateCallback callback, String template)` Matches one or more templates against a Map of key value pairs.
`void` | `validate(String expression)`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### ANT_TEMPLATE_STYLE

    public static final String ANT_TEMPLATE_STYLE

See Also:
  Constant Field Values

### SQUARE_TEMPLATE_STYLE

    public static final String SQUARE_TEMPLATE_STYLE

See Also:
  Constant Field Values

### CURLY_TEMPLATE_STYLE

    public static final String CURLY_TEMPLATE_STYLE

See Also:
  Constant Field Values

### WIGGLY_MULE_TEMPLATE_STYLE

    public static final String WIGGLY_MULE_TEMPLATE_STYLE

See Also:
  Constant Field Values

### logger

    protected static final Log logger

  logger used by this class

### ANT_TEMPLATE_PATTERN

    public static final Pattern ANT_TEMPLATE_PATTERN

### SQUARE_TEMPLATE_PATTERN

    public static final Pattern SQUARE_TEMPLATE_PATTERN

### CURLY_TEMPLATE_PATTERN

    public static final Pattern CURLY_TEMPLATE_PATTERN

### WIGGLY_MULE_TEMPLATE_PATTERN

    public static final Pattern WIGGLY_MULE_TEMPLATE_PATTERN

Method Detail

### createAntStyleParser

    public static TemplateParser createAntStyleParser()

### createSquareBracesStyleParser

    public static TemplateParser createSquareBracesStyleParser()

### createCurlyBracesStyleParser

    public static TemplateParser createCurlyBracesStyleParser()

### createMuleStyleParser

    public static TemplateParser createMuleStyleParser()

### parse

    public String parse(Map props,
                        String template)

  Matches one or more templates against a Map of key value pairs. If a value for a template is not found in the map the template is left as is in the return String

  Parameters:
    `props` - the key/value pairs to match against
    `template` - the string containing the template place holders i.e. My name is ${name}
  Returns:
    the parsed String

### parse

    public String parse(TemplateParser.TemplateCallback callback,
                        String template)

  Matches one or more templates against a Map of key value pairs. If a value for a template is not found in the map the template is left as is in the return String

  Parameters:
    `callback` - a callback used to resolve the property name
    `template` - the string containing the template place holders i.e. My name is ${name}
  Returns:
    the parsed String

### parse

    protected String parse(Map props,
                           String template,
                           TemplateParser.TemplateCallback callback)

### parse

    public List parse(Map props,
                      List templates)

  Matches one or more templates against a Map of key value pairs. If a value for a template is not found in the map the template is left as is in the return String

  Parameters:
    `props` - the key/value pairs to match against
    `templates` - A List of templates
  Returns:
    the parsed String

### parse

    public Map parse(Map props,
                     Map templates)

  Matches one or more templates against a Map of key value pairs. If a value for a template is not found in the map the template is left as is in the return String

  Parameters:
    `props` - the key/value pairs to match against
    `templates` - A Map of templates. The values for each map entry will be parsed
  Returns:
    the parsed String

### parse

    public Map parse(TemplateParser.TemplateCallback callback,
                     Map templates)

### getStyle

    public TemplateParser.PatternInfo getStyle()

### isContainsTemplate

    public boolean isContainsTemplate(String value)

### isValid

    public boolean isValid(String expression)

### validate

    public void validate(String expression)
                  throws IllegalArgumentException

  Throws:
    `IllegalArgumentException`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2003-2010 MuleSoft, Inc.. All Rights Reserved.