All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.jboss.shrinkwrap.resolver.api.Resolvers Maven / Gradle / Ivy

There is a newer version: 3.3.3
Show newest version
/*
 * JBoss, Home of Professional Open Source
 * Copyright 2012, Red Hat Middleware LLC, and individual contributors
 * by the @authors tag. See the copyright.txt in the distribution for a
 * full listing of individual contributors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * http://www.apache.org/licenses/LICENSE-2.0
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.jboss.shrinkwrap.resolver.api;


/**
 * Client entry point to resolve artifacts from a set of coordinates in a repository-based system. To create a new
 * instance, pass the desired view (subtype of {@link ResolverSystem}) into either {@link Resolvers#use(Class)} or
 * {@link Resolvers#use(Class, ClassLoader)}.
 *
 * @author Andrew Lee Rubinger
 */
public class Resolvers {

    /**
     * Returns a factory to create configured {@link ResolverSystem} instances of the specified type. New instances will
     * be created using the current {@link Thread#getContextClassLoader()}.
     *
     * @param  The {@link ResolverSystem} type.
     * @param  The {@link ConfigurableResolverSystem} type.
     * @param clazz The type
     * @return A factory to create configured {@link ResolverSystem} instances of the specified type.
     * @throws IllegalArgumentException
     *             If the type is not specified
     */
    public static > CONFIGURABLERESOLVERSYSTEMTYPE configure(
        final Class clazz) throws IllegalArgumentException {
        return ResolverSystemFactory.createFromUserView(clazz);
    }

    /**
     * Returns a factory to create configured {@link ResolverSystem} instances of the specified type. New instances will
     * be created using the specified {@link ClassLoader}.
     *
     * @param  The {@link ResolverSystem} type.
     * @param  The {@link ConfigurableResolverSystem} type.
     * @param clazz The type
     * @param cl The {@link ClassLoader}
     * @return A factory to create configured {@link ResolverSystem} instances of the specified type. The factory will
     *          be created by using the specified {@link ClassLoader}.
     * @throws IllegalArgumentException
     *             If the type or {@link ClassLoader} is not specified
     */
    public static > CONFIGURABLERESOLVERSYSTEMTYPE configure(
        final Class clazz, final ClassLoader cl) throws IllegalArgumentException {
        return ResolverSystemFactory.createFromUserView(clazz, cl);
    }


    /**
     * Creates and returns a new instance of the specified view type.
     *
     * @param  The {@link ResolverSystem} type.
     * @param clazz The view type
     * @return A new instance of the specified view type.
     * @throws IllegalArgumentException
     *              If the type is not specified
     */
    public static  RESOLVERSYSTEMTYPE use(
        final Class clazz) throws IllegalArgumentException {
        return ResolverSystemFactory.createFromUserView(clazz);
    }

    /**
     * Creates and returns a new instance of the specified view type.  New instances will be created by using the
     * specified {@link ClassLoader}.
     *
     * @param  The {@link ResolverSystem} type.
     * @param clazz The view type.
     * @param cl The {@link ClassLoader}.
     * @return A new instance of the specified view type created by using the specified {@link ClassLoader}.
     * @throws IllegalArgumentException
     *             If either argument is not supplied
     */
    public static  RESOLVERSYSTEMTYPE use(
        final Class clazz, final ClassLoader cl) throws IllegalArgumentException {
        return ResolverSystemFactory.createFromUserView(clazz, cl);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy