Quantcast
Channel: JetBrains Developer Community : Thread List - IntelliJ IDEA Users
Viewing all articles
Browse latest Browse all 5661

extract common members from two classes

$
0
0

Hi,

 

What is the easiest way to extract common members from two classes into new superclass?

 

For example, I wont turn:

 

class A {

   pirvate String fieldName;

   private String someOtherA;

   //getters/setters here

}

 

 

class B {

  private String fieldName;

  private String someOtherB;

   //getters/setters here

}

 

 

into:

 

class Basic {

     private String fieldName;

        //getters/setters here

}

 

class A extends  Basic {

  private String someOtherA;

      //getters/setters here

}

 

 

class B extends  Basic{

  private String someOtherB;

  //getters/setters here

}

 

 

?

 

I tried to select both A and B in project tree and then Refactor->Generify, Generify Obejcts, but it doesn't see any common fields.

 

Best regards, Eugene.


Viewing all articles
Browse latest Browse all 5661

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>