Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
Showing results for 
Search instead for 
Did you mean: 

copy a method to a separate class

0 Kudos

Hi All,

I have class with 60 methods in that class.

Now I have to copy each method and create a separate class for each method.

Ex : if my class having 60 methods, I have to create 60 classes with one method.

Note : It is public class and all are public methods.

Here the problem is when I copy a method, every time I have to  carefully check the parameters, exceptions and code to copy where it is time consuming and I have to do it carefully as entire project works on that copy.

I don't want to miss anything while copying a method to a separate class.

Is there any way to copy a method to a class in simple way.


Active Participant
0 Kudos

I know that's not the smartest solution you will have, but... did you notice the public, protected and private section from your class? In this part is possible to you get exactly the method parameters. You can copy and past it in your new class.

Unfortunately to copy code method I have no much idea to do that in a better way... I think you'll need to copy and past each one

Active Contributor
0 Kudos

Why? What's wrong with sixty methods in a class? Are they all static? What is the benefit of splitting them into separate classes?

And have you tried F5 to get the object tree, then right click on a method and choose "copy"?

0 Kudos

Hi Matthew,

Thankyou for your response.

due to some redundency client need this requirement.

all are instant methods only.

I didn't get where to use F5.

could you expain.


Active Contributor
0 Kudos

SE24. Display class. F5.

due to some redundency client need this requirement.  What does that mean? This requirement, as far as you've explained it - which isn't far, makes zero sense. Seems utterly crazy to me and entirely un-object-oriented.

Former Member
0 Kudos

How about using the "source code based" view of the class? There you can simply cut & paste the definition of your methods and also the implementation of them.

Concerning stable functionality: You should investigate some time in learning about test automatization and unit testing. If you have well done unit tests you can refactor the coding with a good feeling. But it's a big work for 60 methods in front of your refactoring.