* INTERNAL:
* Visit an executable and create a MetadataMethod object.
*/
@Override
public MetadataMethod visitExecutable(ExecutableElement executableElement, MetadataClass metadataClass) {
MetadataMethod method = new MetadataMethod(metadataClass.getMetadataFactory(), metadataClass);
// Set the name.
method.setName(executableElement.getSimpleName().toString());
// Set the attribute name.
method.setAttributeName(Helper.getAttributeNameFromMethodName(method.getName()));
// Set the modifiers.
method.setModifiers(getModifiers(executableElement.getModifiers()));
// Visit executable element for the parameters, return type and generic type.
TypeVisitor<MetadataMethod, MetadataMethod> visitor = new TypeVisitor<MetadataMethod, MetadataMethod>();
executableElement.asType().accept(visitor, method);
// Set the annotations.
buildMetadataAnnotations(method, executableElement.getAnnotationMirrors());
// Handle multiple methods with the same name.
MetadataMethod existing = metadataClass.getMethods().get(method.getName());
if (existing == null) {
metadataClass.addMethod(method);
} else {
while (existing.getNext() != null) {
existing = existing.getNext();
}
existing.setNext(method);
}
return method;
}