freemarker.ext.beans (FreeMarker 2.3.35 API)
Description: declaration: package: freemarker.ext.beans

# Package freemarker.ext.beans

package freemarker.ext.beans
The default object wrapper of FreeMarker uses this to expose Java Beans and POJO-s to templates.

Most of the issues dealing with beans are handled by the `BeansWrapper.wrap(Object)` and `BeansWrapper.getStaticModels()` methods. In normal cases, these are the only methods you should use to turn an arbitrary Java object into a FreeMarker `TemplateModel`. Additionally, you can manually create instance of any wrapper class using its constructors. Note, however that in such cases you bypass the eventual model caching of the wrapper.

- Interface Summary
  Interface
  Description
  ClassMemberAccessPolicy
  Returned by `MemberAccessPolicy.forClass(Class)`.
  MemberAccessPolicy
  Implement this to restrict what class members (methods, fields, constructors) are accessible from templates.
  MethodAppearanceFineTuner
  Used for customizing how the Java methods are visible from templates, via `BeansWrapper.setMethodAppearanceFineTuner(MethodAppearanceFineTuner)`.
  SingletonCustomizer
  Marker interface useful when used together with `MethodAppearanceFineTuner` and such customizer objects, to indicate that it doesn't contain reference to the `ObjectWrapper` (so beware with non-static inner classes) and can be and should be used in call introspection cache keys.
- Class Summary
  Class
  Description
  ArrayModel
  A class that will wrap an arbitrary array into `TemplateCollectionModel` and `TemplateSequenceModel` interfaces.
  BeanModel
  A class that will wrap an arbitrary object into `TemplateHashModel` interface allowing calls to arbitrary property getters and invocation of accessible methods on the object from a template using the `object.foo` to access properties and `object.bar(arg1, arg2)` to invoke methods on it.
  BeansModelCache
  BeansWrapper
  `ObjectWrapper` that is able to expose the Java API of arbitrary Java objects.
  BeansWrapper.MethodAppearanceDecision
  Used for `MethodAppearanceFineTuner.process(freemarker.ext.beans.BeansWrapper.MethodAppearanceDecisionInput, freemarker.ext.beans.BeansWrapper.MethodAppearanceDecision)` to store the results; see there.
  BeansWrapper.MethodAppearanceDecisionInput
  Used for `MethodAppearanceFineTuner.process(freemarker.ext.beans.BeansWrapper.MethodAppearanceDecisionInput, freemarker.ext.beans.BeansWrapper.MethodAppearanceDecision)` as input parameter; see there.
  BeansWrapperBuilder
  Gets/creates a `BeansWrapper` singleton instance that's already configured as specified in the properties of this object; this is recommended over using the `BeansWrapper` constructors.
  BeansWrapperConfiguration
  Holds `BeansWrapper` configuration settings and defines their defaults.
  BlacklistMemberAccessPolicy
  Blacklist-based member access policy, that is, members that are matched by the listing will not be accessible, all others will be.
  BooleanModel
  A class that will wrap instances of `Boolean` into a `TemplateBooleanModel`.
  CollectionModel
  A special case of `BeanModel` that can wrap Java collections and that implements the `TemplateCollectionModel` in order to be usable in a `<#list>` block.
  DateModel
  Wraps arbitrary subclass of `Date` into a reflective model.
  DefaultMemberAccessPolicy
  Member access policy to implement the default behavior that's mostly compatible with pre-2.3.30 versions, but is somewhat safer; it still can't provide safety in practice, if you allow untrusted users to edit templates! Use `WhitelistMemberAccessPolicy` if you need stricter control.
  EnumerationModel
  A class that adds `TemplateModelIterator` functionality to the `Enumeration` interface implementers.
  GenericObjectModel
  This is used for wrapping objects that has no special treatment (unlike `Map`-s, `Collection`-s, `Number`-s, `Boolean`-s, and some more, which have), hence they are just "generic" Java objects.
  HashAdapter
  IteratorModel
  A class that adds `TemplateModelIterator` functionality to the `Iterator` interface implementers.
  LegacyDefaultMemberAccessPolicy
  Legacy blacklist based member access policy, used only to keep old behavior, as it can't provide meaningful safety.
  MapModel
  A special case of `BeanModel` that adds implementation for `TemplateMethodModelEx` on map objects that is a shortcut for the `Map.get()` method.
  MemberSelectorListMemberAccessPolicy
  Superclass for member-selector-list-based member access policies, like `WhitelistMemberAccessPolicy`.
  MemberSelectorListMemberAccessPolicy.MemberSelector
  A condition that matches some type members.
  NumberModel
  Wraps arbitrary subclass of `Number` into a reflective model.
  OverloadedMethodsModel
  Wraps a set of same-name overloaded methods behind `TemplateMethodModel` interface, like if it was a single method, chooses among them behind the scenes on call-time based on the argument values.
  ResourceBundleModel
  A hash model that wraps a resource bundle.
  SimpleMapModel
  Model used by `BeansWrapper` when `simpleMapWrapper` mode is enabled.
  SimpleMethodModel
  A class that will wrap a reflected method call into a `TemplateMethodModel` interface.
  StringModel
  Deprecated.
  Use `GenericObjectModel` instead, which implements `MethodCallAwareTemplateHashModel`.
  WhitelistMemberAccessPolicy
  Whitelist-based member access policy, that is, only members that are matched by the listing will be exposed.
- Enum Class Summary
  Enum Class
  Description
  ZeroArgumentNonVoidMethodPolicy
  How to show 0 argument non-void public methods to templates.
- Exception Summary
  Exception
  Description
  InvalidPropertyException
  An exception thrown when there is an attempt to access an invalid bean property when we are in a "strict bean" mode
- Annotation Interfaces Summary
  Annotation Interface
  Description
  TemplateAccessible
  Indicates that the the annotated member can be exposed to templates; if the annotated member will be actually exposed depends on the `ObjectWrapper` in use, and how that was configured.