Searches resource loaders for one that matches or is a subclass of the specified type.

@param resolverType The type of resolver to retrieve
@param <T>          The type
@return An optional resource loader
962307
public @Nonnull <T extends ResourceLoader> Optional<T> getLoader(@Nonnull Class<T> resolverType) {
        ArgumentUtils.requireNonNull("resolverType", resolverType);
        return resourceLoaders.stream()
            .filter(rl -> resolverType.isAssignableFrom(rl.getClass()))
            .map(rl -> (T) rl)
            .findFirst();
    }
1296828
public static Resource getResourceByType(int resourceType) {
    for (Resource resource : Resources.values()) {
      if (resource.resourceType() == resourceType) {
        return resource;
      }
    }
    return null;
  }
265947
public static ClassLoader resolveClassLoaderForBeanProxy(String contextId, Class<?> proxiedType, TypeInfo typeInfo, ProxyServices proxyServices) {
        Class<?> superClass = typeInfo.getSuperClass();
        if (superClass.getName().startsWith(JAVA)) {
            ClassLoader cl = proxyServices.getClassLoader(proxiedType);
            if (cl == null) {
                cl = Thread.currentThread().getContextClassLoader();
            }
            return cl;
        }
        return Container.instance(contextId).services().get(ProxyServices.class).getClassLoader(superClass);
    }
1150822
protected Class resolveClass(ObjectStreamClass classDesc)
            throws IOException, ClassNotFoundException {
        String className = classDesc.getName();
        try {
            return loader.loadClass(className);
        } catch (ClassNotFoundException exp) {
            return super.resolveClass(classDesc);
        }
    }
243368
private ResourceGenerator resolveResourceGenerator(String path) {

		ResourceGenerator resourceGenerator = null;
		for (ResourceGeneratorResolverWrapper resolver : resolverRegistry) {
			if (resolver.matchPath(path)) {
				resourceGenerator = resolver.getResourceGenerator();
				if (resolver.getType().equals(ResolverType.PREFIXED)) {
					loadGeneratorIfNeeded(resolver.getResourcePath(path));
				}
				break;
			}
		}

		// Lazy load generator
		if (resourceGenerator == null) {
			resourceGenerator = loadCommonGenerator(path);
		}

		return resourceGenerator;
	}
968101
private Class<?> resolveArgument(Type type) {
    if (type instanceof ParameterizedType) {
      ParameterizedType paramType = (ParameterizedType) type;
      return resolveClass(paramType.getActualTypeArguments()[0]);
    } else if (type instanceof TypeVariable) {
      return resolveClass(type);
    } else if (type instanceof Class) {
      TypeVariable<?>[] typeParams = ((Class<?>) type).getTypeParameters();
      return resolveClass(typeParams[0]);
    }
    return null;
  }
691707
public static Type resolveRefType(Type type) {
        if (type == null)
            return null;

        if (type instanceof RefType)
            return resolveRefType(((RefType) type).getRefType());
        else
            return type;
    }
1026716
@SuppressWarnings("unchecked")
    public EntityFunction resolveType(final Class<? extends Entity> type) {
	// Check already resolved
	EntityFunction resolvedType = resolved.get(Objects.requireNonNull(type));
	if (resolvedType != null) {
	    return resolvedType;
	}

	// Log type
	logger.info(String.format("Resolving type %s", type));

	// Check not entity
	if (Entity.class.equals(type)) {
	    throw new IllegalArgumentException("Entity is not a valid Entity subclass");
	}

	// Check is interface
	if (!type.isInterface()) {
	    throw new IllegalArgumentException(String.format("Type %s is not an interface", type));
	}

	// Check type parameters
	if (type.getTypeParameters().length > 0) {
	    throw new IllegalArgumentException(String.format("Type %s cannot take type parameters", type));
	}

	// Build method map
	final Map<Method, EntityMethod> methodMap = new HashMap<>();
	final Set<Class<? extends Entity>> totalDependencies = new HashSet<>();
	for (final Method m : type.getDeclaredMethods()) {
	    // Check static
	    if (Modifier.isStatic(m.getModifiers())) {
		// Ignore static methods as not invoked on instance
		continue;
	    }
	    // Process functions
	    for (final EntityMethodFunction methodFunction : functions) {
		// Log method
		logger.fine(String.format("Resolving method %s with function %s", m, methodFunction.getClass()));
		// Resolve method
		final EntityMethod em = methodFunction.apply(m);
		if (em != null) {
		    // Resolved method
		    if (methodMap.put(m, em) != null) {
			throw new IllegalArgumentException(
				String.format("Method %s of type %s had multiple function hits", m, type));
		    }
		    // Add dependencies to be resolved
		    totalDependencies.addAll(em.getDependencies());
		}
	    }
	    // Check method could be resolved
	    if (!methodMap.containsKey(m)) {
		throw new IllegalArgumentException(String.format("Method %s of type %s had no resolver hits", m, type));
	    }
	}

	// Created resolved type
	resolvedType = new EntityFunction(type, methodMap);
	resolved.put(type, resolvedType);

	// Resolve dependencies
	totalDependencies.forEach(this::resolveType);

	// Resolve parents
	for (final Class<?> parent : type.getInterfaces()) {
	    // Ignore if entity
	    if (Entity.class.equals(parent)) {
		continue;
	    }

	    // Check if entity subclass
	    if (!Entity.class.isAssignableFrom(parent)) {
		throw new IllegalArgumentException(
			String.format("Parent type %s of type %s is not an Entity", parent, type));
	    }

	    // Resolve dependency
	    resolveType((Class<? extends Entity>) parent);
	}

	return resolvedType;
    }
207354
public static <E> E get(Class<E> type) {
    ServiceLoader<E> loader = ServiceLoader.load(type);
    Iterator<E> iterator = loader.iterator();
    if (iterator.hasNext()) {
      return iterator.next(); // only one is expected
    }
    try {
      //loads the default implementation
      return (E) Class.forName(getDefaultImplementationName(type)).newInstance();
    } catch (Exception e) {
      throw new TruggerException(e);
    }
  }
465248
protected ResourceBundle resolveBundle (HttpServletRequest req, String bundlePath,
                                            ClassLoader loader, boolean silent)
    {
        ResourceBundle bundle = null;

        if (req != null) {
            Enumeration<?> locales = req.getLocales();
            while (locales.hasMoreElements()) {
                Locale locale = (Locale)locales.nextElement();

                try {
                    // java caches resource bundles, so we don't need to reinvent the wheel here.
                    // however, java also falls back from a specific bundle to a more general one
                    // if it can't find a specific bundle. that's real nice of it, but we want
                    // first to see whether or not we have exact matches on any of the preferred
                    // locales specified by the client. if we don't, then we can rely on java's
                    // fallback mechanisms
                    bundle = ResourceBundle.getBundle(bundlePath, locale, loader);

                    // if it's an exact match, off we go
                    if (bundle.getLocale().equals(locale)) {
                        break;
                    }

                } catch (MissingResourceException mre) {
                    // no need to freak out quite yet, see if we have something for one of the
                    // other preferred locales
                }
            }
        }

        // if we were unable to find an exact match for any of the user's preferred locales, take
        // their most preferred and let java perform it's fallback logic on that one
        if (bundle == null) {
            Locale locale = (req == null) ? _deflocale : req.getLocale();
            try {
                bundle = ResourceBundle.getBundle(bundlePath, locale, loader);
            } catch (MissingResourceException mre) {
                if (!silent) {
                    // if we were unable even to find a default bundle, we may want to log a
                    // warning
                    log.warning("Unable to resolve any message bundle", "req", getURL(req),
                                "locale", locale, "bundlePath", bundlePath, "classLoader", loader,
                                "siteBundlePath", _siteBundlePath, "siteLoader", _siteLoader);
                }
            }
        }

        return bundle;
    }
373433
@Override
	public LinkRelation getCollectionResourceRelFor(java.lang.Class<?> type) {

		LookupContext context = LookupContext.forCollectionResourceRelLookup(type);

		return providers.getRequiredPluginFor(context).getCollectionResourceRelFor(type);
	}
1301150
@SuppressWarnings("unchecked")
	protected Class<? extends T> getCauseType() {
		return (Class<? extends T>) ResolvableType
				.forClass(AbstractFailureAnalyzer.class, getClass()).resolveGeneric();
	}
763306
@SuppressWarnings({ "unchecked", "rawtypes" })
    protected Class<S> resolveClass(Type type) {

        Map<TypeVariable, Type> map = new HashMap<TypeVariable, Type>();
        map.putAll(getTypeVariableMap());

        return (Class<S>) ResolvableType.forType(type, new TypeVariableMapVariableResolver(map)).resolve(Object.class);
    }
795841
public <T> void bind(Class<T> type, SerializerResolver<? extends T> resolver)
	{
		typeToResolverCache.put(type, Optional.<SerializerResolver<?>>of(resolver));
		boundTypeToResolver.put(type, resolver);
	}
1296542
public void resolveType() {
        if (getTypeStyle() == null) {
            setTypeStyle("");
        }
        final String fieldType = getFieldType();
        String generics = "";
        if (fieldType.contains("<")) {
            generics = fieldType.substring(fieldType.indexOf('<'));
        }
        if (getTypeStyle().equals("smart")) {
            setType(fieldType);
        } else if (getTypeStyle().length() > 0) {
            if (getTypeStyle().contains("<>")) {
                setType(getTypeStyle().replace("<>", generics));
            } else if (getTypeStyle().contains("<")) {
                setType(getTypeStyle());
            } else {
                setType(getTypeStyle() + generics);
            }
        } else {
            setType(fieldType);
        }
    }
1076409
@NonNull
	public static ResolvedTypeWithMembers resolveMembers(@NonNull ResolvedType mainType)
	{
		return memberResolver.resolve(mainType, null, null);
	}
216764
public final TcpClient resolver(AddressResolverGroup<?> resolver) {
		Objects.requireNonNull(resolver, "resolver");
		return bootstrap(b -> b.resolver(resolver));
	}