summaryrefslogtreecommitdiffstats
path: root/jaxrs_client_utils/src/main/java/com/yahoo/vespa/jaxrs/client/LocalPassThroughJaxRsStrategy.java
blob: 759db5ef9b435a59afcc9035f5a284ac9fc186d2 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.jaxrs.client;

import java.io.IOException;
import java.util.function.Function;

/**
 * A {@link JaxRsStrategy} that does not use the network, only forwards calls to a local object.
 *
 * @author bakksjo
 */
public class LocalPassThroughJaxRsStrategy<T> implements JaxRsStrategy<T> {
    private final T api;

    public LocalPassThroughJaxRsStrategy(final T api) {
        this.api = api;
    }

    @Override
    public <R> R apply(final Function<T, R> function) throws IOException {
        return function.apply(api);
    }
}