Package org.qi4j.runtime.composite

Examples of org.qi4j.runtime.composite.CompositeMethodModel


        public Object provideInjection( InjectionContext context )
            throws InjectionProviderException
        {
            Class injectionClass = Classes.RAW_CLASS.map( dependencyModel.injectionType() );
            final CompositeMethodModel methodModel = resolution.method();
            if( injectionClass.equals( Method.class ) )
            {
                return methodModel.method();
            }

            final AnnotatedElement annotatedElement = methodModel.annotatedElement();
            if( injectionClass.equals( AnnotatedElement.class ) )
            {
                return annotatedElement;
            }
            final Annotation annotation = annotatedElement.getAnnotation( injectionClass );
View Full Code Here


                    ConstraintsModel constraints = constraintsFor(
                        method,
                        Iterables.<Class<? extends Constraint<?, ?>>>flatten( constraintDeclarations( mixinModel.mixinClass() ),
                                                                              constraintClasses )
                    );
                    CompositeMethodModel methodComposite = new CompositeMethodModel(
                        method,
                        constraints,
                        concernsModel,
                        sideEffectsModel,
                        mixinsModel
                    );

                    // Implement @This references
                    Iterable<Class<?>> map = map( new DependencyModel.InjectionTypeFunction(),
                                                  filter( new DependencyModel.ScopeSpecification( This.class ),
                                                          methodComposite.dependencies() ) );
                    Iterable<Class<?>> map1 = map( new DependencyModel.InjectionTypeFunction(),
                                                   filter( new DependencyModel.ScopeSpecification( This.class ),
                                                           mixinModel.dependencies() ) );
                    @SuppressWarnings( "unchecked" )
                    Iterable<Class<?>> filter = filter(
View Full Code Here

            public boolean visitEnter( Object visited )
                throws RuntimeException
            {
                if( visited instanceof CompositeMethodModel )
                {
                    CompositeMethodModel methodModel = (CompositeMethodModel) visited;
                    if( methodModel.method().getParameterTypes().length == 0 )
                    {
                        addStateFor( methodModel.method(), constraintClasses );
                    }

                    return false;
                }
View Full Code Here

        @SuppressWarnings( {"raw", "unchecked"} )
        public Object provideInjection( InjectionContext context )
            throws InjectionProviderException
        {
            Class injectionClass = Classes.RAW_CLASS.map( dependencyModel.injectionType() );
            final CompositeMethodModel methodModel = resolution.method();
            if( injectionClass.equals( Method.class ) )
            {
                return methodModel.method();
            }

            final AnnotatedElement annotatedElement = methodModel.annotatedElement();
            if( injectionClass.equals( AnnotatedElement.class ) )
            {
                return annotatedElement;
            }
            final Annotation annotation = annotatedElement.getAnnotation( injectionClass );
            if( annotation != null )
            {
                return annotation;
            }
            if( dependencyModel.injectionType() instanceof Class<?> )
            {
                return annotatedElement.getAnnotation( (Class<Annotation>) dependencyModel.injectionType() );
            }
            if( dependencyModel.injectionType() instanceof ParameterizedType )
            {
                ParameterizedType injectionType = (ParameterizedType) dependencyModel.injectionType();
                Type rawType = injectionType.getRawType();
                Type[] actualTypeArguments = injectionType.getActualTypeArguments();
                boolean isAnIterable = rawType.equals( Iterable.class );
                boolean haveOneGenericType = actualTypeArguments.length == 1;
                boolean thatIsOfTypeMethod = actualTypeArguments[ 0 ].equals( Method.class );
                if( isAnIterable && haveOneGenericType && thatIsOfTypeMethod )
                {
                    Class<?> injectedClass = dependencyModel.injectedClass();
                    Iterable<Method> result = methodModel.invocationsFor( injectedClass );
                    return result;
                }
            }
            return null;
        }
View Full Code Here

TOP

Related Classes of org.qi4j.runtime.composite.CompositeMethodModel

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.