The Proxy Pattern

Code structure (Java)
  • Interface "Subject" and Class "RealSubject" as shown in the UML Class Diagram

  • Proxy code

    public class Proxy implements Subject
    {
      private RealSubject realSubject;

      public void sampleOperation()
      {
        // Additional operations here...
        realSubject.sampleOperation();
      }
    }