SlideShare a Scribd company logo
1 of 48
Using Java™ Technology Reflection to Improve Design
Agenda ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
What Is Reflection ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
What Is Reflection ,[object Object],[object Object],1. J. R. Jackson, A. L. McClellan, Java™ 1.2 By Example, Sun Microsystems, 1999. 2. M. Campione, et al, The Java™ Tutorial Continued, Addison Wesley, 1999.
The History of Reflection ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Why Runtime Class Identification ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Example UML
Runtime Class Identification Example Code ,[object Object],[object Object],[object Object]
How the Class Object Works ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Proof of Dynamic Loading public static void main (String[] args) { System.out.println ("inside main"); new A (); System.out.println ("After creating A"); try { Class.forName ("B"); } catch (ClassNotFoundException e) { e.printStackTrace (); } System.out.println ("After forName (amp;quot;Bamp;quot;)"); new C (); System.out.println ("After creating C"); }
Late Dynamic Binding ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Class Literals ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
The  instanceof  Keyword ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
The Reflection API ,[object Object],[object Object],[object Object],[object Object],[object Object]
Core Reflection Classes ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Core Reflection Classes (Cont.) ,[object Object],[object Object],[object Object],[object Object]
Core Reflection Classes (Cont.) ,[object Object],[object Object],[object Object]
Core Reflection Classes (Cont.) ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Core Reflection Classes (Cont.) ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Commonly Used Classes ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Using Reflection ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
What Can I Do With Reflection ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Here Is How To… ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Here Is How To… ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Here Is How To… ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Here Is How To… ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Four Myths of Reflection ,[object Object],[object Object],[object Object],[object Object]
“Reflection Is Only Useful for JavaBeans™ Technology-based Components” ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
“Reflection Is Too Complex for Use in General Applications” ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
“Reflection Reduces the  Performance of Applications” ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
“Reflection Cannot Be Used With the 100% Pure Java™ Certification Standard” ,[object Object],[object Object],[object Object],3. Sun Microsystems, 100% Pure Java™ Certification Guide, version 3.1, May 2000.
Advanced Reflection Issues ,[object Object],[object Object],[object Object],[object Object],[object Object]
Why Use Reflection ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Use Reflection With Design Patterns ,[object Object],[object Object],[object Object],[object Object]
Design Patterns and Reflection ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Factory Without Reflection
Factory With Reflection
Design Pattern Implications ,[object Object],[object Object],[object Object],[object Object]
Design Strategies for Using Reflection ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Challenge UI Listeners ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Listener Without Reflection
Listener With Reflection
Improvements to Reflection  in JDK™ 1.2 Release ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Improvements to Reflection in JDK™ 1.3 Release ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Capabilities Not Available Using Reflection ,[object Object],[object Object],[object Object],[object Object],[object Object]
Review ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Review ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Benefits of Reflection ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]

More Related Content

What's hot

Classes, objects in JAVA
Classes, objects in JAVAClasses, objects in JAVA
Classes, objects in JAVA
Abhilash Nair
 
Java Collections
Java CollectionsJava Collections
Java Collections
parag
 

What's hot (20)

Java class,object,method introduction
Java class,object,method introductionJava class,object,method introduction
Java class,object,method introduction
 
Classes, objects in JAVA
Classes, objects in JAVAClasses, objects in JAVA
Classes, objects in JAVA
 
Inheritance In Java
Inheritance In JavaInheritance In Java
Inheritance In Java
 
Method overloading
Method overloadingMethod overloading
Method overloading
 
collection framework in java
collection framework in javacollection framework in java
collection framework in java
 
Collections - Array List
Collections - Array List Collections - Array List
Collections - Array List
 
Abstract class in java
Abstract class in javaAbstract class in java
Abstract class in java
 
Java Lambda Expressions.pptx
Java Lambda Expressions.pptxJava Lambda Expressions.pptx
Java Lambda Expressions.pptx
 
Java 8 Lambda Built-in Functional Interfaces
Java 8 Lambda Built-in Functional InterfacesJava 8 Lambda Built-in Functional Interfaces
Java 8 Lambda Built-in Functional Interfaces
 
Java interfaces
Java interfacesJava interfaces
Java interfaces
 
Finalize() method
Finalize() methodFinalize() method
Finalize() method
 
java 8 new features
java 8 new features java 8 new features
java 8 new features
 
Class and Objects in Java
Class and Objects in JavaClass and Objects in Java
Class and Objects in Java
 
Abstract class
Abstract classAbstract class
Abstract class
 
Java Collections
Java CollectionsJava Collections
Java Collections
 
java interface and packages
java interface and packagesjava interface and packages
java interface and packages
 
Java abstract class & abstract methods
Java abstract class & abstract methodsJava abstract class & abstract methods
Java abstract class & abstract methods
 
Inheritance in java
Inheritance in java Inheritance in java
Inheritance in java
 
Access specifiers (Public Private Protected) C++
Access specifiers (Public Private  Protected) C++Access specifiers (Public Private  Protected) C++
Access specifiers (Public Private Protected) C++
 
Java program structure
Java program structure Java program structure
Java program structure
 

Viewers also liked

Java Reflection Explained Simply
Java Reflection Explained SimplyJava Reflection Explained Simply
Java Reflection Explained Simply
Ciaran McHale
 
Blackboard Pattern
Blackboard PatternBlackboard Pattern
Blackboard Pattern
tcab22
 
Java Serialization
Java SerializationJava Serialization
Java Serialization
imypraz
 

Viewers also liked (20)

Basics of reflection in java
Basics of reflection in javaBasics of reflection in java
Basics of reflection in java
 
Reflection in Java
Reflection in JavaReflection in Java
Reflection in Java
 
Java Reflection Explained Simply
Java Reflection Explained SimplyJava Reflection Explained Simply
Java Reflection Explained Simply
 
Supercharging reflective libraries with InvokeDynamic
Supercharging reflective libraries with InvokeDynamicSupercharging reflective libraries with InvokeDynamic
Supercharging reflective libraries with InvokeDynamic
 
Reflection Free Factories in Java
Reflection Free Factories in JavaReflection Free Factories in Java
Reflection Free Factories in Java
 
JAVA PROGRAMMING
JAVA PROGRAMMING JAVA PROGRAMMING
JAVA PROGRAMMING
 
Java reflection
Java reflectionJava reflection
Java reflection
 
Final project digital artifact
Final project digital artifactFinal project digital artifact
Final project digital artifact
 
Factory method pattern (Virtual Constructor)
Factory method pattern (Virtual Constructor)Factory method pattern (Virtual Constructor)
Factory method pattern (Virtual Constructor)
 
Java virtual machine
Java virtual machineJava virtual machine
Java virtual machine
 
Using Chef for Automated Infrastructure in the Cloud
Using Chef for Automated Infrastructure in the CloudUsing Chef for Automated Infrastructure in the Cloud
Using Chef for Automated Infrastructure in the Cloud
 
Experimental study of light reflection laws
Experimental study of light reflection lawsExperimental study of light reflection laws
Experimental study of light reflection laws
 
Blackboard Pattern
Blackboard PatternBlackboard Pattern
Blackboard Pattern
 
Java beans
Java beansJava beans
Java beans
 
Reflection and Introspection
Reflection and IntrospectionReflection and Introspection
Reflection and Introspection
 
Java Serialization
Java SerializationJava Serialization
Java Serialization
 
Java-java virtual machine
Java-java virtual machineJava-java virtual machine
Java-java virtual machine
 
Docker Introduction
Docker IntroductionDocker Introduction
Docker Introduction
 
javabeans
javabeansjavabeans
javabeans
 
Ansible - Introduction
Ansible - IntroductionAnsible - Introduction
Ansible - Introduction
 

Similar to Reflection in java

Advance java kvr -satya
Advance java  kvr -satyaAdvance java  kvr -satya
Advance java kvr -satya
Satya Johnny
 
Understanding And Using Reflection
Understanding And Using ReflectionUnderstanding And Using Reflection
Understanding And Using Reflection
Ganesh Samarthyam
 
Object and Classes in Java
Object and Classes in JavaObject and Classes in Java
Object and Classes in Java
backdoor
 
Object Oriented Programming with Java
Object Oriented Programming with JavaObject Oriented Programming with Java
Object Oriented Programming with Java
backdoor
 
Object oriented basics
Object oriented basicsObject oriented basics
Object oriented basics
vamshimahi
 

Similar to Reflection in java (20)

Java Reflection Concept and Working
Java Reflection Concept and WorkingJava Reflection Concept and Working
Java Reflection Concept and Working
 
Advanced java jee material by KV Rao sir
Advanced java jee material by KV Rao sirAdvanced java jee material by KV Rao sir
Advanced java jee material by KV Rao sir
 
Adv kvr -satya
Adv  kvr -satyaAdv  kvr -satya
Adv kvr -satya
 
Advance java kvr -satya
Advance java  kvr -satyaAdvance java  kvr -satya
Advance java kvr -satya
 
Understanding And Using Reflection
Understanding And Using ReflectionUnderstanding And Using Reflection
Understanding And Using Reflection
 
Ppt chapter05
Ppt chapter05Ppt chapter05
Ppt chapter05
 
Object Oriented Programming In .Net
Object Oriented Programming In .NetObject Oriented Programming In .Net
Object Oriented Programming In .Net
 
Software Design Patterns
Software Design PatternsSoftware Design Patterns
Software Design Patterns
 
Object and Classes in Java
Object and Classes in JavaObject and Classes in Java
Object and Classes in Java
 
Java bcs 21_vision academy_final
Java bcs 21_vision academy_finalJava bcs 21_vision academy_final
Java bcs 21_vision academy_final
 
Java mcq
Java mcqJava mcq
Java mcq
 
Oops
OopsOops
Oops
 
java_bba_21_vision academy_final.pdf
java_bba_21_vision academy_final.pdfjava_bba_21_vision academy_final.pdf
java_bba_21_vision academy_final.pdf
 
Java scjp-part1
Java scjp-part1Java scjp-part1
Java scjp-part1
 
Ppt chapter10
Ppt chapter10Ppt chapter10
Ppt chapter10
 
21UCAC31 Java Programming.pdf(MTNC)(BCA)
21UCAC31 Java Programming.pdf(MTNC)(BCA)21UCAC31 Java Programming.pdf(MTNC)(BCA)
21UCAC31 Java Programming.pdf(MTNC)(BCA)
 
JAVA Object Oriented Programming (OOP)
JAVA Object Oriented Programming (OOP)JAVA Object Oriented Programming (OOP)
JAVA Object Oriented Programming (OOP)
 
Object Oriented Programming with Java
Object Oriented Programming with JavaObject Oriented Programming with Java
Object Oriented Programming with Java
 
Object oriented basics
Object oriented basicsObject oriented basics
Object oriented basics
 
Design Patterns
Design PatternsDesign Patterns
Design Patterns
 

Recently uploaded

Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
 

Recently uploaded (20)

[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 

Reflection in java