Class Preferences
java.lang.Object
org.codehaus.groovy.tools.shell.util.Preferences
Container for shell preferences.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringPreference key storing the preferred editor command.static final StringPreference key storing the parser flavor.static final StringParser flavor value selecting relaxed parsing.static final StringParser flavor value selecting rigid parsing.static final StringPreference key controlling stack-trace sanitization.static final StringPreference key controlling whether the last result is shown.static IO.VerbosityCurrent shell verbosity preference.static final StringPreference key storing the selected verbosity level. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidaddChangeListener(PreferenceChangeListener listener) Registers a listener for preference changes.static voidclear()Clears all stored shell preferences.static StringReturns a preference value ornullwhen absent.static StringReturns a preference value with a fallback.static StringReturns the configured editor command.static StringReturns the configured parser flavor.static booleanReturns whether stack traces should be sanitized before display.static booleanReturns whether the shell should display the last evaluation result.static String[]keys()Returns all stored preference keys.static voidStores a preference value.
-
Field Details
-
verbosity
Current shell verbosity preference. -
VERBOSITY_KEY
Preference key storing the selected verbosity level.- See Also:
-
SHOW_LAST_RESULT_KEY
Preference key controlling whether the last result is shown.- See Also:
-
SANITIZE_STACK_TRACE_KEY
Preference key controlling stack-trace sanitization.- See Also:
-
EDITOR_KEY
Preference key storing the preferred editor command.- See Also:
-
PARSER_FLAVOR_KEY
Preference key storing the parser flavor.- See Also:
-
PARSER_RIGID
Parser flavor value selecting rigid parsing.- See Also:
-
PARSER_RELAXED
Parser flavor value selecting relaxed parsing.- See Also:
-
-
Constructor Details
-
Preferences
public Preferences()
-
-
Method Details
-
getShowLastResult
public static boolean getShowLastResult()Returns whether the shell should display the last evaluation result.- Returns:
trueif the last result should be shown
-
getSanitizeStackTrace
public static boolean getSanitizeStackTrace()Returns whether stack traces should be sanitized before display.- Returns:
trueif stack traces should be sanitized
-
getEditor
Returns the configured editor command.- Returns:
- the configured editor command, or the
EDITORenvironment variable if none is stored
-
getParserFlavor
Returns the configured parser flavor.- Returns:
- the parser flavor name
-
keys
Returns all stored preference keys.- Returns:
- the stored preference keys
- Throws:
BackingStoreException- if the backing store cannot be queried
-
get
Returns a preference value with a fallback.- Parameters:
name- the preference keydefaultValue- the fallback value to return when the key is absent- Returns:
- the stored or fallback value
-
get
Returns a preference value ornullwhen absent.- Parameters:
name- the preference key- Returns:
- the stored value, or
nullif absent
-
put
Stores a preference value.- Parameters:
name- the preference keyvalue- the value to store
-
clear
Clears all stored shell preferences.- Throws:
BackingStoreException- if the backing store cannot be updated
-
addChangeListener
Registers a listener for preference changes.- Parameters:
listener- the listener to register
-