Package org.drools.template.model
Class SnippetBuilder
- java.lang.Object
-
- org.drools.template.model.SnippetBuilder
-
public class SnippetBuilder extends java.lang.ObjectThis utility class exists to convert rule script snippets to actual code. The snippets contain place holders for values to be substituted into. See the test case for how it really works ! Snippet template example: "something.getBlah($param)" $param is the "place holder". This will get replaced with the "cellValue" that is passed in. 12-Oct-2005 change: moved from regex to using simple character based interpolation. Regex was overkill and couldn't not quite get it right.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classSnippetBuilder.SnippetType
-
Field Summary
Fields Modifier and Type Field Description static java.util.regex.PatternPARAM_FORALL_PATTERNstatic java.lang.StringPARAM_FORALL_STRINGstatic java.lang.StringPARAM_PREFIXstatic java.lang.StringPARAM_STRINGstatic java.lang.StringPARAM_SUFFIX
-
Constructor Summary
Constructors Constructor Description SnippetBuilder(java.lang.String snippetTemplate)SnippetBuilder(java.lang.String snippetTemplate, boolean trim)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Stringbuild(java.lang.String cellValue)static SnippetBuilder.SnippetTypegetType(java.lang.String template)
-
-
-
Field Detail
-
PARAM_PREFIX
public static final java.lang.String PARAM_PREFIX
- See Also:
- Constant Field Values
-
PARAM_SUFFIX
public static final java.lang.String PARAM_SUFFIX
- See Also:
- Constant Field Values
-
PARAM_STRING
public static final java.lang.String PARAM_STRING
- See Also:
- Constant Field Values
-
PARAM_FORALL_STRING
public static final java.lang.String PARAM_FORALL_STRING
- See Also:
- Constant Field Values
-
PARAM_FORALL_PATTERN
public static final java.util.regex.Pattern PARAM_FORALL_PATTERN
-
-
Method Detail
-
getType
public static SnippetBuilder.SnippetType getType(java.lang.String template)
-
build
public java.lang.String build(java.lang.String cellValue)
- Parameters:
cellValue- The value from the cell to populate the snippet with. If no place holder exists, will just return the snippet.- Returns:
- The final snippet.
-
-