/** * Get the set of default providers registered for the given service provider contract * in the underlying {@link ServiceLocator HK2 service locator} container. * * @param <T> service provider contract Java type. * @param locator underlying HK2 service locator. * @param contract service provider contract. * @return set of all available default service provider instances for the contract. */ public static <T> Set<T> getProviders(final ServiceLocator locator, final Class<T> contract) { final Collection<ServiceHandle<T>> hk2Providers = getServiceHandles(locator, contract); return getClasses(hk2Providers); }
/** * Get the set of default providers registered for the given service provider contract * in the underlying {@link ServiceLocator HK2 service locator} container. * * @param <T> service provider contract Java type. * @param locator underlying HK2 service locator. * @param contract service provider contract. * @return set of all available default service provider instances for the contract. */ public static <T> Set<T> getProviders(final ServiceLocator locator, final Class<T> contract) { final Collection<ServiceHandle<T>> hk2Providers = getServiceHandles(locator, contract); return getClasses(hk2Providers); }
/** * Get the set of all custom providers registered for the given service provider contract * in the underlying {@link ServiceLocator HK2 service locator} container. * * @param <T> service provider contract Java type. * @param locator underlying HK2 service locator. * @param contract service provider contract. * @return set of all available service provider instances for the contract. */ public static <T> Set<T> getCustomProviders(final ServiceLocator locator, final Class<T> contract) { final Collection<ServiceHandle<T>> hk2Providers = getServiceHandles(locator, contract, CustomAnnotationLiteral.INSTANCE); return getClasses(hk2Providers); }
/** * Get the set of all custom providers registered for the given service provider contract * in the underlying {@link ServiceLocator HK2 service locator} container. * * @param <T> service provider contract Java type. * @param locator underlying HK2 service locator. * @param contract service provider contract. * @return set of all available service provider instances for the contract. */ public static <T> Set<T> getCustomProviders(final ServiceLocator locator, final Class<T> contract) { final Collection<ServiceHandle<T>> hk2Providers = getServiceHandles(locator, contract, CustomAnnotationLiteral.INSTANCE); return getClasses(hk2Providers); }
/** * Get the set of default providers registered for the given service provider contract * in the underlying {@link ServiceLocator HK2 service locator} container. * * @param <T> service provider contract Java type. * @param locator underlying HK2 service locator. * @param contract service provider contract. * @return set of all available default service provider instances for the contract. */ public static <T> Set<T> getProviders(final ServiceLocator locator, final Class<T> contract) { final Collection<ServiceHandle<T>> hk2Providers = getServiceHandles(locator, contract); return getClasses(hk2Providers); }
/** * Get the set of all custom providers registered for the given service provider contract * in the underlying {@link ServiceLocator HK2 service locator} container. * * @param <T> service provider contract Java type. * @param locator underlying HK2 service locator. * @param contract service provider contract. * @return set of all available service provider instances for the contract. */ public static <T> Set<T> getCustomProviders(final ServiceLocator locator, final Class<T> contract) { final Collection<ServiceHandle<T>> hk2Providers = getServiceHandles(locator, contract, CustomAnnotationLiteral.INSTANCE); return getClasses(hk2Providers); }
/** * Get the iterable of all providers (custom and default) registered for the given service provider contract * in the underlying {@link ServiceLocator HK2 service locator} container ordered based on the given {@code comparator}. * * @param <T> service provider contract Java type. * @param locator underlying HK2 service locator. * @param contract service provider contract. * @param comparator comparator to be used for sorting the returned providers. * @return set of all available service provider instances for the contract ordered using the given * {@link Comparator comparator}. */ public static <T> Iterable<T> getAllProviders(final ServiceLocator locator, final Class<T> contract, final Comparator<T> comparator) { final List<T> providerList = new ArrayList<T>(getClasses(getAllServiceHandles(locator, contract))); if (comparator != null) { Collections.sort(providerList, comparator); } return providerList; }
/** * Get the iterable of all providers (custom and default) registered for the given service provider contract * in the underlying {@link ServiceLocator HK2 service locator} container ordered based on the given {@code comparator}. * * @param <T> service provider contract Java type. * @param locator underlying HK2 service locator. * @param contract service provider contract. * @param comparator comparator to be used for sorting the returned providers. * @return set of all available service provider instances for the contract ordered using the given * {@link Comparator comparator}. */ public static <T> Iterable<T> getAllProviders(final ServiceLocator locator, final Class<T> contract, final Comparator<T> comparator) { final List<T> providerList = new ArrayList<T>(getClasses(getAllServiceHandles(locator, contract))); if (comparator != null) { Collections.sort(providerList, comparator); } return providerList; }
/** * Get the iterable of all providers (custom and default) registered for the given service provider contract * in the underlying {@link ServiceLocator HK2 service locator} container ordered based on the given {@code comparator}. * * @param <T> service provider contract Java type. * @param locator underlying HK2 service locator. * @param contract service provider contract. * @param comparator comparator to be used for sorting the returned providers. * @return set of all available service provider instances for the contract ordered using the given * {@link Comparator comparator}. */ public static <T> Iterable<T> getAllProviders(final ServiceLocator locator, final Class<T> contract, final Comparator<T> comparator) { final List<T> providerList = new ArrayList<T>(getClasses(getAllServiceHandles(locator, contract))); if (comparator != null) { Collections.sort(providerList, comparator); } return providerList; }