API / Apache FreeMarker Interview questions
What are the types in FreeMarker's data model?
FreeMarker exposes every value supplied to a template as one of a small set of template model types, independent of the Java class behind it:
| Type | Description | Example |
| Scalar - string | Text value | "hello" |
| Scalar - number | Numeric value (int, double, BigDecimal all unify) | 42 |
| Scalar - boolean | true/false | true |
| Scalar - date/time | Date, time, or date-time value | .now |
| Sequence | Ordered, index-accessible list | [1, 2, 3] |
| Hash | Key-value map, keys are strings | {"a": 1} |
| Node | XML node, when XML is dropped into the model | - |
| Method / function | A callable exposed to the template | - |
A given Java object can implement more than one of these template model interfaces at once - for example, a Java List wrapped by the default object wrapper behaves as a sequence.
More Related questions...