ClassDesc — 클래스 상수 명목 기술자
ClassDesc — 클래스 상수 명목 기술자
ClassDesc는 Class 상수에 대한 명목 기술자(nominal descriptor)입니다. 일반적인 시스템 타입(모든 원시 타입 포함)에 대해서는 ConstantDescs에 미리 정의된 ClassDesc 상수가 있습니다. (java.lang.constant API는 void를 원시 타입으로 간주합니다.)
본문
클래스나 인터페이스 타입에 대한 ClassDesc를 만들려면 of(String) 또는 ofDescriptor(String)를 사용합니다. 배열 타입에 대한 ClassDesc를 만들려면 ofDescriptor(String)를 사용하거나, 먼저 컴포넌트 타입에 대한 ClassDesc를 얻은 뒤 arrayType() 또는 arrayType(int) 메서드를 호출합니다.
public sealed interface ClassDesc extends ConstantDesc, TypeDescriptor.OfField<ClassDesc>
주요 메서드
static ClassDesc of(String name)
static ClassDesc ofInternalName(String name)
static ClassDesc of(String packageName, String className)
static ClassDesc ofDescriptor(String descriptor)
default ClassDesc arrayType()
default ClassDesc arrayType(int rank)
default ClassDesc nested(String nestedName)
default boolean isArray()
default boolean isPrimitive()
default boolean isClassOrInterface()
default ClassDesc componentType()
default String packageName()
default String displayName()
String descriptorString()
Class<?> resolveConstantDesc(MethodHandles.Lookup lookup) throws ReflectiveOperationException
boolean equals(Object o)
of계열 메서드는 다양한 형태의 이름으로ClassDesc를 생성합니다.arrayType()는 이 클래스의 1차원 배열 타입 기술자를 만듭니다.descriptorString()는 JVM 타입 기술자(Ljava/lang/String;등)를 반환합니다.resolveConstantDesc는 이 기술자를 실제Class객체로 해석합니다.