August 2017
Beginner
298 pages
7h 26m
English
Here's the second problem with the way we've built the packt.contact module, and this one may not be all that obvious. Here's the method signature of the method in ContactLoader that we want consumers of this module to call:
public List<Contact> loadContacts(String fileName)
throws ParserConfigurationException, SAXException, IOException
What does a consumer of this module need to do to access this method? First, the consuming module needs to require packt.contact. With that, they have access to ContactLoader in their module. They can then call the loadContacts method in one of their classes. But wait! Since the loadContacts() throws three exceptions, the consuming method will need to catch them too!
try { contacts = contactLoader.loadContacts("input.xml"); ...Read now
Unlock full access