@SuppressWarnings("unchecked")
    static <T extends Descriptor> DescriptorImporter<T> createImporterFromUserView(final Class<T> userViewClass,
        String descriptorName) throws IllegalArgumentException {
        // Get the construction information
        final DescriptorConstructionInfo info = getDescriptorConstructionInfoForUserView(userViewClass);

        // Create an importer
        final Class<?> implClass = info.implClass;
        if (!userViewClass.isAssignableFrom(implClass)) {
            throw new RuntimeException("Configured implementation class for " + userViewClass.getName()
                + " is not assignable: " + implClass.getName());
        }
        final Class<T> implClassCasted = (Class<T>) implClass;

        String name = info.defaultName;
        if (descriptorName != null) {
            name = descriptorName;
        }

        final DescriptorImporter<T> importer;
        try {
            importer = (DescriptorImporter<T>) info.importerClass.getConstructor(Class.class, String.class)
                .newInstance(implClassCasted, name);
        } catch (Exception e) {
            throw new RuntimeException("Configured importer for " + userViewClass.getName() + " of type: "
                + info.importerClass + " could not be created", e);
        }

        // Return
        return importer;
    }
@ SuppressWarnings ( "unchecked" ) static < T extends Descriptor > DescriptorImporter < T > createImporterFromUserView ( final Class < T > userViewClass , String descriptorName ) throws IllegalArgumentException { final DescriptorConstructionInfo info = getDescriptorConstructionInfoForUserView ( userViewClass ) ; final Class < ? > implClass = info . implClass ; if ( ! userViewClass . isAssignableFrom ( implClass ) ) { throw new RuntimeException ( "Configured implementation class for " + userViewClass . getName ( ) + " is not assignable: " + implClass . getName ( ) ) ; } final Class < T > implClassCasted = ( Class < T > ) implClass ; String name = info . defaultName ; if ( descriptorName != null ) { name = descriptorName ; } final DescriptorImporter < T > importer ; try { importer = ( DescriptorImporter < T > ) info . importerClass . getConstructor ( Class . class , String . class ) . newInstance ( implClassCasted , name ) ; } catch ( Exception e ) { throw new RuntimeException ( "Configured importer for " + userViewClass . getName ( ) + " of type: " + info . importerClass + " could not be created" , e ) ; } return importer ; }
Creates a new {@link DescriptorImporter} instance of the specified user view type. Will consult a configuration
file visible to the {@link Thread} Context {@link ClassLoader} named "META-INF/services/$fullyQualfiedClassName"
which should contain a key=value format with the keys {@link DescriptorInstantiator#KEY_IMPL_CLASS_NAME} and
{@link DescriptorInstantiator#KEY_MODEL_CLASS_NAME}. The implementation class name must have a constructor
accepting an instance of the model class, and the model class must have a no-arg constructor.

@param <T>
@param userViewClass
@param descriptorName
The name of the descriptor. If argument is null, the default name will be used.
@return
@throws IllegalArgumentException
If the user view class was not specified