public class OptionMaster extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
OptionMaster.OptionPlatform
Option s can be either platform-specific or applicable to all
platforms. |
static class |
OptionMaster.Type
The different types of
Option s. |
static class |
OptionMaster.Visibility
Different ways that an
Option might be displayed. |
Modifier and Type | Field and Description |
---|---|
java.lang.Object[][] |
blahblah |
static java.lang.String |
EMPTY_STRING |
private static OptionMaster |
instance |
private java.util.Map<java.lang.String,? extends Option> |
optionMap
Maps an option ID to the corresponding object.
|
static char |
QUOTE_CHAR |
static java.lang.String |
QUOTE_STRING |
static java.lang.String |
SET_PREFIX |
Constructor and Description |
---|
OptionMaster() |
Modifier and Type | Method and Description |
---|---|
private java.util.Map<java.lang.String,Option> |
buildOptions(java.lang.Object[][] options)
Creates the specified options and returns a mapping of the option ID
to the actual
Option object. |
protected OptionMaster.OptionPlatform |
convertToOptionPlatform()
Converts a
Platform to its corresponding
OptionMaster.OptionPlatform type. |
java.util.Collection<Option> |
getAllOptions()
Returns all the available startup manager options.
|
BooleanOption |
getBooleanOption(java.lang.String id)
|
DirectoryOption |
getDirectoryOption(java.lang.String id)
|
FileOption |
getFileOption(java.lang.String id) |
static OptionMaster |
getInstance() |
LoggerLevelOption |
getLoggerLevelOption(java.lang.String id)
|
MemoryOption |
getMemoryOption(java.lang.String id)
|
private Option |
getOption(java.lang.String id)
Returns the
Option mapped to id . |
SliderOption |
getSliderOption(java.lang.String id)
|
TextOption |
getTextOption(java.lang.String id)
|
private void |
normalizeUserDirectory() |
java.util.List<Option> |
optionsByPlatform(java.util.Collection<OptionMaster.OptionPlatform> platforms)
Returns the
Options applicable to the given
OptionPlatforms . |
java.util.List<Option> |
optionsByType(java.util.Collection<OptionMaster.Type> types)
|
java.util.List<Option> |
optionsByVisibility(java.util.Collection<OptionMaster.Visibility> visibilities)
Returns the
Options that match the given levels of
visibility . |
void |
readStartup() |
void |
writeStartup() |
public static final java.lang.String SET_PREFIX
public static final java.lang.String EMPTY_STRING
public static final java.lang.String QUOTE_STRING
public static final char QUOTE_CHAR
public final java.lang.Object[][] blahblah
private java.util.Map<java.lang.String,? extends Option> optionMap
private static OptionMaster instance
public OptionMaster()
public static OptionMaster getInstance()
private java.util.Map<java.lang.String,Option> buildOptions(java.lang.Object[][] options)
Option
object.options
- An array specifying the Option
s to be built.Option
.java.lang.AssertionError
- if the option array contained an entry that
this method cannot build.protected OptionMaster.OptionPlatform convertToOptionPlatform()
Platform
to its corresponding
OptionMaster.OptionPlatform
type.OptionPlatform
type.java.lang.AssertionError
- if StartupManager.getPlatform()
returned something that this method cannot convert.private Option getOption(java.lang.String id)
Option
mapped to id
.id
- The ID whose associated Option
is to be returned.Option
associated with id
, or
null
if there was no association.getMemoryOption(java.lang.String)
,
getBooleanOption(java.lang.String)
,
getDirectoryOption(java.lang.String)
,
getSliderOption(java.lang.String)
,
getTextOption(java.lang.String)
,
getLoggerLevelOption(java.lang.String)
,
getFileOption(java.lang.String)
public MemoryOption getMemoryOption(java.lang.String id)
id
- Identifier for the desired MemoryOption
.
Should not be null
.MemoryOption
that corresponds to id
or null
.public BooleanOption getBooleanOption(java.lang.String id)
id
- Identifier for the desired BooleanOption
.
Should not be null
.BooleanOption
that corresponds to id
or null
.public DirectoryOption getDirectoryOption(java.lang.String id)
id
- Identifier for the desired DirectoryOption
.
Should not be null
.DirectoryOption
that corresponds to
id
or null
.public SliderOption getSliderOption(java.lang.String id)
id
- Identifier for the desired SliderOption
.
Should not be null
.SliderOption
that corresponds to id
or null
.public TextOption getTextOption(java.lang.String id)
id
- Identifier for the desired TextOption
.
Should not be null
.TextOption
that corresponds to id
or null
.public LoggerLevelOption getLoggerLevelOption(java.lang.String id)
id
- Identifier for the desired LoggerLevelOption
.
Should not be null
.LoggerLevelOption
that corresponds to id
or null
.public FileOption getFileOption(java.lang.String id)
public java.util.Collection<Option> getAllOptions()
Collection
.public java.util.List<Option> optionsByPlatform(java.util.Collection<OptionMaster.OptionPlatform> platforms)
Options
applicable to the given
OptionPlatforms
.platforms
- Desired platforms. Cannot be null
.List
of {code Option}-s applicable to
platforms
or an empty List
.public java.util.List<Option> optionsByType(java.util.Collection<OptionMaster.Type> types)
types
- Desired Option
types. Cannot be null
.List
of Option
-s that match the given
types or an empty List
.public java.util.List<Option> optionsByVisibility(java.util.Collection<OptionMaster.Visibility> visibilities)
Options
that match the given levels of
visibility
.visibilities
- Desired visibility levels. Cannot be null
.List
of Option
-s that match the given
visibility levels or an empty List
.private void normalizeUserDirectory()
public void readStartup()
public void writeStartup()