ExecutableType — 실행 가능 타입 인터페이스
ExecutableType — 실행 가능 타입 인터페이스
ExecutableType는 실행 가능 요소(executable)의 타입을 나타내는 인터페이스예요. 실행 가능 요소란 메서드, 생성자, 또는 초기화자를 말해요. 어떤 참조 타입의 메서드(또는 생성자·초기화자)로 볼 때의 형태로 표현돼요.
그 참조 타입이 매개변수화되어 있으면, 이 인터페이스의 메서드가 반환하는 타입들에 실제 타입 인자가 치환돼요. 관련 요소로 ExecutableElement가 있어요.
본문
선언은 다음과 같아요.
public interface ExecutableType extends TypeMirror
주요 메서드는 다음과 같아요.
| Modifier and Type | Method | 설명 |
|---|---|---|
List<? extends TypeMirror> |
getParameterTypes() |
이 실행 가능 요소의 형식 매개변수 타입들을 반환해요. |
TypeMirror |
getReceiverType() |
리시버 타입을 반환하고, 없으면 kind NONE인 NoType을 반환해요. |
TypeMirror |
getReturnType() |
이 실행 가능 요소의 반환 타입을 반환해요. |
List<? extends TypeMirror> |
getThrownTypes() |
throws 절에 나열된 예외·throwable들을 반환해요. |
List<? extends TypeVariable> |
getTypeVariables() |
형식 타입 매개변수가 선언한 타입 변수들을 반환해요. |
getParameterTypes()로 매개변수 타입, getReturnType()으로 반환 타입, getThrownTypes()로 던지는 예외, getTypeVariables()로 타입 변수 목록을 조회해요. 제네릭 클래스의 메서드면 타입 인자가 치환된 시그니처를 얻을 수 있어요. Since: 1.6.