/**
* {@inheritDoc}
*/
@Override
public ScanResult scan(final ScanRequest request) {
final ScanResult result = new ScanResult();
for (final WeaveInterest interest : request.getInterests()) {
switch (interest.target) {
case PACKAGE:
for (final Annotated<Package> pkg : this.withAnnotations().findAnnotatedPackages(
interest.annotationType)) {
result.getWeavable(pkg.get()).addAnnotations(pkg.getAnnotations());
}
break;
case TYPE:
for (final Annotated<Class<?>> type : this.withAnnotations().findAnnotatedClasses(
interest.annotationType)) {
result.getWeavable(type.get()).addAnnotations(type.getAnnotations());
}
break;
case METHOD:
for (final Annotated<Method> method : this.withAnnotations().findAnnotatedMethods(
interest.annotationType)) {
result.getWeavable(method.get()).addAnnotations(method.getAnnotations());
}
break;
case CONSTRUCTOR:
for (final Annotated<Constructor<?>> ctor : this.withAnnotations().findAnnotatedConstructors(
interest.annotationType)) {
result.getWeavable(ctor.get()).addAnnotations(ctor.getAnnotations());
}
break;
case FIELD:
for (final Annotated<Field> fld : this.withAnnotations().findAnnotatedFields(interest.annotationType)) {
result.getWeavable(fld.get()).addAnnotations(fld.getAnnotations());
}
break;
case PARAMETER:
for (final Annotated<Parameter<Method>> parameter : this.withAnnotations()
.findAnnotatedMethodParameters(interest.annotationType)) {
result.getWeavable(parameter.get().getDeclaringExecutable())
.getWeavableParameter(parameter.get().getIndex()).addAnnotations(parameter.getAnnotations());
}
for (final Annotated<Parameter<Constructor<?>>> parameter : this.withAnnotations()
.findAnnotatedConstructorParameters(interest.annotationType)) {
result.getWeavable(parameter.get().getDeclaringExecutable())
.getWeavableParameter(parameter.get().getIndex()).addAnnotations(parameter.getAnnotations());
}
break;
default:
// should we log something?
break;
}
}
for (final Class<?> supertype : request.getSupertypes()) {
for (final Annotated<Class<?>> type : this.withAnnotations().findAssignableTypes(supertype)) {
result.getWeavable(type.get()).addAnnotations(type.getAnnotations());
}
}
return inflater.inflate(result);
}