��� ���� �ø��� �����丵

 

�� ������ ��ſ��� Pull Members Up ï¿½ï¿½ï¿½ï¿½ï¿½ä¸µ ��ɿ� ���� ��������  overview ��  how ï¿½ï¿½ �����丵�� IntelliJ IDEA���� ���� �� �ִ°��� �����մϴ�.

����


Pull Members Up ï¿½ï¿½ï¿½ï¿½ï¿½ä¸µ ����� Ŭ���� ����� ����Ŭ���� �Ǵ� �������̽��� �̵��ϴ� ���� ������ݴϴ�.


���� ���, ����� ���� �ڵ带 �����ϴ�:

 
public class ClassParent {
    void method1(){
        //some code here
    }
}
 
public class ClassChild extends ClassParent {
    void method1() {
        //some code here
    }
    void method2() {
        //some code here
    }
}

 

�׸��� ����� method2�� �θ� Ŭ������ �̵��� �ʿ䰡 �ֽ��ϴ�.  ï¿½ï¿½ï¿½ï¿½ï¿½ �ڵ��� �����丵 ���� �̰�ó�� ���� ���Դϴ�:
 
public class ClassParent {
    void method1(){
        //some code here
    }
    void method2() {
        //some code here
    }
}
 
public class ClassChild extends ClassParent {
    void method1() {
        //some code here
    }
}



����� ����ø��� ��


Ŭ���� ����� ����ø��� ���ؼ�:

 1.   ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ �Ǵ� Project View  / Commander ï¿½ï¿½ï¿½ï¿½ ����� ����ø� �ʿ䰡 �ִ� ����� �ø��� Ŭ���� ���� ij���� �����ϰ� ���� �޴� �Ǵ� ������ ��ư�� Ŭ���ϴ� �Ϳ� ���� �ҷ����� �˾� �޴����� Refactor Pull Members Up... ï¿½ï¿½ Ŭ���Ͻʽÿ�.

 2.   ï¿½ï¿½ï¿½ï¿½ï¿½ Pull Members Up ï¿½ï¿½ï¿½Ì¾ï¿½Î±×¸ï¿½ �� �� �Դϴ�

Pull up  members of a <package_name>.<class_name> to: 

���-�ٿ� �ڽ����� ����� ���õ� Ŭ���� ����� ����ø��� Ŭ����/�������̽��� ������ �� �ֽ��ϴ�.

����÷����� ���

�� ��� ���� Ŭ����, �������̽�, �ʵ�� �޼ҵ带 �����ϴ� ���� ����÷����� ��� Ŭ���� ����� ����� �����ݴϴ�.  ï¿½ï¿½ï¿½ï¿½ï¿½ ����ø��� ����, ����� �� ���ʿ��� üũ �ڽ��� �����ؾ߸� �մϴ�.  ï¿½ï¿½ï¿½ï¿½ ����� �޼ҵ��� �������� �����ϴ� üũ �ڽ��� ǥ���ϸ�, ���� �÷����� �޼ҵ�� ���� Ŭ����/�������̽����� �߻����μ� ����� �� �ֽ��ϴ�.  ï¿½×·ï¿½ï¿½ï¿½, ���� ����� �������̽��� ����� ����ø��� �� üũ �ڽ��� ���õǰ�, �Ұ����ϰ� �ϰ� �˴ϴ�.

���� ��� ������ ������ �ʷ��� ������ �ִٸ�, ����� Ư���� ���� ǥ�� Ư¡�� ���� ������ ���Դϴ�.  ï¿½ï¿½ï¿½ï¿½ï¿½ä¸µï¿½ï¿½ ��������� ���������� � ������ �������� �� ��, ����� �Ķ� ������� ��ũ�� ������ �� �Դϴ�. ���� ǥ�ð� �ִ� ��� ���� ǥ�ô� ���� ��Ȳ�� ��ġ�Ǹ�, �����丵�� ����ǰ� �� �Ŀ� ������ ��Ȯ�� ��Ÿ�� ���� ���� �����մϴ�.  ï¿½ï¿½ï¿½ï¿½ ����� �����丵 ������� ����ϱ�� �����ϸ� ��ſ��� Problems Detected ï¿½ï¿½ï¿½Ì¾ï¿½Î±×°ï¿½ ������Ʈ �� ���Դϴ�.



�����丵(�׷��� ��� �ڵ�� ������ ���� ���� ���Դϴ�)�� �����ϱ� ���� Continue �� �����ϴ�.  ï¿½Ç´ï¿½ �ʿ��� ������ �ϱ� ���ؼ� Pull Members Up  ï¿½ï¿½ï¿½Ì¾ï¿½Î±×·ï¿½ ���ư��� ���ؼ� Cancel  �� �����ϴ�

������ ��� ������ �������� ������ ������ ���� ����, �װ� ������ ���콺 �����͸� ������Ű�ʽÿ�.  ï¿½ï¿½ï¿½ï¿½ ������ �ִ� �˾� �޽����� ��Ÿ�� ���Դϴ�.

Javadoc for abstracts  

����� �����ϴ� Javadoc �ڸ�Ʈ�� ������ �߻� �޼ҵ带 ����ø� �� ����� �Ƹ��� �װ͵��� �ٷ�⸦ ���ϴ� �� ����� ������ �� �Դϴ�.

����� As is�� �����ϴ� ������ Ŭ�������� �װ͵��� ���� �� �ֽ��ϴ�, ï¿½Ç´ï¿½ �װ͵��� Copy�� �����ϴ� ���� Ŭ����/�������̽��� �װ͵��� �����ϰų� ï¿½Ç´ï¿½ Move �� ������ �ű⿡�� �װ͵��� �̵��� �� �ֽ��ϴ�.


����� ��� ����� ����÷������� ������ �Ŀ�, �׷��� � ������ �߰����� �ʾҽ��ϴ�, �����丵�� �����ϱ� ���� OK�� Ŭ���Ͻʽÿ�.

Ư���� �ּ�

 

����� �����ڿ��� �ʱ�ȭ�� �ʵ带 ����ø� �ʿ䰡 ���� �� ��Ȳ�� Ư���� ���Ǹ� �ؾ� �մϴ�. ���� ���, ����� ������ �ڵ��� �����ϴ�:   
 
public class ClassParent {
    public ClassParent(int a) {
        //some code here
    }
}
 
public class ClassChild extends ClassParent  {
    HashMap myMap;
 
    public ClassChild() {
      super(27);
      myMap = new HashMap();
    }
}
 
�� ��Ȳ����, �����丵�� ����� ��, �ʵ�� �� �ʱ�ȭ�� �Բ� ����÷��� ���Դϴ�. �׸��� ������� �ڵ��� ������ ���� ���Դϴ�:  
 
public class ClassParent {
    HashMap myMap;
 
    public ClassParent(int a) {
        myMap = new HashMap();
        //some code here
    }
}
 
public class ClassChild extends ClassParent  {
 
    public ClassChild() {
      super(27);
    }
}

 

�׷��� �ʵ� �ʱ�ȭ�� ������ ��쿡�� as is�� ���� ���� ���Դϴ�:

 1.   ï¿½ï¿½ï¿½ï¿½ �ʵ� �ʱ�ȭ�� �ٸ� �����ڿ����� ���� �ʴٸ�.
 2.   ï¿½ï¿½ï¿½ï¿½ �ʵ� �ʱ�ȭ�� ������ �� ������ �����ϸ�.

���� ���, ���� �ڵ�(������ ���� �����ϸ鼭)���� �ʵ� �ʱ�ȭ�� myMap ï¿½Êµï¿½ï¿½ �Բ� ����÷����� ���� ���Դϴ�.

 
public class ClassChild extends ClassParent  {
    HashMap myMap;
 
    public ClassChild() {
      super(27);
      myMap = new HashMap();
    }
 
    public ClassChild(int capacity) {
      super(27);
      myMap = new HashMap(capacity);
    }
}