Interface ObjectWrapperAndUnwrapper

All Superinterfaces:
ObjectWrapper
All Known Subinterfaces:
RichObjectWrapper
All Known Implementing Classes:
BeansWrapper, DefaultObjectWrapper, RhinoWrapper, SimpleObjectWrapper

public interface ObjectWrapperAndUnwrapper extends ObjectWrapper
Experimental - subject to change: Adds functionality to ObjectWrapper that creates a plain Java object from a TemplateModel. This is usually implemented by ObjectWrapper-s and reverses ObjectWrapper.wrap(Object). However, an implementation of this interface should make a reasonable effort to "unwrap" TemplateModel-s that wasn't the result of object wrapping (such as those created directly in FTL), or which was created by another ObjectWrapper. The author of an ObjectWrapperAndUnwrapper should be aware of the TemplateModelAdapter and WrapperTemplateModel interfaces, which should be used for unwrapping if the TemplateModel implements them.

Experimental status warning: This interface is subject to change on non-backward compatible ways, hence, it shouldn't be implemented outside FreeMarker yet.

Since:
2.3.22
  • Field Details

    • CANT_UNWRAP_TO_TARGET_CLASS

      static final Object CANT_UNWRAP_TO_TARGET_CLASS
      Indicates that while the unwrapping is maybe possible, the result surely can't be the instance of the desired class, nor it can be null.
      Since:
      2.3.22
      See Also:
      tryUnwrapTo(TemplateModel, Class)
  • Method Details