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

Package freemarker.ext.beans

# Class LegacyDefaultMemberAccessPolicy

java.lang.Object
freemarker.ext.beans.LegacyDefaultMemberAccessPolicy

All Implemented Interfaces:
  `MemberAccessPolicy`

public final class LegacyDefaultMemberAccessPolicy extends Object implements MemberAccessPolicy
Legacy blacklist based member access policy, used only to keep old behavior, as it can't provide meaningful safety. Do not use it if you allow untrusted users to edit templates! Use `WhitelistMemberAccessPolicy` then.

Since:
  2.3.30

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static LegacyDefaultMemberAccessPolicy`
  `INSTANCE`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `ClassMemberAccessPolicy`
  `forClass​(Class<?> containingClass)`
  Returns the `ClassMemberAccessPolicy` that encapsulates the member access policy for a given class.
  `boolean`
  `isToStringAlwaysExposed()`
  If this returns `true`, we won't invoke the probably more expensive lookup to figure out if `Object.toString()` (including its overridden variants) is exposed for a given object.

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### INSTANCE

    public static final LegacyDefaultMemberAccessPolicy INSTANCE

- ## Method Details

  - ### forClass

    public ClassMemberAccessPolicy forClass​(Class<?> containingClass)
    Description copied from interface: `MemberAccessPolicy`
    Returns the `ClassMemberAccessPolicy` that encapsulates the member access policy for a given class. `ClassMemberAccessPolicy` implementations need not be thread-safe. Because class introspection results are cached, and so this method is usually only called once for a given class, the `ClassMemberAccessPolicy` instances shouldn't be cached by the implementation of this method.
    Specified by:
      `forClass` in interface `MemberAccessPolicy`
    Parameters:
      `containingClass` - The exact class of object from which members will be get in the templates.

  - ### isToStringAlwaysExposed

    public boolean isToStringAlwaysExposed()
    Description copied from interface: `MemberAccessPolicy`
    If this returns `true`, we won't invoke the probably more expensive lookup to figure out if `Object.toString()` (including its overridden variants) is exposed for a given object. If this returns `false`, then no such optimization is made. This method was introduced as `Object.toString()` is called frequently, as it's used whenever an object is converted to string, like printed to the output, and it's not even a reflection-based call (we just call `Object.toString()` in Java). So we try to avoid the overhead of a more generic method call.
    Specified by:
      `isToStringAlwaysExposed` in interface `MemberAccessPolicy`