Package freemarker.ext.beans
Class BlacklistMemberAccessPolicy
java.lang.Object
freemarker.ext.beans.MemberSelectorListMemberAccessPolicy
freemarker.ext.beans.BlacklistMemberAccessPolicy
- All Implemented Interfaces:
MemberAccessPolicy
Blacklist-based member access policy, that is, members that are matched by the listing will not be accessible, all
others will be. Note that
BeansWrapper
and its subclasses doesn't discover all members on the first place,
and the MemberAccessPolicy
just removes from that set of members, never adds to it.
This class is rarely useful in itself, and mostly meant to be used when composing a MemberAccessPolicy
from other MemberAccessPolicy
-es. If you are serious about security, never use this alone; consider using
WhitelistMemberAccessPolicy
as part of your solution.
See more about the rules at MemberSelectorListMemberAccessPolicy
. Unlike
WhitelistMemberAccessPolicy
, BlacklistMemberAccessPolicy
doesn't have annotations that can be used
to add members to the member selector list.
- Since:
- 2.3.30
-
Nested Class Summary
Nested classes/interfaces inherited from class freemarker.ext.beans.MemberSelectorListMemberAccessPolicy
MemberSelectorListMemberAccessPolicy.MemberSelector
-
Constructor Summary
ConstructorDescriptionBlacklistMemberAccessPolicy(Collection<? extends MemberSelectorListMemberAccessPolicy.MemberSelector> memberSelectors)
-
Method Summary
Modifier and TypeMethodDescriptionboolean
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.Methods inherited from class freemarker.ext.beans.MemberSelectorListMemberAccessPolicy
forClass
-
Constructor Details
-
BlacklistMemberAccessPolicy
public BlacklistMemberAccessPolicy(Collection<? extends MemberSelectorListMemberAccessPolicy.MemberSelector> memberSelectors)- Parameters:
memberSelectors
- List of member selectors; seeMemberSelectorListMemberAccessPolicy
class-level documentation for more.
-
-
Method Details
-
isToStringAlwaysExposed
public boolean isToStringAlwaysExposed()Description copied from interface:MemberAccessPolicy
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. 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.
-