Class DefaultObjectWrapper

All Implemented Interfaces:
ObjectWrapper, ObjectWrapperAndUnwrapper, ObjectWrapperWithAPISupport, RichObjectWrapper, WriteProtectable
Direct Known Subclasses:

public class DefaultObjectWrapper extends BeansWrapper
The default implementation of the ObjectWrapper interface. Usually, you don't need to create instances of this, as an instance of this is already the default value of the object_wrapper setting. Then the incompatibleImprovements of the DefaultObjectWrapper will be the same that you have set for the Configuration itself. As of this writing, it's highly recommended to use incompatibleImprovements 2.3.22 (or higher).

If you still need to create an instance, that should be done with an DefaultObjectWrapperBuilder (or with Configuration.setSetting(String, String) with "object_wrapper" key), not with its constructor, as that allows FreeMarker to reuse singletons. For new projects, it's recommended to set forceLegacyNonListCollections to false, and iterableSupport to true; setting incompatibleImprovements to 2.3.22 won't do these, as they could break legacy templates too easily.

This class is only thread-safe after you have finished calling its setter methods, and then safely published it (see JSR 133 and related literature). When used as part of Configuration, of course it's enough if that was safely published and then left unmodified.