Class Proxy

java.lang.Object
Structural.Proxy.Proxy
All Implemented Interfaces:
Subject

public class Proxy extends Object implements Subject
The Proxy controls access to the RealSubject. The Proxy adds additional functionality such as authentication or lazy initialization.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Proxy(boolean isAuthenticated)
    Constructs the Proxy with authentication status.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    request(String resource)
    Handles the request by checking authentication and delegating to RealSubject.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Proxy

      public Proxy(boolean isAuthenticated)
      Constructs the Proxy with authentication status.
      Parameters:
      isAuthenticated - Whether the client is authenticated.
  • Method Details

    • request

      public void request(String resource)
      Handles the request by checking authentication and delegating to RealSubject.
      Specified by:
      request in interface Subject
      Parameters:
      resource - The resource being requested.