Search This Blog

Saturday, 14 January 2012

Reflection API

Reflection API:-
- Working with classes and interfaces of java.lang.Reflect.
-  Java lang is default package of java. But its sub packages are not default packages.
c language is set of functions. (.h files).
c++ is set of classes and functions (.h files).
Java is set of classes and interfaces (packages).

- Reflection means mirror image to perform a mirror image operations on a given Java class or interface to gather detail of them like member variables, names, super class names and etc., we use reflection API.

- Reflection API can develop
  1. class Browsers
  2. Debuggers
  3. GUI Builders 
These are part of IDE softwares.

Class Browser:-
- Using Class Browser Software we can gather internal details about given class.
Debugging:-
- Debugging is a process of fixing the problem by tracing flow of execution. while developing this debugger software developers will use Reflection API.
GUI Builder:-
- A GUI Builder is a application which allows the programmer to develop GUI screens based on drag and drop operations.  In this application to show the properties of selected components Reflection API support is required.
- IDE softwares contain Class Browsers, Debuggers and GUI Builders. So Reflection API is very useful to develop IDE softwares in java.
Editors for Java
1. Traditional Editors
    - Notepad, wordpad,ms-dos editor for windows
    - ui , pico ,ed for linux/unix
 2. Third Party Editors/Modern Editors
    - Ecllipse developed by Ecllipse Organization
    - RAD developed by IBM
    - NetBeans developed by Jet Brains + Sun Microsystems
    - JBuilder developed by Borland

- code to get list of interfaces implemented by given class
1. Class c = Class.forName("Test");
2. Class inter[]=c.getInterfaces();
3. for(int i=0; i<inter.length;++i)
{
String iname = inter[i].getName();
System.out.println("\t"+ iname);
}

inter[]
|--------- |
|class obj | 0
|--------- |
|class obj | 1
|--------- |
|class obj | 2
|--------- |
Class Test implements x,y,z
{
// variables
// methods
}
- Reflection API programs can act as mirror devices for a given java class/interface.

1 comment:

  1. Ducat one of the best IT Training & Certification Company in India provides high quality IT Training to raise the standard of professionalism in IT Industry.
    DUCAT provides CORE, ADVANCE, SPRING, STURTS AND HIBERNATE JAVA TRAINING IN GHAZIABAD AND GREATER NOIDA WITH 100% JOB ASSISTANCE.
    DUCAT provided the Live project training and Placement,6 month project training, 6 weeks project training, MCA project training & Placement for BCA, B.Tech, M.Tech, B.E, M.E, B.Sc IT, M.Sc IT & PGDCA.
    IF YOU KNOW MORE ABOUT THEN CLICK HERE JAVA TRAINING GHAZIABAD,GREATER NOIDA

    DUCAT - Greater Noida
    504, Tradex Tower-2, Sec-Alpha,
    Greater Noida, Uttar Pradesh
    E-Mail: g.noida@ducatindia.com
    Website: http://www.ducatindia.com

    Ducat, Ghaziabad
    1, Anand Industrial Estate,
    Near ITS College, Mohan Nagar,
    Ghaziabad (UP)
    E-Mail: info@ducatindia.com
    Website: http://www.ducatindia.com

    ReplyDelete