-
-
[分享][JAVA] Reflection - The Java Reflection API
-
发表于: 2011-2-2 07:00 4412
-
Reflection - The Java Reflection API
[left]With the introduction of Java Beans was also the birth of Reflection (formerly " Introspection ")
forced initiated because objects were previously found only in static structures. This in turn
meantthat the classes had already at compile be available. Because of this fact but the genericapplication
form request can not be extended to the interface of a plugin, corresponded, it wasdecided to introduce
a new technique? Introspection (later Reflection ).
The term Reflection here means that programs which are a generic design to be able put in for herclasses
(unknown such as by direct user input) to create instances of objects. The Reflection APIincludes the
following features:
Determine the class of an object
Details of Klassenmodifikatoren, members, methods, constructors, and superclasses get.
Get out what constants and method declarations belong to an interface.
Creating an instance of a class known until runtime.
Reading and setting of values of a member even if the member is known by name at run time.
Calling methods of an unknown object at runtime.
Generation of arrays, the size and type until run time are not known and modifications to theindividual array components.
Contents
1
Investigation of classes
1.1
Querying the Class object
2.1
Query the class name
1.3
Finding of Klassenmodifikatoren
4.1
superclasses identify
1.5
Identification of implemented interfaces
1.6
classes for their members (Fields) analyze
1.7
constructors of a class determine
1.8
The methods of a class representing
2
objects manipulated
2.1 Position the
object generation
2.1.1
Creating objects using parameterless constructors
2.1.2
Creating objects using parameterized constructors
2.2 Value
of members read
2.3
Values of members and share
2.4
Calling methods
3 Using
Arrays
3.1 Identification
of arrays
3.2 To identify
the array type
3.3
arrays produce read, and fill
4
Summary of all the reflection classesInvestigation[/left]
REFLECTION
reflect
[left]With the introduction of Java Beans was also the birth of Reflection (formerly " Introspection ")
forced initiated because objects were previously found only in static structures. This in turn
meantthat the classes had already at compile be available. Because of this fact but the genericapplication
form request can not be extended to the interface of a plugin, corresponded, it wasdecided to introduce
a new technique? Introspection (later Reflection ).
The term Reflection here means that programs which are a generic design to be able put in for herclasses
(unknown such as by direct user input) to create instances of objects. The Reflection APIincludes the
following features:
Determine the class of an object
Details of Klassenmodifikatoren, members, methods, constructors, and superclasses get.
Get out what constants and method declarations belong to an interface.
Creating an instance of a class known until runtime.
Reading and setting of values of a member even if the member is known by name at run time.
Calling methods of an unknown object at runtime.
Generation of arrays, the size and type until run time are not known and modifications to theindividual array components.
Contents
1
Investigation of classes
1.1
Querying the Class object
2.1
Query the class name
1.3
Finding of Klassenmodifikatoren
4.1
superclasses identify
1.5
Identification of implemented interfaces
1.6
classes for their members (Fields) analyze
1.7
constructors of a class determine
1.8
The methods of a class representing
2
objects manipulated
2.1 Position the
object generation
2.1.1
Creating objects using parameterless constructors
2.1.2
Creating objects using parameterized constructors
2.2 Value
of members read
2.3
Values of members and share
2.4
Calling methods
3 Using
Arrays
3.1 Identification
of arrays
3.2 To identify
the array type
3.3
arrays produce read, and fill
4
Summary of all the reflection classesInvestigation[/left]
REFLECTION
reflect
赞赏
他的文章
看原图
赞赏
雪币:
留言: