Skip to content

Commit 12bb441

Browse files
committed
Merge pull request #10 from zaherhammoud/master
Added documentation to the index.xml for the user defined directives
2 parents 8ac597a + 73a86e3 commit 12bb441

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed

src/site/xdoc/index.xml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,47 @@ FROM City
266266
]]></source>
267267
</subsection>
268268
</section>
269+
<section name="User Defined Directives">
270+
<p>
271+
mybatis-velocity allows you to write your own velocity directive:
272+
</p>
273+
<ul>
274+
<li>
275+
Create a property file named mybatis-velocity.properties and put in on the classpath.
276+
</li>
277+
<li>
278+
Create your own velocity directive.
279+
</li>
280+
<li>
281+
Add the directive to the property file.
282+
</li>
283+
<li>
284+
Use the directive in the mapper xml file.
285+
<br/>
286+
</li>
287+
</ul>
288+
<p>Example:</p>
289+
290+
<source><![CDATA[
291+
// User defined directive
292+
package com.myproject.directives;
293+
294+
public class MyDirective extends Directive {
295+
296+
}
297+
298+
//mybatis-velocity.properties
299+
userdirective=com.myproject.directives.MyDirective,com.myproject.directives.SpecialDirective;
300+
301+
// mapper xml file
302+
SELECT *
303+
FROM City
304+
#myDirective()
305+
......
306+
#end
307+
]]></source>
308+
309+
</section>
269310
<section name="MyBatis specific syntax">
270311
<subsection name="Parameter Bindings">
271312
<p>@{ property, attr1=val1, attr2=val2, ... }</p>

0 commit comments

Comments
 (0)