Package freemarker.ext.beans
Class LegacyDefaultMemberAccessPolicy
- java.lang.Object
-
- freemarker.ext.beans.LegacyDefaultMemberAccessPolicy
-
- All Implemented Interfaces:
MemberAccessPolicy
public final class LegacyDefaultMemberAccessPolicy extends java.lang.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! UseWhitelistMemberAccessPolicythen.- Since:
- 2.3.30
-
-
Field Summary
Fields Modifier and Type Field Description static LegacyDefaultMemberAccessPolicyINSTANCE
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ClassMemberAccessPolicyforClass(java.lang.Class<?> containingClass)Returns theClassMemberAccessPolicythat encapsulates the member access policy for a given class.booleanisToStringAlwaysExposed()If this returnstrue, we won't invoke the probably more expensive lookup to figure out ifObject.toString()(including its overridden variants) is exposed for a given object.
-
-
-
Field Detail
-
INSTANCE
public static final LegacyDefaultMemberAccessPolicy INSTANCE
-
-
Method Detail
-
forClass
public ClassMemberAccessPolicy forClass(java.lang.Class<?> containingClass)
Description copied from interface:MemberAccessPolicyReturns theClassMemberAccessPolicythat encapsulates the member access policy for a given class.ClassMemberAccessPolicyimplementations need not be thread-safe. Because class introspection results are cached, and so this method is usually only called once for a given class, theClassMemberAccessPolicyinstances shouldn't be cached by the implementation of this method.- Specified by:
forClassin interfaceMemberAccessPolicy- Parameters:
containingClass- The exact class of object from which members will be get in the templates.
-
isToStringAlwaysExposed
public boolean isToStringAlwaysExposed()
Description copied from interface:MemberAccessPolicyIf this returnstrue, we won't invoke the probably more expensive lookup to figure out ifObject.toString()(including its overridden variants) is exposed for a given object. If this returnsfalse, then no such optimization is made. This method was introduced asObject.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 callObject.toString()in Java). So we try to avoid the overhead of a more generic method call.- Specified by:
isToStringAlwaysExposedin interfaceMemberAccessPolicy
-
-