Add sort function for method and class handle.