public interface Database<D extends Database<D,G,E,I>,G extends Group<D,G,E,I>,E extends Entry<D,G,E,I>,I extends Icon>
A database is a factory for new Groups and Entries. Groups and entries belonging
to one database cannot in general be added to another database, they need to be
imported using newGroup(Group) and newEntry(Entry), or implicitly
imported using Group.addGroup(Group) which automatically create Groups and
Entries (as well as importing sub groups and their entries). Group.addEntry(Entry)
allows arbitrary importing from other databases.
Databases may be navigated directly from the root getRootGroup(),
or using a Visitor and visit(Visitor) or visit(Group, Visitor)
to start the visit at a particular group.
A list of entries that match a string or some custom criteria may be obtained using
the findEntries(Entry.Matcher) and findEntries(String) methods.
To match (optionally recursively) entries in a Group use
Group.findEntries(String, boolean) or Group.findEntries(Entry.Matcher, boolean).
All Lists provided returned by methods of all interfaces may be modified by the caller without affecting the underlying database structure, however changes to the Groups and Entries contained in the lists do modify the database.
| Modifier and Type | Method and Description |
|---|---|
List<? extends E> |
findEntries(Entry.Matcher matcher)
Find all entries that match the criteria
|
List<? extends E> |
findEntries(String find)
Find all entries that match
Entry.match(String) |
String |
getDescription()
Gets the database description, if there is one
|
String |
getName()
Gets the name of the database or null if not supported
|
G |
getRootGroup()
get the root group for the database
|
boolean |
isDirty()
True if database been modified
|
E |
newEntry()
Create a new Entry
|
E |
newEntry(Entry<?,?,?,?> entry)
Create a new Entry copying the details of the supplied entry
|
E |
newEntry(String title)
Create a new Entry with a title
|
G |
newGroup()
Create a new Group
|
G |
newGroup(Group group)
Create a new Group copying the details of the supplied group, but not copying its children
|
G |
newGroup(String name)
Create a new named Group
|
I |
newIcon()
Create a new default icon
|
I |
newIcon(Integer i)
Create a new icon with a specified index
|
void |
save(Credentials credentials,
OutputStream outputStream)
Save the database to a stream
|
void |
setDescription(String description)
Sets the database description if it is supported
|
void |
setName(String name)
Set the name of the database if this is supported
|
boolean |
shouldProtect(String propertyName)
Properties to encrypt
|
void |
visit(G group,
Visitor visitor)
Visit all entries starting from a group
|
void |
visit(Visitor visitor)
Visit all entries
|
G getRootGroup()
G newGroup()
G newGroup(String name)
name - the name of the groupG newGroup(Group group)
Used for copying a group from one database to another
group - the group to copyE newEntry()
E newEntry(Entry<?,?,?,?> entry)
Used for copying an entry from one database to another
entry - the entry to copyI newIcon()
I newIcon(Integer i)
i - the index of the icon to createvoid visit(Visitor visitor)
visitor - the visitor to usevoid visit(G group, Visitor visitor)
group - the group to start atvisitor - the visitor to useList<? extends E> findEntries(Entry.Matcher matcher)
matcher - the matcher to useList<? extends E> findEntries(String find)
Entry.match(String)find - string to findString getName()
void setName(String name)
name - the nameString getDescription()
void setDescription(String description)
description - a description of the databaseboolean isDirty()
void save(Credentials credentials, OutputStream outputStream) throws IOException
IOExceptionboolean shouldProtect(String propertyName)
propertyName - the property of interestCopyright © 2016. All rights reserved.