反射:Class、Method
来源:互联网 发布:上瘾网络剧在线播放 编辑:程序博客网 时间:2024/05/06 20:43
java.lang .Class
Instances of the class Class
represent classes and interfaces in a running Java application. An enum is a kind of class and an annotation(注释) is a kind of interface. Every array also belongs(属于) to a class that is reflected as aClass
object that is shared(共享) by all arrays with the same element type and number of dimensions. The primitive(原生) Java types (boolean
,byte
,char
, short
, int
, long
, float
, and double
), and the keyword void
are also represented asClass
objects.
Class
has no public constructor. Instead Class
objects are constructed automatically(自动) by the Java Virtual Machine as classes are loaded and by calls to thedefineClass
method in the class loader.
The following example uses a Class
object to print the class name of an object:
void printClassName(Object obj) { System.out.println("The class of " + obj + " is " + obj.getClass().getName()); }
It is also possible to get the Class
object for a named type (or for void) using a class literal (JLS Section15.8.2). For example:
System.out.println("The name of class Foo is: "+Foo.class.getName());
java.lang.reflect .Class Method
A Method
provides information about, and access to, a single method on a class or interface. The reflected method may be a class method or an instance method (including an abstract method).
A Method
permits(允许) widening (扩展)conversions to occur when matching(匹配) the actual(实际) parameters to invoke with the underlying(底层) method's formal parameters, but it throws anIllegalArgumentException
if a narrowing (收缩)conversion would occur.
- 反射:Class、Method
- ReflectHelper 反射(Method,Class的应用一)
- ReflectHelper 反射(Method,Class的应用)
- Java反射机制--Class,Field,Method,Constructor
- Java反射之Method Class.getMethod(String name, Class<?>... parameterTypes)
- 反射机制:Class,Field,Method,Construts,Array的总结
- JAVA反射机制,get.method()/ Class.forName(className)
- java反射机制 及 Method.invoke,Class. getMethod()的使用
- Java反射机制知识点 (Class ,Field ,Method)
- java反射机制 及 Method.invoke,Class. getMethod()的使用
- java反射:通过Method、Class发现泛型的本质
- 反射--Method
- Class,Method
- Class,Method
- Class Method
- Class method
- Java深入(高新技术)(四):反射、Class、Constructor、Method、Field、数组的反射、JavaBean
- 反射(二)Class类,Method类,Field类,反射获得带参数的对象
- linux命令6
- 不同类型的数据层如何进行属性字段的连接?
- linux命令7
- Ubuntu12.04 root用户登录设置
- 强大的反射功能动态创建调用dll
- 反射:Class、Method
- SPI总结
- 对于时间的显示问题asp.net中获取年月日时间
- Java SE 6 新特性: 对脚本语言的支持
- willAnimateFirstHalfOfRotationToInterfaceOrientation 为什么没调用????
- sphinx学习
- android中service和aidl详细整理
- android 通话记录插入 短信插入 联系人插入
- elipse远程调试