We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
애너테이션 정의
@interface
public @interface MyAnnotation { }
@Target
@Rentention
@Target(ElementType.METHOD) @Retention(RetentionPolicy.RUNTIME) public @interface MyAnnotation { }
@Target : 애너테이션이 적용 가능한 대상
ex. TYPE, ANNOTATION_TYPE, FIELD, CONSTRUCTOR, METHOD
: 애너테이션이 유지되는 기간
ex. SOURCE, CLASS, RUNTIME
SOURCE: 소스파일에만 존재, 컴파일 후 클래스 파일에서는 사라짐 CLASS: 클래스 파일까지 존재, 런타임 시 사라짐 (Default) RUNTIME: 런타임까지 존재, 리플렉션을 통해 애너테이션 정보를 사용 가능
참고: https://joel-dev.site/83?category=1018629
The text was updated successfully, but these errors were encountered:
기본 애너테이션에 들어가보면 저런 Retention 이나 Target이 들어가있다니, 자주 확인해야겠다 애너테이션도 인터페이스 느낌 애너테이션 어떨때 사용자정의로 활용하는지 찾아봐야겠군
Sorry, something went wrong.
No branches or pull requests
애너테이션 정의
@interface
를 통해서 타입 선언을 한다.@Target
과@Rentention
을 작성해주어야 한다.@Target
: 애너테이션이 적용 가능한 대상
@Rentention
: 애너테이션이 유지되는 기간
참고: https://joel-dev.site/83?category=1018629
The text was updated successfully, but these errors were encountered: