The one requirement for storing your own custom classes in the PersistentStore
is that the class (and any other classes that it might contain) must implement the Persistable
interface. So let's do that now. Replace the JournalEntry
class declaration with the following one and you will be set up to store the JournalEntry
objects in the PersistentStore
.
public class JournalEntry implements Persistable
Implementing the Persistable
interface couldn't be any easier! The interface itself has no methods in it so there is no code to write besides creating the implements
specification itself. How easy is that?
You have to do this only for your own custom classes. Primitive data types as well as some common data structures, such as Vector
, are already handled automatically. However, if your data structure is complex, you will need to add the interface declaration to each class which is included as well as the main class that contains...