본문 바로가기

개발/Tip

[이클립스] 자동으로 주석 생성

이클립스 자동 주석 생성 단축키 Alt+Shift+J

자동으로 해당 부분에 설정된 주석이 추가된다.

또는 /** 를 입력하고 엔터를 치는 경우에도 설정된 주석이 있는 경우 자동으로 내용이 삽입된다.

 

주석 형태는 Windows > Preferences > Java > Code Style > Code Templates 에서 설정 가능하다.

 

 

Code Templates 설정에 사용할 수 있는 각종 내장 변수는 ${}형태로 기술할 수 있다.

위 창에서 Edit버튼을 클릭하면 Insert Variable 버튼을 클릭해 삽입할 수도 있다.

 

> 내장 변수

  • bare_field_name : get,set 메소드에서 get/set등을 제외한 필드명
  • 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...) (Javadoc 태그 생성)
  • time : Current time (현재 시간)
  • todo : Todo task tag ('해야할일'태그 생성)
  • type_name : Name of the current type (현재 타입의 이름)
  • user : User name (사용자 이름)
  • year : Current year (현재 연도)