@SuppressWarnings("unchecked") @Override public <T> List<T> getServices(Class<T> serviceType) { CacheItem item = cache.get(serviceType); if (item == null) { // this represents and exception we can't recover from if (serviceType.isAssignableFrom(RepositorySystem.class)) { throw new IllegalStateException( "Unable to boostrap Aether repository system, missing RepositoryService " + serviceType.getName() + ", probably due to missing or invalid Aether dependencies. " + " You are either running from within Maven plugin with Maven 3.0.x version (make sure to update to Maven 3.1.0 or newer) or " + " you have org.apache.maven:maven-aether-provider:3.0.x on classpath shading required binding (make sure to update dependencies in your project)."); } return Collections.emptyList(); } // classes were not yet instantiated if (item.instances.isEmpty()) { return (List<T>) item.instantiate(); } // we already have instances, so let's return them return (List<T>) item.instances; } }
@SuppressWarnings("unchecked") @Override public <T> List<T> getServices(Class<T> serviceType) { CacheItem item = cache.get(serviceType); if (item == null) { // this represents and exception we can't recover from if (serviceType.isAssignableFrom(RepositorySystem.class)) { throw new IllegalStateException( "Unable to boostrap Aether repository system, missing RepositoryService " + serviceType.getName() + ", probably due to missing or invalid Aether dependencies. " + " You are either running from within Maven plugin with Maven 3.0.x version (make sure to update to Maven 3.1.0 or newer) or " + " you have org.apache.maven:maven-aether-provider:3.0.x on classpath shading required binding (make sure to update dependencies in your project)."); } return Collections.emptyList(); } // classes were not yet instantiated if (item.instances.isEmpty()) { return (List<T>) item.instantiate(); } // we already have instances, so let's return them return (List<T>) item.instances; } }
/** * Sets the instances for a service. * * @param <T> The service type. * @param type The interface describing the service, must not be {@code null}. * @param services The instances of the service, may be {@code null} but must not contain {@code null} elements. * @return This locator for chaining, never {@code null}. */ @SuppressWarnings("unchecked") private <T> ShrinkWrapResolverServiceLocator setServices(Class<T> type, T... services) { CacheItem item = cache.get(type); if (item == null) { item = new CacheItem(type); } item.replaceInstances(services); cache.put(type, item); return this; }
/** * Sets the instances for a service. * * @param <T> The service type. * @param type The interface describing the service, must not be {@code null}. * @param services The instances of the service, may be {@code null} but must not contain {@code null} elements. * @return This locator for chaining, never {@code null}. */ @SuppressWarnings("unchecked") private <T> ShrinkWrapResolverServiceLocator setServices(Class<T> type, T... services) { CacheItem item = cache.get(type); if (item == null) { item = new CacheItem(type); } item.replaceInstances(services); cache.put(type, item); return this; }
private <T> ShrinkWrapResolverServiceLocator addService(Class<T> type, Class<? extends T> implementationType) { CacheItem item = cache.get(type); if (item == null) { item = new CacheItem(type); } item.addImplementation(implementationType); cache.put(type, item); return this; }
private <T> ShrinkWrapResolverServiceLocator addService(Class<T> type, Class<? extends T> implementationType) { CacheItem item = cache.get(type); if (item == null) { item = new CacheItem(type); } item.addImplementation(implementationType); cache.put(type, item); return this; }