Package edu.pdx.cs410J.di
Class JaxbDatabase
java.lang.Object
edu.pdx.cs410J.di.JaxbDatabase
- Direct Known Subclasses:
BookDatabase
,CreditCardDatabase
The superclass of classes that store objects serialized to a file using JAXB
-
Constructor Summary
ModifierConstructorDescriptionprotected
JaxbDatabase
(File directory, String fileName, Class<?>... jaxbClasses) -
Method Summary
-
Constructor Details
-
JaxbDatabase
protected JaxbDatabase(File directory, String fileName, Class<?>... jaxbClasses) throws IOException, jakarta.xml.bind.JAXBException - Throws:
IOException
jakarta.xml.bind.JAXBException
-
-
Method Details
-
writeXml
Writes an object as XML to the data file- Parameters:
xml
- The object to marshal
-
getDatabaseFile
-
readFile
Read the XML data file and returns the unmarshalled object- Returns:
- The object in the XML file or null if the file doesn't exist
- Throws:
jakarta.xml.bind.JAXBException
- if we can't read the file
-