Package org.qi4j.runtime.injection

Examples of org.qi4j.runtime.injection.InjectionProviderFactory


    public InjectionProvider newInjectionProvider( Resolution resolution, DependencyModel dependencyModel )
        throws InvalidInjectionException
    {
        Class<? extends Annotation> injectionAnnotationType = dependencyModel.injectionAnnotation().annotationType();
        InjectionProviderFactory factory1 = generalProviderFactories.get( injectionAnnotationType );
        InjectionProviderFactory factory2 = valuesProviderFactories.get( injectionAnnotationType );
        if( factory1 == null && factory2 == null )
        {
            InjectionProviderFactory factory = metaInfo.get( InjectionProviderFactory.class );
            if( factory != null )
            {
                return factory.newInjectionProvider( resolution, dependencyModel );
            }
            else
            {
                throw new InvalidInjectionException( "Unknown injection annotation @" + injectionAnnotationType.getSimpleName() );
            }
        }
        ModelDescriptor composite = resolution.model();
        Class<?> compositeType = composite.type();
        if( factory1 != null && ValueComposite.class.isAssignableFrom( compositeType ) )
        {
            throw new InvalidValueCompositeException( "@" + injectionAnnotationType.getSimpleName() + " is not allowed in ValueComposites: " + compositeType );
        }

        InjectionProviderFactory factory;
        if( factory1 == null )
        {
            factory = factory2;
        }
        else
        {
            factory = factory1;
        }
        return factory.newInjectionProvider( resolution, dependencyModel );
    }
View Full Code Here


    @Override
    public InjectionProvider newInjectionProvider( Resolution resolution, DependencyModel dependencyModel )
        throws InvalidInjectionException
    {
        Class<? extends Annotation> injectionAnnotationType = dependencyModel.injectionAnnotation().annotationType();
        InjectionProviderFactory factory1 = generalProviderFactories.get( injectionAnnotationType );
        InjectionProviderFactory factory2 = valuesProviderFactories.get( injectionAnnotationType );
        if( factory1 == null && factory2 == null )
        {
            InjectionProviderFactory factory = metaInfo.get( InjectionProviderFactory.class );
            if( factory != null )
            {
                return factory.newInjectionProvider( resolution, dependencyModel );
            }
            else
            {
                throw new InvalidInjectionException( "Unknown injection annotation @" + injectionAnnotationType.getSimpleName() );
            }
        }
        ModelDescriptor composite = resolution.model();
        Class<?> compositeType = first( composite.types() );
        if( factory1 != null && ValueComposite.class.isAssignableFrom( compositeType ) )
        {
            throw new InvalidValueCompositeException( "@" + injectionAnnotationType.getSimpleName() + " is not allowed in ValueComposites: " + compositeType );
        }

        InjectionProviderFactory factory;
        if( factory1 == null )
        {
            factory = factory2;
        }
        else
        {
            factory = factory1;
        }
        return factory.newInjectionProvider( resolution, dependencyModel );
    }
View Full Code Here

TOP

Related Classes of org.qi4j.runtime.injection.InjectionProviderFactory

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.