public void visitMethod(ManagementOperation annotation,
Method method,
Class<?> implClass,
InjectingComponentType componentType,
IntrospectionContext context) {
ManagementInfo info = componentType.getManagementInfo();
if (info == null) {
Class<?> clazz = method.getDeclaringClass();
String name = Management.class.getSimpleName();
context.addError(new InvalidAnnotation("Implementation is missing @" + name, method, annotation, clazz));
return;
}
String description = annotation.description();
if (description.trim().length() == 0) {
description = null;
}
Set<Role> roles = new HashSet<>();
for (String roleName : annotation.rolesAllowed()) {
roles.add(new Role(roleName));
}
String path = annotation.path();
org.fabric3.api.annotation.management.OperationType operationType = annotation.type();
OperationType type = OperationType.valueOf(operationType.toString());
ManagementOperationInfo operationInfo = new ManagementOperationInfo(method, path, type, description, roles);
info.addOperation(operationInfo);
}