Search in sources :

Example 1 with ParameterProvider

use of org.b3log.latke.ioc.provider.ParameterProvider in project latke by b3log.

the class BeanImpl method initMethodInjectionPoints.

/**
 * Initializes method injection points.
 */
@SuppressWarnings("unchecked")
private void initMethodInjectionPoints() {
    final Set<AnnotatedMethod<? super T>> annotatedMethods = annotatedType.getMethods();
    for (final AnnotatedMethod annotatedMethod : annotatedMethods) {
        final List<AnnotatedParameter<?>> parameters = annotatedMethod.getParameters();
        final List<ParameterInjectionPoint> paraInjectionPointArrayList = new ArrayList<ParameterInjectionPoint>();
        final List<ParameterProvider<?>> paraProviders = new ArrayList<ParameterProvider<?>>();
        for (final AnnotatedParameter<?> annotatedParameter : parameters) {
            Type type = annotatedParameter.getBaseType();
            if (type instanceof ParameterizedType) {
                type = ((ParameterizedType) type).getRawType();
            }
            if (type.equals(Provider.class)) {
                final ParameterProvider<T> provider = new ParameterProvider<T>(beanManager, annotatedParameter);
                paraProviders.add(provider);
            }
            final ParameterInjectionPoint parameterInjectionPoint = new ParameterInjectionPoint(this, annotatedParameter);
            paraInjectionPointArrayList.add(parameterInjectionPoint);
        }
        methodParameterProviders.put(annotatedMethod, paraProviders);
        methodParameterInjectionPoints.put(annotatedMethod, paraInjectionPointArrayList);
    }
}
Also used : ParameterInjectionPoint(org.b3log.latke.ioc.point.ParameterInjectionPoint) ParameterProvider(org.b3log.latke.ioc.provider.ParameterProvider) AnnotatedType(org.b3log.latke.ioc.annotated.AnnotatedType)

Example 2 with ParameterProvider

use of org.b3log.latke.ioc.provider.ParameterProvider in project latke by b3log.

the class BeanImpl method initConstructorInjectionPoints.

/**
 * Initializes constructor injection points.
 */
private void initConstructorInjectionPoints() {
    final Set<AnnotatedConstructor<T>> annotatedConstructors = annotatedType.getConstructors();
    for (final AnnotatedConstructor annotatedConstructor : annotatedConstructors) {
        final List<AnnotatedParameter<?>> parameters = annotatedConstructor.getParameters();
        final List<ParameterInjectionPoint> paraInjectionPointArrayList = new ArrayList<ParameterInjectionPoint>();
        for (final AnnotatedParameter<?> annotatedParameter : parameters) {
            Type type = annotatedParameter.getBaseType();
            if (type instanceof ParameterizedType) {
                type = ((ParameterizedType) type).getRawType();
            }
            if (type.equals(Provider.class)) {
                final ParameterProvider<T> provider = new ParameterProvider<T>(beanManager, annotatedParameter);
                constructorParameterProviders.add(provider);
            }
            final ParameterInjectionPoint parameterInjectionPoint = new ParameterInjectionPoint(this, annotatedParameter);
            paraInjectionPointArrayList.add(parameterInjectionPoint);
        }
        constructorParameterInjectionPoints.put(annotatedConstructor, paraInjectionPointArrayList);
    }
}
Also used : ParameterInjectionPoint(org.b3log.latke.ioc.point.ParameterInjectionPoint) ParameterProvider(org.b3log.latke.ioc.provider.ParameterProvider) AnnotatedType(org.b3log.latke.ioc.annotated.AnnotatedType)

Aggregations

AnnotatedType (org.b3log.latke.ioc.annotated.AnnotatedType)2 ParameterInjectionPoint (org.b3log.latke.ioc.point.ParameterInjectionPoint)2 ParameterProvider (org.b3log.latke.ioc.provider.ParameterProvider)2