zoukankan      html  css  js  c++  java
  • java 和 objective-c 动态获得类型信息

    详细信息,请参看android官方文档中的class类的介绍 ,和苹果的官方文档Objective-C Runtime Reference

    java中常常听到反射reflection,在java的class类的文档中,这样介绍class类,The in-memory representation of a Java class. This representation serves as the starting point for querying class-related information, a process usually called "reflection". 这里可以看出,所谓的反射,就是querying class-related information,为什么命名为reflection,我想是因为,每个对象都是通过对应的class对象映射而成的,那么通过对象去查询class对象的信息,就应该称作reflection。通过每个对象的class对象,能在程序运行时,获得该对象的类的各种信息,比如构建函数,成员变量,等等。

    比如:

    Constructor [] constructors = Class.forName("java.lang.String").getConstructors();

    oc的运行时需要调用运行时库,例如 const char * class_getName(Class cls);

  • 相关阅读:
    本地blast用法
    linux挂载移动硬盘
    酶设计软件rosetta安装
    redhat 6.7 安装nvidia显卡驱动时出现的问题
    分子模拟软件Schrodinger Suites 2015安装
    Python_二维数组
    Python_递归
    Python_装饰器
    Python_生成器generator
    Python_迭代器
  • 原文地址:https://www.cnblogs.com/breezemist/p/3468903.html
Copyright © 2011-2022 走看看