/** * 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; }
Providers.getAllServiceHandles(locator, ExceptionMapper.class);
Providers.getAllServiceHandles(locator, ExceptionMapper.class);
Providers.getAllServiceHandles(locator, ExceptionMapper.class);