Package net.xeoh.nexus

Examples of net.xeoh.nexus.Nexus


     * @param <T> Parameter of the classes' type.
     * @param clsses The classes to wrap.
     * @return A CoreClass wrapping the given classes.
     */
    public static <T extends GlobalExtension> T $(Class<T> clsses) {
        final Nexus nexus = $.nexus();
        final T t = nexus.get(clsses);

        // In case we have the extension everything is fine.
        if (t != null) return t;

        // FIXME: If accessed by two threads this might produce two extensions ...
        try {
            final T newT = clsses.newInstance();
            final Collection<? extends Service> service = InternalService.wrap(newT);

            newT.commonCore($);
            newT.init();
            nexus.register(service);

            return newT;
        } catch (InstantiationException e) {
            e.printStackTrace();
        } catch (IllegalAccessException e) {
View Full Code Here


     * @param <T> Parameter of the classes' type.
     * @param clsses The classes to wrap.
     * @return A CoreClass wrapping the given classes.
     */
    public static <T extends GlobalExtension> T $(Class<T> clsses) {
        final Nexus nexus = $.nexus();
        final T t = nexus.get(clsses);

        // In case we have the extension everything is fine.
        if (t != null) return t;

        // FIXME: If accessed by two threads this might produce two extensions ...
        try {
            final T newT = clsses.newInstance();
            final Collection<? extends Service> service = InternalService.wrap(newT);

            newT.commonCore($);
            newT.init();
            nexus.register(service);

            return newT;
        } catch (InstantiationException e) {
            e.printStackTrace();
        } catch (IllegalAccessException e) {
View Full Code Here

TOP

Related Classes of net.xeoh.nexus.Nexus

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.