예 | 규칙 |
---|---|
public class Test { ▨▨▨▨private String name; } |
|
private int sum = a + b + c + d + e + f ▨▨▨▨▨▨▨+ g + h + i + j; |
|
▨▨▨▨private int a = 0; ▨▨▨▨private int b = 0; |
|
private static void longName(int longNameArg1, ▨▨▨▨▨▨▨▨Object longNameArg2) { ▨▨▨▨// Statements }; |
|
result = (aLongBooleanExpression) ? value1 ▨▨▨▨▨▨▨▨: value2; |
|
예 | 규칙 |
---|---|
for (expr1;▨expr2;▨expr3) { // Statements }; |
|
doSomething(para1,▨para2,▨para3,▨para4); |
|
if▨(condition)▨{ // Statements }; |
|
doMethod((byte)▨num, (Object)▨obj); doMethod((byte)▨(num + 5), (int)▨(i + 3) + 1); |
|
a▨+=▨c▨+▨d; a▨=▨(a▨+▨b)▨/▨(c▨*▨d); |
|
i++; // Don’t use this i▨++; i--; // Don’t use this i▨--; |
|
// Statements #1 ▨ // Statements #2 |
|
public void doMethod1() { } ▨ public void doMethod2() { } |
|
- 파일, 메소드, data structures, algorithms 등을 설명하기 위해 주로 사용 가능
- 각 file, method, variable 시작에 작성합니다
- 메소드 내의 블록 주석문은 다음 라인과 동일한 들여쓰기를 기준
▨▨▨▨/** ▨▨▨▨▨* ▨▨▨▨▨*/ ▨▨▨▨private String name;
if (condition) { ▨▨▨▨// Statements };
if (condition) { ▨▨▨▨return; // Statements } else { ▨▨▨▨ return; // Statements };
- 직접 소스코드를 가질 필요가 없는 개발자들에 보여주거나 소스코드의 설계 명세서를 작성하기 위한 JAVA Documentation을 생성한다.
- class, interface, constructor, method, field에 대한 comment를 생성한다.
- 특징 : comment안에 java document tag와 html tag가 들어간다.
지원Tag | 설명 |
---|---|
@author | 클래스나 인터페이스의 제작자 정보 |
@deprecated | 사용하지 않는 메소드에 대한 설명 |
@throw | 예외에 대한 정의 |
@param | method의 parameter, output parameter는 <b>...</b>로 강조 |
@return | method의 return 값에 대한 설명 |
@see | 다른 클래스, 메소드, 또는 필드와 같이 다른 이름을 가진 프로그램에 대한 링크 |
@since | 코드에 대한 소개 시점 |
@throws | 메소드가 어떤 예외처리를 가져야 하는지에 대한 설명 |
@version | 코드의 버전 정보 |
- 주석은 아래의 표준을 준수하여 작성하며, 자바 문서화 주석(javadoc)으로 생성 및 사용한다.
/** * <pre> * Statements * </pre> * * @ClassName : ClassName.java * @Description : 클래스 설명을 기술합니다. * @author : Author Name * @since : 20xx. x. x. * @version : 1.0 * @see * @Modification Information * <pre> * since author description * ========= =========== =========================== * 20xx. x. x. Author Name 최초 생성 * </pre> */ public class Test { }
/** * Statements * * @param name * @param age * @return * @throws Exception */ public String doMethod(String name, int age) throws Exception { String result = ""; return result; }
- 변수의 이름 및 용도를 기술
/** * Statements * (Sting) name */ private String name;
- 변수의 용도를 기술
- 설명의 길이가 1줄이면 single-line comment 사용하고, 2줄이상이면 Block comment 사용
public void doMethod() throws Exception { String name = ""; // 사용자 이름 /* * Statements */ }
- 직접 소스코드를 가질 필요가 없는 개발자들에 보여주거나 소스코드의 설계 명세서를 작성하기 위한 Js Documentation을 생성한다.
- class, interface, constructor, method, field에 대한 comment를 생성한다.
- 특징 : comment안에 js document tag와 html tag가 들어간다.
지원Tag | 설명 |
---|---|
@author | 클래스나 인터페이스의 제작자 정보 |
@deprecated | 사용하지 않는 메소드에 대한 설명 |
@throw | 예외에 대한 정의 |
@param | method의 parameter, output parameter는 <b>...</b>로 강조 |
@return | method의 return 값에 대한 설명 |
@see | 다른 클래스, 메소드, 또는 필드와 같이 다른 이름을 가진 프로그램에 대한 링크 |
@since | 코드에 대한 소개 시점 |
@throws | 메소드가 어떤 예외처리를 가져야 하는지에 대한 설명 |
@version | 코드의 버전 정보 |
@copy | 다른 클래스에 입력되어진 Tag의 내용을 그대로 복사 |
@constType | const 속성에 대한 값을 출력 |
@eventType | 이벤트 타입을 지정 |
/** * Supported Browser : MSIE, Chrome , FireFox * * Object : test.js * Description : js 파일 설명을 기술합니다. * Author : Author Name * Since : 20xx.x. x. * Version : 1.0 * * Modification Information * since author description * ========= =========== =========================== * 20xx. x. x. Author Name 최초 생성 */
- 변수의 이름 및 용도를 기술
/** * 이름 * name */ var name;
- 변수의 용도를 기술
- 설명의 길이가 1줄이면 single-line comment 사용하고, 2줄이상이면 Block comment 사용
function doSometing() { var name = ""; // 사용자 이름 /* * Statments */ }
/** * fn name : function Name * Description : function 설명을 기술합니다 * Author : Author Name * Since : 20xx. x. x. * Version : 1.0 * * Modification Information * since author description * ========= =========== =========================== * 20xx. x. x. Author Name 최초 생성 */ /** * method description * @param obj * @returns {Object} */ function doSometing(obj){ return obj; } function doSometing(obj){ return obj; }
<%-- JSP Name : jspName.jsp Description : 설명을 기술합니다. author : Author Name since : 20xx. x. x. version : 1.0 Modification Information since author description ========= =========== =========================== 20xx. x. x. Author Name 최초 생성 --%>
<!-- SQL Name : sqlname_sql.xml Description : 설명을 기술합니다. author : Author Name since : 20xx. x. x. version : 1.0 Modification Information since author description ========= =========== =========================== 20xx. x. x. Author Name 최초 생성 --%>
<!-- Query Name : XXXDAO.XXXXX Description : 설명을 기술합니다. author : Author Name since : 20xx. x. x. Modification Information since author description ========= =========== =========================== 20xx. x. x. Author Name 최초 생성 --%>
예 | 규칙 |
---|---|
-- | SQL 내의 주석 |
<!-- --> | XML 내의 주석 |