Unit 7: Object Transport Classes are often designed with reusability in mind. Programmers can exchange classes that were written by other programmers to use their functionality in their own software. This unit will introduce you to the concept of object transport. You will learn how XML can be used to describe a specific class, sent across the network, and reused by another user to regenerate a Java class, compile it, and use its API.
Unit 7 Time Advisory
This unit should take you approximately 8 hours to complete.
☐ Subunit 7.1: 4 hours
☐ Subunit 7.2: 4 hours
Unit7 Learning Outcomes
Upon successful completion of this unit, the student will be able to:
- Explain the usage of classes for reusability.
- Explain the purpose and achievement of object transport.
- Compare and contrast serialization and reflection.
- Complete XML programming tasks to describe a specific class, send it across the network, and reuse it as another user to regenerate a Java class, compile it, and use its API.
7.1 Reflection
- Reading: Oracle's “The Reflection API”
Link: Oracle's “The Reflection
API”
(HTML)
Instructions: Please read the “Reflection API” tutorial. What are the uses of reflection? What are its drawbacks?
Terms of Use: Please respect the copyright and terms of use displayed on the webpage above.
7.1.1 Reflection Classes
- Reading: Oracle's “Classes”
Link: Oracle's
“Classes”
(HTML)
Instructions: Please read the “Reflection Classes” tutorial. Complete all four tutorials that link from this tutorial. Compile and run the samples in each of the linked pages.
Terms of Use: Please respect the copyright and terms of use displayed on the webpage above.
7.1.2 Reflection Members
- Reading: Oracle's “Members”
Link: Oracle's
“Members”
(HTML)
Instructions: Please read the “Members” tutorial. The three member groups covered are fields, methods, and constructors. Follow the four links for each member group. Compile and run the samples in each of the linked pages. What are some common errors in reflecting fields, methods, and constructors?
Terms of Use: Please respect the copyright and terms of use displayed on the webpage above.
7.1.3 Reflection Arrays and Enumerated Types
- Reading: Oracle's “Arrays and Enumerated Types”
Link: Oracle's “Arrays and Enumerated
Types”
(HTML)
Instructions: Please read the “Arrays and Enumerated Types” tutorial. Complete the four links for arrays and the three links for enumerated types. Compile and run the samples in each of the linked pages. What are some common errors in reflecting arrays and enums?
Terms of Use: Please respect the copyright and terms of use displayed on the webpage above.
7.2 Java Architecture for XML Binding (JAXB)
- Reading: Oracle's “Introduction to JAXB”
Link: Oracle's “Introduction to
JAXB”
(HTML)
Instructions: Please complete the “Introduction to JAXB” tutorial. What is the purpose of XML binding?
Terms of Use: Please respect the copyright and terms of use displayed on the webpage above.
7.2.1 Marshalling and Unmarshalling Process
- Reading: Oracle's “JAXB Architecture”
Link: Oracle's “JAXB
Architecture”
(HTML)
Instructions: Please complete the “JAXB Architecture” tutorial. What are the components that comprise the JAXB implementation?
Terms of Use: Please respect the copyright and terms of use displayed on the webpage above.
7.2.2 Generating Classes from XML Schemas
- Reading: Oracle's “Binding XML Schemas”
Link: Oracle's “Binding XML
Schemas”
(HTML)
Instructions: Please complete the “Binding XML Schemas” tutorial. What are the two default mapping options?
Terms of Use: Please respect the copyright and terms of use displayed on the webpage above.
7.2.3 Customizing Generated Classes and Java Program Elements
- Reading: Oracle's “Customizing Generated Classes and Java Program
Elements”
Link: Oracle's “Customizing Generated Classes and Java Program
Elements”(HTML)
Instructions: Please review the “Customizing Generated Classes and Java Program Elements” tutorial. This material identifies the JAXB annotations for each Java element in tables as a programming reference for subunit 5.3.4 that follows below. This is a good site to bookmark so that you might find it quickly when you need the information it contains.
Terms of Use: Please respect the copyright and terms of use displayed on the webpage above.
7.2.4 JAXB Examples
- Reading: Oracle's “JAXB Examples”
Link: Oracle's “JAXB
Examples”
(HTML)
Instructions: Please complete the “JAXB Examples” tutorial, which includes several examples for basic, customized, and Java-to-schema binding. Compile and run at least one example from each of these three categories. Read the instructions carefully in the guidelines for running the examples in each grouping to maximize your time.
Terms of Use: Please respect the copyright and terms of use displayed on the webpage above.