2.3.9 - FreeMarker Manual

- Home
- Manual
- Java API

- Contribute
- Report a Bug
- Download

Manual
Previous Next

# 2.3.9

Date of release: 2007-01-23

This release contains support for accessing JDK 1.5 enums and public fields of classes from the templates through the BeansWrapper.

## Changes on the Java side

- `BeansWrapper` can now expose public fields of objects to the template if you call the `setExposeFields(true)` on it. More info...

- `BeansWrapper` can now pass any sequence model to Java methods expecting a `java.util.Collection` or a native Java array (including primitive arrays). More info...

- `BeansWrapper` can now pass any sequence and collection model to Java methods expecting a `java.lang.Iterable`. More info...

- `BeansWrapper` can now unwrap numeric models into correct target types when passing to Java methods expecting a primitive or boxed number. Use of various expert built-ins to manually coerce the types becomes mostly unnecessary.

- Fixed a bug where `BeansWrapper` would pass a `java.util.Collection` to a method expecting a `java.util.Set` in certain rare cases. More info...

- Support for JDK 1.5 enums in `BeansWrapper` and `DefaultObjectWrapper`. By calling the `getEnumModels()` method, you can retrieve a hash model that is keyed by class names and allows access to enumerated values. I.e. if you bind this hash model under name `enums` in the data-model, you can write expressions like `enums["java.math.RoundingMode"].UP` in the template. The enum values can be used as scalars and support equality and inequality comparisons. More info...

- `freemarker.ext.rhino.RhinoWrapper` now correctly translates Rhino `Undefined` instance, `UniqueTag.NOT_FOUND`, and `UniqueTag.NULL` to FreeMarker undefined value.

Previous Next