final BeanMetric beanMetric = analyzeBean(context, clazz);
return new AbstractBeanMetric() {
@Override
public MetaConstructor getInjectorConstructor() {
final MetaConstructor injectionConstructor = beanMetric.getInjectorConstructor();
if (injectionConstructor != null) {
if (!injectionConstructor.getParametersAnnotatedWith(annotatedWith).isEmpty()) {
return injectionConstructor;
}
}
return null;
}
@Override
public Collection<MetaField> getFieldInjectors() {
final List<MetaField> fieldList = new ArrayList<MetaField>();
for (final MetaField metaField : beanMetric.getFieldInjectors()) {
if (metaField.isAnnotationPresent(annotatedWith)) {
fieldList.add(metaField);
}
}
return fieldList;
}
@Override
public Collection<MetaMethod> getMethodInjectors() {
final List<MetaMethod> metaMethodList = new ArrayList<MetaMethod>();
for (final MetaMethod metaMethod : beanMetric.getMethodInjectors()) {
if (!metaMethod.getParametersAnnotatedWith(annotatedWith).isEmpty()) {
metaMethodList.add(metaMethod);
}
}
return metaMethodList;
}
@Override
public Collection<MetaParameter> getInjectorConstructorParameters() {
final MetaConstructor metaConstructor = getInjectorConstructor();
if (metaConstructor != null) {
return metaConstructor.getParametersAnnotatedWith(annotatedWith);
}
return Collections.emptyList();
}