Swing Component in java
java programming and c, c++, Matlab, Python, HTML, CSS programming language, and new techniques news and any history.
Class,
java programming and c, c++, Matlab, Python, HTML, CSS programming language, and new techniques news and any history.
Reflection API
Reflection means an ability of a software to analyze itself. In Java, Reflection API provides a facility to analyze and change the runtime behavior of a Class, at runtime.
For example, using reflection at the runtime you can determine what method, field, constructor or modifiers a class supports.
What is reflect package?
java.lang.reflect
package encapsulates several important interfaces and classes. These classes and interface define methods which are used for reflection.Some Important Classes of java.lang.reflect package
Class, does? | |
---|---|
Array | allow you to dynamically create and manipulate arrays |
Constructor | gives information about constructor of a class |
Field | provide information about field |
Ma method | provides information about a method |
the Modifier | provide information about a class the nd member access modifier |
Proxy | supports dynamic proxy classes |
Apart from these classes
java.lang.Class
is another very important class used in Reflection API.Uses of Reflection
- Developing IDE
- Debugging and Test tools
- Loading drivers and providing dynamic information
Disadvantages of Reflection
- Low performance
- Security risk
- Violation of Oops concept
Legacy Classes
An early version of Java did not include the Collection framework. It only defined several classes and interface that provide a method for storing objects. When Collection framework was added in J2SE 1.2, the original classes were re-engineered to support the collection interface. These classes are also known as Legacy classes. All legacy classes and interface were redesigns by JDK 5 to support Generics.
The following are the legacy classes defined by java.util package
- Dictionary
- HashTable
- Properties
- Stack
- Vector
There is only one legacy interface called Enumeration
NOTE: All the legacy classes are syncronized
Enumeration interface
- Enumeration interface defines a method to enumerate through a collection of object.
- This interface is suspended by Iterator interface.
- However, some legacy classes such as Vector and Properties defines several methods in which Enumeration interface is used.
- It specifies the following two methods
Comments
Post a Comment