Finds all providers for a given service.

@param klass service interface or class
@return list of all providers (not null)
182635
public static <T> List<T> findServiceProviders( Class<T> klass )
    {
        ServiceLoader<T> loader = ServiceLoader.load( klass );
        List<T> providers = new ArrayList<T>();
        Iterator<T> it = loader.iterator();
        while ( it.hasNext() )
        {
            providers.add( it.next() );
        }
        return providers;
    }
754996
public Iterator getCurrentServiceSelectors(Class serviceClass)
	{
		BeanContextServiceProvider provider = getLocalServiceProvider(serviceClass);
		return provider == null ? null : new BCSIterator(provider.getCurrentServiceSelectors(getBeanContextServicesPeer(), serviceClass));
	}
1243404
@Override
  @ExperimentalApi("https://github.com/grpc/grpc-java/issues/2222")
  public List<ServerServiceDefinition> getServices() {
    return Collections.unmodifiableList(new ArrayList<>(services.values()));
  }
353490
@VisibleForTesting
  public static <T> Iterable<T> getCandidatesViaServiceLoader(Class<T> klass, ClassLoader cl) {
    Iterable<T> i = ServiceLoader.load(klass, cl);
    // Attempt to load using the context class loader and ServiceLoader.
    // This allows frameworks like http://aries.apache.org/modules/spi-fly.html to plug in.
    if (!i.iterator().hasNext()) {
      i = ServiceLoader.load(klass);
    }
    return i;
  }
796953
@SuppressWarnings("unchecked")
	public <T> List<T> findAll(Class<T> entity) {
		if (entity == null) {
			throw new ApitraryOrmException("Cannot access null entity");
		}

		log.debug("Loading all " + entity.getName());

		QueriedGetRequest request = new QueriedGetRequest();
		request.setEntity(resolveApitraryEntity(entity));
		QueriedGetResponse response = resolveApitraryClient().send(request);

		if (HttpStatus.OK.ordinal() == response.getStatusCode()) {
			return (List<T>) new QueriedGetResponseUnmarshaller(this).unMarshall(response, entity);
		} else {
			/*
			 * happens more often than expected...
			 */
			// if(HttpStatus.Internal_Server_Error.ordinal() ==
			// response.getStatusCode()){
			// throw new
			// CommunicationErrorException(HttpStatus.Internal_Server_Error);
			// }
			throw new CommunicationErrorException(HttpStatus.getStatus(response.getStatusCode()), response.getResult());
		}
	}
1140911
@Override
    public <E> List<E> findAll(Class<E> entityClass, String[] columnsToSelect, Object... keys)
    {
        List results = new ArrayList();
        for (Object key : keys)
        {
            Object object = find(entityClass, key);
            if (object != null)
            {
                results.add(object);
            }
        }
        return results;
    }
557322
public static <T> List<T> load(ClassLoader classLoader, Class<T> serviceType) {
        List<T> foundServices = new ArrayList<>();
        Iterator<T> iterator = ServiceLoader.load(serviceType, classLoader).iterator();

        while (checkHasNextSafely(iterator)) {
            try {
                T item = iterator.next();
                foundServices.add(item);
                LOGGER.debug(String.format("Found %s [%s]", serviceType.getSimpleName(), item.toString()));
            } catch (ServiceConfigurationError e) {
                LOGGER.trace("Can't find services using Java SPI", e);
                LOGGER.error(e.getMessage());
            }
        }
        return foundServices;
    }
1023264
protected List<ConsumerHolder> filterConsumersForClass(Class<? extends Consumer> consumerClass) {
        List<ConsumerHolder> consumerHolderSubList = new LinkedList<ConsumerHolder>();
        for (ConsumerHolder consumerHolder : consumerHolders) {
            if (consumerClass.isAssignableFrom(consumerHolder.getConsumer().getClass())) {
                consumerHolderSubList.add(consumerHolder);
            }
        }
        return consumerHolderSubList;
    }
826116
protected function findNearestForClass(&$providers, $findClass)
    {
        $all = $this->findAllForClass($providers, $findClass);

        if (!count($all)) {
            return;
        }

        if (count($all) == 1) {
            return array_values($all)[0];
        }

        foreach (static::classInheritance($findClass) as $parentClass) {
            if (isset($all[$parentClass]) ) {
                return $all[$parentClass];
            }
        }

    }
623903
public static <T> T lookupProviderByName(final ServiceRegistry registry, final String providerClassName, Class<T> category) {
        try {
            return category.cast(registry.getServiceProviderByClass(Class.forName(providerClassName)));
        }
        catch (ClassNotFoundException ignore) {
            return null;
        }
    }
759461
public static List<Class<?>> getAllSuperclasses(final Class<?> cls) {
        if (cls == null) {
            return null;
        }
        final List<Class<?>> classes = new ArrayList<>();
        Class<?> superclass = cls.getSuperclass();
        while (superclass != null) {
            classes.add(superclass);
            superclass = superclass.getSuperclass();
        }
        return classes;
    }
318323
public String[] listProviders() {
		String[] providers = new String[container.size()];

		int i = 0;
		Iterator<String> ki = container.keySet().iterator();
		while(ki.hasNext()) {
			providers[i++] = (String) ki.next();	
		}
		
		return providers;
	}
514597
@Override
  public <T> List<T> findAll(Class<T> entityClass) {
    return findAll(Util.determineCollectionName(entityClass));
  }
1165867
public @NotNull <T> List<T> findAll(@NotNull Class<T> cl, @NotNull SqlQuery query) {
        return executeQuery(resultProcessorForClass(cl), query);
    }
527932
@SuppressWarnings("unchecked")
	public static <T> List<T> getInstanceList(Class<T> type) {
		if (type == null) {
			throw new IllegalArgumentException("Type should not be empty");
		}

		List<T> loader = (List<T>) EXTENSION_LOCATOR.get(type);
		if (loader == null) {
			try {
				lock.lock();
				List<T> instanceList = new ArrayList<T>();
				ServiceLoader<T> serviceLoader = ServiceLoader.load(type);
				for (T service : serviceLoader) {
					instanceList.add(service);
				}
				loader = instanceList;
				if (EXTENSION_LOCATOR.putIfAbsent(type, instanceList) != instanceList) {
					loader = (List<T>) EXTENSION_LOCATOR.get(type);
				}
			} catch (Exception e) {
				LOG.error("Error to load SPI instances from META-INF/services/" + type, e);
			} finally {
				lock.unlock();
			}
		}
		return loader;
	}
936360
static List<JClass> allConcreteClasses(Set<ClassOutline> classes) {
        return allConcreteClasses(classes, Collections.emptySet());
    }
355461
public List<V> getAllServices(){
        if(cache == null || cache.size() == 0){
            return Collections.emptyList();
        }

        List<V> list = new ArrayList<V>();
        for(V svc : cache.values()){
            list.add(svc);
        }
        return list;
    }