public class MapMenuLoader
extends java.lang.Object
MapMenu contents to Preferences.| Modifier and Type | Class and Description |
|---|---|
static class |
MapMenuLoader.Result
Result value consisting of a
MapMenuEntry and its location
(directory). |
static class |
MapMenuLoader.Type
Preferences values for entries.
|
| Constructor and Description |
|---|
MapMenuLoader(@NotNull java.lang.String key,
@NotNull PathManager pathManager)
Creates a new instance.
|
| Modifier and Type | Method and Description |
|---|---|
@NotNull MapMenuLoader.Result |
loadEntry(int index)
Loads an entry from preferences.
|
int |
loadNumEntries()
Returns the number of entries present in the preferences.
|
void |
removeEntry(int index)
Removes an entry.
|
void |
saveEntry(int index,
@NotNull java.lang.String title,
@NotNull java.lang.String filename,
@NotNull java.lang.String directory,
@NotNull MapMenuLoader.Type type)
Saves an entry to preferences.
|
void |
saveNumEntries(int num)
Sets the number of entries present in the preferences.
|
public MapMenuLoader(@NotNull
@NotNull java.lang.String key,
@NotNull
@NotNull PathManager pathManager)
key - the preferences key prefixpathManager - the global path manager instancepublic int loadNumEntries()
public void saveNumEntries(int num)
num - the number of entries@NotNull public @NotNull MapMenuLoader.Result loadEntry(int index) throws java.io.IOException
index - the preference indexnulljava.io.IOException - if the entry cannot be loadedpublic void saveEntry(int index,
@NotNull
@NotNull java.lang.String title,
@NotNull
@NotNull java.lang.String filename,
@NotNull
@NotNull java.lang.String directory,
@NotNull
@NotNull MapMenuLoader.Type type)
index - the preference indextitle - the entry's titlefilename - the entry's file namedirectory - the entry's directorytype - the entry's typepublic void removeEntry(int index)
index - the preference index