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

org.fernice.reflare.internal.Helper Maven / Gradle / Ivy

There is a newer version: 1.2.1
Show newest version
/*
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 */
package org.fernice.reflare.internal;

class Helper {

    @SuppressWarnings("unchecked")
    static  T accessor(Class type) {
        try {
            Class impl = (Class) Class.forName(type.getPackage().getName() + ".impl." + type.getSimpleName() + "Impl");

            return impl.newInstance();
        } catch (ClassNotFoundException e) {
            throw new IllegalStateException("no reflare access implementation is present in classpath", e);
        } catch (IllegalAccessException | InstantiationException e) {
            throw new IllegalStateException("reflare access implementation is corrupted", e);
        }
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy