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);
}
}
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);
}
}
Aggregations