mobilitymili.blogg.se

Java reflection to avoid if statements
Java reflection to avoid if statements






java reflection to avoid if statements

Why Runtime Class Identification Java™ technology takes advantage of polymorphism New subclasses easily added Bulk of behaviors inherited from its superclass No impact on other subclasses of the superclass At runtime, the JVM™ takes advantage of late dynamic binding Messages are directed to the correct method The History of Reflection Introduced in JDK™ 1.1 release to support the JavaBeans™ specification Used throughout the JDK™ software and Java runtime environment (JRE) Java™ Foundation Classes API (JFC) Jini™ connection technology JavaMail™ API JDBC™ API Improved in Java 1.2 SDK Further refined in Java 1.3 SDK Campione, et al, The Java™ Tutorial Continued, Addison Wesley, 1999.

java reflection to avoid if statements

McClellan, Java™ 1.2 By Example, Sun Microsystems, 1999. What Is Reflection “Reflection in a programming language context refers to the ability to observe and/or manipulate the inner workings of the environment programmatically.” 1 “The reflection API represents, or reflects, the classes, interfaces, and objects in the current Java™ virtual machine.” 2 1. What Is Reflection Java™ Technology provides two ways to discover information about an object at runtime Traditional runtime class identification The object’s class is available at compile and runtime Most commonly used Reflection The object’s class may not be available at compile or runtime Using Java™ Technology Reflection to Improve DesignĪgenda What is reflection History of reflection How to use reflection Myths about reflection Advanced reflection issues Improvements to reflection Conclusion








Java reflection to avoid if statements