summaryrefslogtreecommitdiffstats
path: root/jdisc_core/src/main/java/com/yahoo/jdisc/handler/DelegatedRequestHandler.java
blob: 540fe03accf18584cfb06ebae84892c363e7bd3e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
// Copyright Verizon Media. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.

package com.yahoo.jdisc.handler;

public interface DelegatedRequestHandler extends RequestHandler {
    RequestHandler getDelegate();

    default RequestHandler getDelegateRecursive() {
        RequestHandler delegate = getDelegate();
        while(delegate instanceof DelegatedRequestHandler) {
            delegate = ((DelegatedRequestHandler) delegate).getDelegate();
        }
        return delegate;
    }
}