do {
for (MetaField field : visit.getDeclaredFields()) {
if (isInjectionPoint(field)) {
if (!field.isPublic()) {
MetaMethod meth = visit.getMethod(ReflectionUtil.getSetter(field.getName()),
field.getType());
if (meth == null) {
InjectionTask task = new InjectionTask(injector, field);
accumulator.add(task);
}
else {
InjectionTask task = new InjectionTask(injector, meth);
task.setField(field);
accumulator.add(task);
}
}
else {
accumulator.add(new InjectionTask(injector, field));
}
}
ElementType[] elTypes;
for (Class<? extends Annotation> a : decorators) {
elTypes = a.isAnnotationPresent(Target.class) ? a.getAnnotation(Target.class).value()
: new ElementType[]{ElementType.FIELD};
for (ElementType elType : elTypes) {
switch (elType) {
case FIELD:
if (field.isAnnotationPresent(a)) {
accumulator.add(new DecoratorTask(injector, field, ctx.getDecorator(a)));
}
break;
}
}
}
}
for (MetaMethod meth : visit.getDeclaredMethods()) {
if (isInjectionPoint(meth)) {
accumulator.add(new InjectionTask(injector, meth));
}
ElementType[] elTypes;
for (Class<? extends Annotation> a : decorators) {
elTypes = a.isAnnotationPresent(Target.class) ? a.getAnnotation(Target.class).value()
: new ElementType[]{ElementType.FIELD};
for (ElementType elType : elTypes) {
switch (elType) {
case METHOD:
if (meth.isAnnotationPresent(a)) {
accumulator.add(new DecoratorTask(injector, meth, ctx.getDecorator(a)));
}
break;
case PARAMETER:
for (MetaParameter parameter : meth.getParameters()) {
if (parameter.isAnnotationPresent(a)) {
DecoratorTask task = new DecoratorTask(injector, parameter, ctx.getDecorator(a));
task.setMethod(meth);
accumulator.add(task);
}