본문 바로가기
Tip & Tech/Eclipse & Intellj

[Eclipse] Template를 통한 주석 자동생성 방법

by 나비와꽃기린 2016. 9. 7.
336x280(권장), 300x250(권장), 250x250, 200x200 크기의 광고 코드만 넣을 수 있습니다.

 

1. 설정방법

(1) Window > Preferences > Java > Code Style > Code Templates > Comments 선택

(2) 원하는 항목 (: Methods ) 선택 후 Edit 버튼 클릭

/**

  * @Method Name : ${enclosing_method}

  * @작성일 : ${date}

  * @작성자 : ${user}

  * @변경이력 :

  * @Method 설명 :

  * ${tags}

  */

 

(3) 다음과 같이 입력 후 OK 버튼 클릭 > 하단 Apply 버튼 클릭 > 최종 OK클릭

(4) 사용위치 소스 바로 위에 주석입력 단축키 ALT + SHIFT + J 를 사용하거나

/** (주석시작문구)을 작성한뒤 Enter를 누르면

설정한 CodeTemplate가 적용되는지를 확인하면 된다.

 

2. 주석 항목 설명

/**

  ${date} : Current date (현재 날짜)

  ${dollar} : The dollar symbol (달러문양)

  ${enclosing_type} : The type enclosing the method (선택된 메소드의 타입)

  ${file_name} : Name of the enclosing compilation (선택된 편집파일 이름)

  ${package_name} : Name of the enclosing package (선택된 패키지 이름)

  ${project_name} : Name of the enclosing project (선택된 프로젝트 이름)

  ${tags} : Generated Javadoc tags (@param, @return...) (Javedoc 태그 생성)

  ${time} : Current time (현재 시간)

  ${todo} : Todo task tag ('해야할일'태그 생성)

  ${type_name} : Name of the current type (현재 타입의 이름)

  ${user} : User name (사용자 이름)

  ${year} : Current year (현재 연도)

*/

 

3. Code Template 항목 설명

(1) Files :  *.java, *.jsp , 파일 맨 위에 생성되는 주석 설정

(2) Types : 클래스명 바로 위에 생성되는 주석 설정

(3) Methods : 메소드명 바로 위에 생성되는 주석 설정