public final class DefaultMemberAccessPolicy extends java.lang.Object implements MemberAccessPolicy
WhitelistMemberAccessPolicy
if you need stricter control.Modifier and Type | Method and Description |
---|---|
ClassMemberAccessPolicy |
forClass(java.lang.Class<?> contextClass)
Returns the
ClassMemberAccessPolicy that encapsulates the member access policy for a given class. |
static DefaultMemberAccessPolicy |
getInstance(Version incompatibleImprovements)
Returns the singleton that's compatible with the given incompatible improvements version.
|
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. |
public static DefaultMemberAccessPolicy getInstance(Version incompatibleImprovements)
public ClassMemberAccessPolicy forClass(java.lang.Class<?> contextClass)
MemberAccessPolicy
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.forClass
in interface MemberAccessPolicy
contextClass
- The exact class of object from which members will be get in the templates.public boolean isToStringAlwaysExposed()
MemberAccessPolicy
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.isToStringAlwaysExposed
in interface MemberAccessPolicy