MCPcopy Create free account
hub / github.com/apache/freemarker / accept

Method accept

src/main/java/freemarker/core/RecurseNode.java:71–95  ·  view source on GitHub ↗
(Environment env)

Source from the content-addressed store, hash-verified

69 }
70
71 void accept(Environment env) throws IOException, TemplateException {
72 TemplateModel node = targetNode == null ? null : targetNode.getAsTemplateModel(env);
73 TemplateModel nss = namespaces == null ? null : namespaces.getAsTemplateModel(env);
74 if (namespaces instanceof StringLiteral) {
75 nss = env.importLib(((TemplateScalarModel) nss).getAsString(), null);
76 }
77 else if (namespaces instanceof ListLiteral) {
78 nss = ((ListLiteral) namespaces).evaluateStringsToNamespaces(env);
79 }
80 if (node != null && !(node instanceof TemplateNodeModel)) {
81 throw new TemplateException("Expecting an XML node here, for expression: " + targetNode + ", found a: " + node.getClass().getName(), env);
82 }
83 if (nss != null) {
84 if (nss instanceof TemplateHashModel) {
85 SimpleSequence ss = new SimpleSequence(1);
86 ss.add(nss);
87 nss = ss;
88 }
89 else if (!(nss instanceof TemplateSequenceModel)) {
90 throw new TemplateException("Expecting a sequence of namespaces after 'using'", env);
91 }
92 }
93
94 env.recurse((TemplateNodeModel) node, (TemplateSequenceModel) nss);
95 }
96
97 public String getCanonicalForm() {
98 String result = "<#recurse";

Callers

nothing calls this directly

Calls 8

addMethod · 0.95
getAsTemplateModelMethod · 0.80
importLibMethod · 0.80
getClassMethod · 0.80
recurseMethod · 0.80
getAsStringMethod · 0.65
getNameMethod · 0.45

Tested by

no test coverage detected