• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2017 The gRPC Authors
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package io.grpc;
18 
19 import com.google.common.annotations.VisibleForTesting;
20 import java.util.List;
21 
22 @Internal
23 public final class InternalServiceProviders {
InternalServiceProviders()24   private InternalServiceProviders() {
25   }
26 
27   /**
28    * Accessor for method.
29    */
load( Class<T> klass, Iterable<Class<?>> hardcoded, ClassLoader classLoader, PriorityAccessor<T> priorityAccessor)30   public static <T> T load(
31       Class<T> klass,
32       Iterable<Class<?>> hardcoded,
33       ClassLoader classLoader,
34       PriorityAccessor<T> priorityAccessor) {
35     return ServiceProviders.load(klass, hardcoded, classLoader, priorityAccessor);
36   }
37 
38   /**
39    * Accessor for method.
40    */
loadAll( Class<T> klass, Iterable<Class<?>> hardCodedClasses, ClassLoader classLoader, PriorityAccessor<T> priorityAccessor)41   public static <T> List<T> loadAll(
42       Class<T> klass,
43       Iterable<Class<?>> hardCodedClasses,
44       ClassLoader classLoader,
45       PriorityAccessor<T> priorityAccessor) {
46     return ServiceProviders.loadAll(klass, hardCodedClasses, classLoader, priorityAccessor);
47   }
48 
49   /**
50    * Accessor for method.
51    */
52   @VisibleForTesting
getCandidatesViaServiceLoader(Class<T> klass, ClassLoader cl)53   public static <T> Iterable<T> getCandidatesViaServiceLoader(Class<T> klass, ClassLoader cl) {
54     return ServiceProviders.getCandidatesViaServiceLoader(klass, cl);
55   }
56 
57   /**
58    * Accessor for method.
59    */
60   @VisibleForTesting
getCandidatesViaHardCoded( Class<T> klass, Iterable<Class<?>> hardcoded)61   public static <T> Iterable<T> getCandidatesViaHardCoded(
62       Class<T> klass, Iterable<Class<?>> hardcoded) {
63     return ServiceProviders.getCandidatesViaHardCoded(klass, hardcoded);
64   }
65 
66   /**
67    * Accessor for {@link ServiceProviders#isAndroid}.
68    */
isAndroid(ClassLoader cl)69   public static boolean isAndroid(ClassLoader cl) {
70     return ServiceProviders.isAndroid(cl);
71   }
72 
73   public interface PriorityAccessor<T> extends ServiceProviders.PriorityAccessor<T> {}
74 }
75