You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@freemarker.apache.org by dd...@apache.org on 2016/06/04 19:52:05 UTC

incubator-freemarker git commit: Manual: Added a note about implementing directives and methods in Java, so the less people misses this.

Repository: incubator-freemarker
Updated Branches:
  refs/heads/2.3-gae 43caaaf9d -> 6eb6ed7a8


Manual: Added a note about implementing directives and methods in Java, so the less people misses this.


Project: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/commit/6eb6ed7a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/tree/6eb6ed7a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/diff/6eb6ed7a

Branch: refs/heads/2.3-gae
Commit: 6eb6ed7a874154fdf15c4a20bbe62eece7ebd846
Parents: 43caaaf
Author: ddekany <dd...@apache.org>
Authored: Sat Jun 4 21:51:56 2016 +0200
Committer: ddekany <dd...@apache.org>
Committed: Sat Jun 4 21:51:56 2016 +0200

----------------------------------------------------------------------
 src/manual/en_US/book.xml | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/6eb6ed7a/src/manual/en_US/book.xml
----------------------------------------------------------------------
diff --git a/src/manual/en_US/book.xml b/src/manual/en_US/book.xml
index e714128..1965625 100644
--- a/src/manual/en_US/book.xml
+++ b/src/manual/en_US/book.xml
@@ -4782,6 +4782,22 @@ ${("green " + "mouse")?upper_case}  &lt;#-- GREEN MOUSE --&gt;
           <para>Also, you may interested in namespaces: <xref
           linkend="dgui_misc_namespace"/>. Namespaces help you to organize and
           reuse your commonly used macros.</para>
+
+          <para>Java programmers might want to know that directives (macros
+          are directives) and methods (function-like things) can also be
+          written in Java language, by<link
+          linkend="pgui_datamodel_directive"> implementing the
+          <literal>TemplateDirectiveModel</literal></link> or
+          <literal>TemplateMethodModelEx</literal> interfaces, respectively.
+          Then you can pull in the Java implementations into the template like
+          <literal>&lt;#assign foo =
+          "com.example.FooDirective"?new()&gt;</literal> or
+          <literal>&lt;#assign foo =
+          "com.example.FooMethod"?new()&gt;</literal> on the same place where
+          you would have <literal>&lt;#macro foo
+          <replaceable>...</replaceable>&gt;</literal> or
+          <literal>&lt;#function foo
+          <replaceable>...</replaceable>&gt;</literal> otherwise.</para>
         </section>
       </section>