What’s It Called: Inner Class Without Sharing?

I believe I have heard a specific term for this pattern, but I am not able to retrieve it from the foggy banks of my memory:

public with sharing class OuterClass
    public without sharing class InnerClass { }

What term describes InnerClass above? How about the pattern in general?


I believe the term you’re looking for is Trampoline because it allows a developer to “Bounce” up into a higher security context. Trampolines should be written very carefully and validate their parameters and be well documented in place as to the why such behavior is needed.

It is important to note that a trampoline will only ever bypass sharing and not field level security. This is because Field Level security is already not enforced in apex.

Source : Link , Question Author : Adrian Larson , Answer Author : Mgetz

Leave a Comment