|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectUtils.Settings
public class Settings
Represents the value of settings (including retutning default settings). The
constructor checks the validity of the settings past to it.
Settings can either be root level settings or within a group. Only a single
level of groups is a allowed (i.e. a groups within a group is disallowed).
PossibleSettings
represents the list of settings that are possible.
Each setting can be optional or compulsory. Groups can like wise be optional
or compulsory. If a group is optional then any settings within it which are
comulsory are only compulsory when the group is present.
SetSettings
represents the current value of settings, e.g. from a
settings file or from a GUI. SetSettings represents values set by a user
whereas this class represents values need by a program - it takes into
account default values and the constructor of this class ensures that all
needed settings are set and there aren't any unexpected settings (as this is
probably an input error).
Constructor Summary | |
---|---|
Settings(PossibleSettings need,
SetSettings set)
Creates an instance of this class |
Method Summary | |
---|---|
java.lang.String |
getSetting(java.lang.String setting)
Gets the value of a root level setting |
java.lang.String |
getSetting(java.lang.String group,
java.lang.String setting)
Gets the value of a setting within a group |
boolean |
hasGroup(java.lang.String group)
Tests whether a group is present |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Settings(PossibleSettings need, SetSettings set) throws SettingException
need
- Settings needed by the programset
- Settings set by the user
SettingException
- If a setting that needs to be set isn't or an
unexpected setting is setMethod Detail |
---|
public java.lang.String getSetting(java.lang.String setting) throws SettingException
setting
- The setting's name
SettingException
- Thrown if there is no default value (this
shouldn't occur due to the chacks at construction).public java.lang.String getSetting(java.lang.String group, java.lang.String setting) throws SettingException
group
- The group's namesetting
- The settings name
SettingException
- Thrown if there is no default value (this
shouldn't occur due to the chacks at construction).public boolean hasGroup(java.lang.String group)
group
- The group's name
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |