Examples of AnnotationProvider


Examples of org.apache.tapestry5.ioc.AnnotationProvider

    public boolean provideInjection(final PlasticField field, ObjectLocator locator, MutableComponentModel componentModel)
    {
        Class fieldType = classCache.forName(field.getTypeName());

        Object injectionValue = masterObjectProvider.provide(fieldType, new AnnotationProvider()
        {
            public <T extends Annotation> T getAnnotation(Class<T> annotationClass)
            {
                return field.getAnnotation(annotationClass);
            }
View Full Code Here

Examples of org.apache.tapestry5.ioc.AnnotationProvider

        return defaultProvider.defaultTranslatorBinding("value", resources);
    }

    final AnnotationProvider defaultAnnotationProvider()
    {
        return new AnnotationProvider()
        {
            public <T extends Annotation> T getAnnotation(Class<T> annotationClass)
            {
                return resources.getParameterAnnotation("value", annotationClass);
            }
View Full Code Here

Examples of org.apache.tapestry5.ioc.AnnotationProvider

        final Annotation[] annotations = descriptor.getAnnotations();

        if (annotations != null)
        {
            AnnotationProvider provider = new AnnotationProvider()
            {
                @Override
                public <T extends Annotation> T getAnnotation(Class<T> annotationClass)
                {
                    for (Object a : annotations)
                    {
                        if (annotationClass.isInstance(a)) return annotationClass.cast(a);
                    }

                    return null;
                }
            };

            if (provider.getAnnotation(Inject.class) != null || provider.getAnnotation(InjectService.class) != null)
                return registry.getObject(objectType, provider);
        }

        return super.resolveDependency(descriptor, beanName, autowiredBeanNames, typeConverter);
    }
View Full Code Here

Examples of org.apache.tapestry5.ioc.AnnotationProvider

        return defaultProvider.defaultTranslatorBinding("value", resources);
    }

    final AnnotationProvider defaultAnnotationProvider()
    {
        return new AnnotationProvider()
        {
            public <T extends Annotation> T getAnnotation(Class<T> annotationClass)
            {
                return resources.getParameterAnnotation("value", annotationClass);
            }
View Full Code Here

Examples of org.apache.tapestry5.ioc.AnnotationProvider

    @SuppressWarnings("unchecked")
    private static Object calculateParameterValue(Class parameterType, final Annotation[] parameterAnnotations,
                                                  ObjectLocator locator, Map<Class, Object> parameterDefaults)
    {
        AnnotationProvider provider = new AnnotationProvider()
        {
            public <T extends Annotation> T getAnnotation(Class<T> annotationClass)
            {
                return findAnnotation(parameterAnnotations, annotationClass);
            }
        };

        // At some point, it would be nice to eliminate InjectService, and rely
        // entirely on service interface type and point-of-injection markers.

        InjectService is = provider.getAnnotation(InjectService.class);

        if (is != null)
        {
            String serviceId = is.value();

            return locator.getService(serviceId, parameterType);
        }

        // In the absence of @InjectService, try some autowiring. First, does the
        // parameter type match one of the resources (the parameter defaults)?

        if (provider.getAnnotation(Inject.class) == null)
        {
            Object result = parameterDefaults.get(parameterType);

            if (result != null) return result;
        }
View Full Code Here

Examples of org.apache.tapestry5.ioc.AnnotationProvider

        return defaultProvider.defaultTranslator("value", resources);
    }

    final AnnotationProvider defaultAnnotationProvider()
    {
        return new AnnotationProvider()
        {
            public <T extends Annotation> T getAnnotation(Class<T> annotationClass)
            {
                return resources.getParameterAnnotation("value", annotationClass);
            }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.