|
| 1 | +/* |
| 2 | + * Copyright (c) 2019, 2021 Oracle and/or its affiliates. All rights reserved. |
| 3 | + * Copyright (c) 2018 Payara Foundation and/or its affiliates. All rights reserved. |
| 4 | + * |
| 5 | + * This program and the accompanying materials are made available under the |
| 6 | + * terms of the Eclipse Public License v. 2.0, which is available at |
| 7 | + * http://www.eclipse.org/legal/epl-2.0. |
| 8 | + * |
| 9 | + * This Source Code may also be made available under the following Secondary |
| 10 | + * Licenses when the conditions for such availability set forth in the |
| 11 | + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, |
| 12 | + * version 2 with the GNU Classpath Exception, which is available at |
| 13 | + * https://www.gnu.org/software/classpath/license.html. |
| 14 | + * |
| 15 | + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 |
| 16 | + */ |
| 17 | +package org.glassfish.jersey.client; |
| 18 | + |
| 19 | + |
| 20 | +import org.glassfish.jersey.internal.BootstrapBag; |
| 21 | +import org.glassfish.jersey.client.inject.ParameterUpdaterProvider; |
| 22 | +import org.glassfish.jersey.internal.util.collection.LazyValue; |
| 23 | +import org.glassfish.jersey.spi.ComponentProvider; |
| 24 | + |
| 25 | +import javax.ws.rs.core.GenericType; |
| 26 | +import java.util.Collection; |
| 27 | + |
| 28 | +/** |
| 29 | + * {@inheritDoc} |
| 30 | + * <p> |
| 31 | + * This bootstrap bag is specialized for client part of Jersey. |
| 32 | + * |
| 33 | + * @author Gaurav Gupta (gaurav.gupta@payara.fish) |
| 34 | + */ |
| 35 | +public class ClientBootstrapBag extends BootstrapBag { |
| 36 | + |
| 37 | + private ParameterUpdaterProvider parameterUpdaterProvider; |
| 38 | + private LazyValue<Collection<ComponentProvider>> componentProviders; |
| 39 | + |
| 40 | + public ParameterUpdaterProvider getParameterUpdaterProvider() { |
| 41 | + requireNonNull(parameterUpdaterProvider, ParameterUpdaterProvider.class); |
| 42 | + return parameterUpdaterProvider; |
| 43 | + } |
| 44 | + |
| 45 | + public void setParameterUpdaterProvider(ParameterUpdaterProvider provider) { |
| 46 | + this.parameterUpdaterProvider = provider; |
| 47 | + } |
| 48 | + |
| 49 | + /** |
| 50 | + * Gets a lazy initialized collection of {@link ComponentProvider}s. |
| 51 | + * |
| 52 | + * @return A lazy initialized collection of {@code ComponentProvider}s. |
| 53 | + */ |
| 54 | + LazyValue<Collection<ComponentProvider>> getComponentProviders() { |
| 55 | + requireNonNull(componentProviders, new GenericType<LazyValue<Collection<ComponentProvider>>>() {}.getType()); |
| 56 | + return componentProviders; |
| 57 | + } |
| 58 | + |
| 59 | + /** |
| 60 | + * Sets a lazy initialized collection of {@link ComponentProvider}s. |
| 61 | + * |
| 62 | + * @param componentProviders A lazy initialized collection of {@code ComponentProvider}s. |
| 63 | + */ |
| 64 | + void setComponentProviders(LazyValue<Collection<ComponentProvider>> componentProviders) { |
| 65 | + this.componentProviders = componentProviders; |
| 66 | + } |
| 67 | +} |
0 commit comments