> For the complete documentation index, see [llms.txt](https://docs.sysout.co.kr/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.sysout.co.kr/base-language/java/java-advanced/java-reflection.md).

# Java Reflection

## Java Reflection

{% hint style="info" %}
Reflection is a feature in the Java programming language. It allows an executing Java program to examine or "introspect" upon itself, and manipulate internal properties of the program. For example, it's possible for a Java class to obtain the names of all its members and display them.

*리플렉션은 Java 프로그래밍 언어의 기능입니다. 이를 통해 실행 중인 Java 프로그램이 자체적으로 검사하거나 "내성"하고 프로그램의 내부 속성을 조작할 수 있습니다. 예를 들어, Java 클래스가 모든 구성원의 이름을 가져와 표시할 수 있습니다.*

> Oracle technical resource - Java Reflection
>
> <https://www.oracle.com/technical-resources/articles/java/javareflection.html>
> {% endhint %}

Java Reflection은 미지의 클래스를 분석하고 제어할 수 있는 기술이다. 이해하기 위해 기본적인 클래스 구조와 다양한 용어에 대해서 잘 알고 있어야 한다. 잘 활용하면 미지의 클래스에 대한 다양한 처리가 가능하고, 더 나아가면 Framework의 초석이 되는 기본 구조를 구축할 수 있다. 따라서 무조건적인 학습보다는 기존의 방식으로 해결할 수 없는 상황에 대한 이해가 선행되어야 한다. 다음과 같은 상황에서 사용하면 유용하다. &#x20;

* 패키지를 특정할 수 없는 경우&#x20;
* 클래스를 특정할 수 없는 경우&#x20;
* Annotation에 의한 메타 프로그래밍을 구현하고 싶은 경우

Java Reflection은 [java.lang.reflect](https://docs.oracle.com/javase/8/docs/api/java/lang/reflect/package-frame.html) 패키지에 대부분의 내용이 존재한다. 이 문서에서는 Java Reflection의 사용법과 이용 방향에 대한 내용을 다룬다.
