�� ������ Change Class Signature �����丵 ������ ��ſ��� �������� overview�� �����ϰ� how
�� �����丵�� IntelliJ
IDEA���� ���� �� �ִ°��� �����մϴ�.
Change Class Signature �� Ÿ�� �Ű� ������ �ٲٰ�, �׵��� ������ �����ϱ� ���� ���Ǵ� Generics �� Ư���� �����丵�Դϴ�. ���� ���, �츮�� �����丵 ���� ���� �ڵ带 �����ϴ�:
public void changingClassSingatureMethod(){
NewClass newClass = new NewClass();
//some code here...
}
Change Class Signature �����丵 ���� �ڵ�� ������ ���� �� ���Դϴ�:
public void changingClassSingatureMethod(){
NewClass<String> newClass = new NewClass<String>();
// some code here...
�翬��, Ŭ���� ������ �ٲ� ���Դϴ�.
�����丵 ����
public
class NewClass {
�����丵 ����
public class NewClass
<NewParam> {
Ŭ���� �ñ׳��� ����
|
Ŭ���� �ñ׳����� �����ϱ� ���ؼ�:
1. Project, �� �ٸ� ������
Commander ���� Ŭ������ �����ϰų� �Ǵ� ���� �����⿡�� ������Ǵ� Ŭ���� �̸����� ij���� ��ġ��Ű��, �� ���� �˾� �޴�(Ŭ������ ������ ��ư Ŭ���Ͽ�) �Ǵ� ���� Menu Bar �� �� ��� �����κ��� Ctrl + F6 ������ OR Refactor
| Change Signature...�� Ŭ���մϴ�.
2. ���� ���̾�α� ������� �����丵 �Ű� ������ �����ϱ� ���� ��Ÿ�� ���Դϴ�:

�Ű� ���� �׷�
|
�� ��Ͽ��� ����� ���õ� �޼ҵ�(���� Add �Ǵ� Remove ��ư�� ����Ͽ�)�� ���� �Ű� ������ �߰� �Ǵ� ������ �� �ְų�, �׵��� ����(���� Move
up �Ǵ� Move
down ��ư�� ����Ͽ�)�� ������ �� �ֽ��ϴ�. ���� ����� �����ϴ� �Ű� ���� �ʵ带 Ŭ���ϴ� �Ϳ� ���� �Ű� ������ Ÿ���� �����ϰų�, �̸��� ���ų�, ���Ӱ� �Է��� �� �ִ� �Ű� ������ ���� ����Ʈ ���� ������ �� �ֽ��ϴ�. ���� �Ű� ���� ���� �Ǵ� �̸��� ����Ȯ�ϸ� ��ſ��� Incorrect
Data ���̾�αװ� ������Ʈ �� �� �Դϴ�.

|
���� ���ο� Ÿ���� �Ű� ������ �߰��Ǹ�, �װ��� ����Ʈ ���� �����Ǿ�߸� �մϴ�.
�װ��� ������, ����� ������ Incorrect Data ���̾�α׸� �� ���Դϴ�:

|
|
�̸�
|
�Ű� ���� �̸��� ǥ���մϴ�.
|
����Ʈ ��
|
����Ʈ �Ű� ������ ǥ��/���� �մϴ�. �ڵ� �Ϸ��
intention action�� �̿�� �� �ֽ��ϴ�.
|
����� �̸����� ���
|
�� üũ �ڽ��� �����ϸ� ����� � ����� �߰ߵǾ����� �����ϰ�, �׵��� ��ü�� �����ϵ��� ����մϴ�.
�� üũ �ڽ��� ���õ��� ���� ��, IDEA�� ��ü�� �ڵ������� �����մϴ�.

|
������ üũ �ڽ��� ���õ��� �ʾ��� ����, ���� �߰ߵ� ����� � �б� ���� ���Ͽ��� �����ϸ� ����� ��� ��ü�� Ȯ���ϴ� ������Ʈ�� ��ſ� ���� �� �Դϴ�.
|
Refactoring Preview ���̾�α�(���� �װ��� ��Ÿ����)���� ����� ����� ������ �м��� �� �ֽ��ϴ�. �����丵�� �Բ� �����ϱ� ���ؼ�, Do
Refactor�� Ŭ���մϴ�, �׷��� �ʴٸ� Cancel �� Ŭ���մϴ�. ���� ���� ������ Refactoring
Preview�� ���ʽÿ�.
|
|
3. OK�� �����ϴ�, �׸��� Ŭ���� ���� �Բ� Ŭ���� �ñ׳����� ����� ���Դϴ�.

|
���� ����� ����Ʈ ���� ���� �Ű� ������ ��� �ϳ��� �����ϴ� �Ű� ������ �߰��ϸ�, �׷� ���� ��뿡�� ����� ���Դϴ�.
|
Ÿ�� �Ű������� �ٸ� Ŭ�����κ��� �ٸ� Ÿ���� �Ű������� �����Ͽ� �ٸ� �����Ҹ� Ȯ���ϴ� �ٿ�带 ���� �� �ֽ��ϴ�. ���� ���, public class ClassA <T, E> ���� �ڵ�� public class ClassA <T, E extends T>�� ���� ������ �� �ֽ��ϴ�.
�׷����� �Ű� ���� ������ ó���� public class ClassA <E, T> ���ٸ�, Change Class Signature �����丵�� ��� �� ��� �Ӹ��ƴ϶� Ŭ���� �ñ׳��Ŀ��� �� �Ű� ���� ������ �����ϱ⿡ ������ �� �Դϴ�.
���� �� �Ű� ������ �ٸ� �Ϳ� �����Ѵٸ� IDEA�� ������ ������ ���̽��� ���������� ó���ϰ� �Ű� ������ �����ϴ� ����� ������ �� �ֽ��ϴ�.
���� ��� ����� ������ Ŭ������ �����ϴ�:
public class TheClass <FirstParam> {
//class code
}
�׸��� TheClass�� ���� ��� �����ϴ� ���� �ִ� UsageClass.
public class UsageClass {
TheClass<String> theClass = new TheClass<String>();
TheClass<Integer> theClassInt = new TheClass<Integer>();
//class code
}
�����丵�� �����ϰ� TheClass ���� ����Ʈ �� List<FirstParam> �� �Բ� SecondParam ���ο� �Ű� ������ �߰��Ͻʽÿ�.
�׷���, ���� List�� ���� ����Ʈ���� ������, ��ſ��� �����ϴ� Import Assistant ���Ȱ� �Բ� ������Ʈ �� ���Դϴ�.


|
�ڵ� �Ϸ�� ���� �̿�� �� �ֽ��ϴ�.
|
�����丵 �ڵ尡 ������ ���� ���� �Ŀ�:
public class TheClass <FirstParam,SecondParam> {
//class code
}
public class UsageClass {
TheClass<String, List<String>> theClass = new TheClass<String, List<String>>();
TheClass<Integer, List<Integer>> theClassInt = new TheClass<Integer, List<Integer>>();
//class code
}
�Ű� ������ Ŭ���� �ν��Ͻ� �Ű� �������� ������ ����� �Բ� �߰��˴ϴ�.
|