ABOUT ME

-

Today
-
Yesterday
-
Total
-
  • 리플렉션 or RTTI(Run Time Type Information)
    프로그래밍 언어/데이터 타입 2013. 7. 25. 04:04

    * Java

    the classic cast

    In C++, the classic cast "(TYPE)" does not perform RTTI.

    type-safe downcast

    java.lang.ClassCastException


    instanceof


    java.lang.Object

    .getClass()    // Class


    java.lang.Class(type?) // Class<T>

    Initialization is delayed until the first reference to a static method (the constructor is implicitly static) or to a non-constant static field

    c.f. Class.forName()

    If there’s a superclass, initialize that. Execute static initializers and static initialization blocks.


    .forName()    // object

    .getSuperclass()    // object

    .getInterfaces    // Class[]


    .isInterface() 

    .newInstance()

    .getName()

    .getCanonicalName()    // Java SE5

    .getSimpleName()

    .getConstructors()    // Constructor[]

    .getConstructor()    // Constructor

    .getField()    // Field

    .getMethods() // java.lang.reflect.Method[]

    .getDeclaredMethods()    // java.lang.reflect.Method[]

    .getMethod()    // Method

    .cast()

    .asSubclass()


    boolean.class    // or Boolean.TYPE


    Constructor

    .newInstance(()


    Field

    .set()

    .get()


    java.lang.reflect.AccessibleObject

    .isAnnotationPresent()


    java.lang.reflect.Executable -> AccessibleObject


    java.lang.reflect.Method -> Executable

    .getAnnotation(Class<T>)    // java.lang.annotation.Annotation

    .getAnnotationsByType(Class<T>)    // java.lang.annotation.Annotation[]

    .getName()

    .invoke()


    * C#

    is 연산자

    as 연산자

    typeof 연산자


    * C++

    typeid 연산자


    type_info

    .name()



    참조 사이트:

    http://jjjryu.tistory.com/entry/%EC%96%B4%EB%85%B8%ED%85%8C%EC%9D%B4%EC%85%98%EC%96%B4%ED%8A%B8%EB%A6%AC%EB%B7%B0%ED%8A%B8

    https://gyrfalcon.tistory.com/entry/Java-Reflection

    https://hamait.tistory.com/317?category=79137


Designed by Tistory.