Reflection is the runtime discovery of information, such as methods, fields, and constructors, about a given class or interface.
反射是运行时发现的关于给定类或接口的信息,如方法、字段和构造函数。
Here, we use reflection because we have loaded the application using a class loader that is not the system class loader.
这里,我们使用反射的原因是因为我们已经使用非系统类加载器加载了应用程序。
Reflection gives your executing code access to internal class information.
反射使执行代码能够访问内部类信息。
The First time value is the time taken for constructing the first reflection replacement class, which includes the time to load and initialize the classes in the framework code.
第一个时间值是构建第一个反射替代类所花费的时间,这个时间包括装载和初始化框架代码中的类的时间。
In these cases, reflection won't work for you — reflection USES the JVM's class structures as the source of information, so it can only work with classes that have been loaded by the JVM.
在这样的时候,反射对您来说就不再是一种行之有效的办法——反射将JV m类结构作为信息源使用,因此它仅对已由JVM装载的类起作用。
You can build a model of this type by using reflection, after first loading the target program's class files into the JVM.
可以利用反射,在第一次把目标程序的类文件装入 JVM 之后,创建这种类型的模型。
In C#, attributes work through .NET reflection, which is the ability of a class to describe itself.
C#中,属性通过 .NET反射起作用,这是指类可以进行自我描述的能力。
Rather than using reflection to access a property of an object, for example, you can construct a class at run time that does the same thing — but does it much faster.
它没有使用反射来访问对象的属性,例如,可以在运行时构建一个类来做同样的事——但这样做会快许多。
In their case, they avoided using reflection by instead working directly with class files, adding code to the classes generated by the compiler in order to provide direct access for the framework.
在他们的情况中,通过直接处理类文件,同时向编译器所生成的类添加代码以便为框架提供直接访问,来避免使用反射。
The JVM records this signature information when loading a class and makes it available at run time using reflection.
JVM在装载类时记录这个签名信息,并在运行时通过反射使它可用。
Now that I've demonstrated the reflection version of the code, I'll show you how to substitute a generated class for the use of reflection.
我已经展示了反射版本的代码,现在要展示如何用生成的类来取代反射。
The Class reflection calls to access method information are very similar to those used for constructors and fields.
获得方法信息的Class反射调用与用于构造函数和字段的调用非常类似。
The Class reflection calls to access field information are similar to those used to access constructors, with a field name used in place of an array of parameter types.
获得字段信息的Class反射调用不同于那些用于接入构造函数的调用,在参数类型数组中使用了字段名。
Listing 6 demonstrates a program that USES reflection on an instance of the Listing 1 TwoString class to show this in action.
清单6展示了一个程序,在清单1twostring类的一个实例上使用反射来显示安全性正在运行。
Here the HolderBean class contains a pair of properties that can be accessed at run time by using reflection to call the get and set methods.
在这里,HolderBean类包含一对属性,通过使用反射来调用get和set方法,可以在运行时访问这一对属性。
As you can see, Listing 4 just iterates through all the methods on the JsfFunction class using reflection.
如您所见,清单4只是使用反射遍历jsffunction类的所有方法。
Using reflection then, you have an ActionListener implementation, but don't have an added .class file in the file system.
然后使用反射,您有一个ActionListener实现,但是没有在文件系统中增加一个 .class 文件。
For example, say that you want to display all of the public methods of a given class using reflection. Listing 7 shows an example.
例如,假设您希望利用反射显示给定类的所有公共方法。
The Naked Objects framework is representative of a class of prototyping tools that rely on naming conventions in code along with reflection to automatically generate a UI from the code.
NakedObjects框架是一类典型的原型工具,这类工具依赖于代码中的命名约定以及从代码自动生成ui的反映机制。
Within the loop, we extract the value for the iterated key, and then we attempt to set that value into the bean through reflection, using the helper function defined in the PBHandler class.
在循环内部,我们为遍历到的键提取值,然后使用在PBHandler中定义的helper函数通过反射将该值放置到bean中。
The class object gives you all the basic hooks for reflection access to the class metadata.
Class对象为您提供接入类元数据的反射的所有基本hook。
Probably the best way to avoid their creation during the program is to avoid using reflection services to map class, field, or methods from strings during the time-critical parts of your application.
或许避免在程序执行期间创建这些类的最佳方式在于,避免在应用程序的时间关键型部分使用反射服务来从字符串映射类、字段或方法。
The basic approach here is to construct a custom class at runtime that will wrap access to the target classes (previously reached by reflection) in a way that can be used by your general-purpose code.
这里的基本方法是,在运行时,以一种可以被一般性代码使用的方式,构建一个自定义的类,其中将包装对目标类的访问(以前是通过反射达到的)。
Repeated use of the reflection classes in timing-sensitive code can result in ongoing class-loading activity that introduces delays.
在时间敏感型代码中反复使用反射类可能导致持续不断的类加载活动,这会引起延迟。
Reflection gives you run-time access to a variety of class information.
反射使您能够运行时接入广泛的类信息。
The class of 2009 is one of NASA’s smallest, and that’s a reflection of limited chances to fly in the future.
2009届是国家宇航局人数最少的一届之一,这意味着未来飞行的机会有限。
If the model class drop-down does not show any model classes, make sure you compiled the project. Entity Framework USES reflection, so it needs the compiled assembly.
如果“模型类”下拉列表未显示任何模型类,请确保已编译了此项目。实体框架使用反射,因此它需要已编译的程序集。
The work class should also be the many kinds of teaching method concentrated reflection.
劳动课也应是多种教学方法的集中反映。
If the model class drop-down does not show any model classes, make sure you compiled the project. Entity Framework USES reflection, so it needs the compiled assembly.
若是“模子类”下拉列表未显现任何模子类,请保证已编译了此名目。实体结构运用反射,因而它需求已编译的法式集。
If the model class drop-down does not show any model classes, make sure you compiled the project. Entity Framework USES reflection, so it needs the compiled assembly.
若是“模子类”下拉列表未显现任何模子类,请保证已编译了此名目。实体结构运用反射,因而它需求已编译的法式集。
应用推荐