본문 바로가기

Java 배우기145

Questions and Exercises: Annotations Questions and Exercises: AnnotationsQuestionsWhat is wrong with the following interface?public interface House { @Deprecated void open(); void openFrontDoor(); void openBackDoor(); } Consider this implementation of the House interface, shown in Question 1.public class MyHouse implements House { public void open() {} public void openFrontDoor() {} public void openBackDoor() {} } If you compile th.. 2016. 1. 5.
Repeating Annotations Repeating Annotations There are some situations where you want to apply the same annotation to a declaration or type use. As of the Java SE 8 release, repeating annotations enable you to do this. For example, you are writing code to use a timer service that enables you to run a method at a given time or on a certain schedule, similar to the UNIX cron service. Now you want to set a timer to run a.. 2016. 1. 5.
Type Annotations and Pluggable Type Systems Type Annotations and Pluggable Type Systems Before the Java SE 8 release, annotations could only be applied to declarations. As of the Java SE 8 release, annotations can also be applied to any type use. This means that annotations can be used anywhere you use a type. A few examples of where types are used are class instance creation expressions (new), casts, implements clauses, and throws clause.. 2016. 1. 5.
Predefined Annotation Types 미리 정의된 어노테이션 타입들 미리 정의된 어노테이션 타입들 Predefined Annotation Types 1세트의 어노테이션 타입이 자바 SE API에 정의되어 있습니다. 일부 어노테이션 타입은 자바 컴파일러가 사용하고, 일부는 다른 어노테이션에 적용됩니다. A set of annotation types are predefined in the Java SE API. Some annotation types are used by the Java compiler, and some apply to other annotations. 자바 언어가 사용하는 어노테이션 타입 Annotation Types Used by the Java Language java.lang에 정의된 미리 정의된 어노테이션 타입들은 @Deprecated, @Overr.. 2016. 1. 5.
Declaring an Annotation Type 어노테이션 타입 선언하기 어노테이션 타입 선언하기 Declaring an Annotation Type 많은 어노테이션들이 코드 안의 코멘트를 대체합니다. 소프트웨어 그룹이 전통적으로 모든 클래스의 몸체를 중요한 정보를 제공하는 코멘트로 시작한다고 가정합니다. Many annotations replace comments in code. Suppose that a software group traditionally starts the body of every class with comments providing important information:public class Generation3List extends Generation2List { // Author: John Doe // Date: 3/17/2002 // Curren.. 2016. 1. 5.
Annotations Basics Annotations BasicsThe Format of an Annotation제일 간단한 폼의 주석은 아래와 같습니다: In its simplest form, an annotation looks like the following:@Entity at sign 글자(@)는 @)뒤에 오는 것은 주석임을 컴파일러에게 알려줍니다. 아래 예제에서 주석의 이름은 Override 입니다: The at sign character (@) indicates to the compiler that what follows is an annotation. In the following example, the annotation's name is Override:@Override void mySuperMethod() { ... .. 2016. 1. 5.