Package jsyntaxpane.util
Class Configuration
java.lang.Object
jsyntaxpane.util.Configuration
Wrapper around the Properties class with supprt for Heirarchical confogurations
and more functionality.
Except for the getXXXX methods, all other Map Interface methods operate on the
current (non-parent) collection and do NOT touch the parent.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
Utility class to hold data forgetKeys(java.util.regex.Pattern)
method. -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionConfiguration
(Class theClass) Creates an empty ConfigurationConfiguration
(Class theClass, Configuration parent) Creates a new COnfiguration that uses parent as its parent Configuration. -
Method Summary
Modifier and TypeMethodDescriptionvoid
clear()
boolean
containsKey
(Object key) boolean
containsValue
(Object value) entrySet()
boolean
getBoolean
(String key, boolean Default) Returns a boolean from the configurationreturn the Color that has the given key or the Defaultint
getInteger
(String key, int Default) Gets an integer from the properties.Obtain a set of all keys (and parent's keys) that match the given pattern.String[]
getPropertyList
(String key) Returns a String[] of the comma separated items in the value.Get a string from this object or one of its parents.Returns a non-null value either by traversing the current and parent(s) map, or returning the defaultValueboolean
isEmpty()
keySet()
void
int
size()
Returns ALL property names from this Configuration's parents and this Configuration.toString()
values()
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.Map
compute, computeIfAbsent, computeIfPresent, equals, forEach, getOrDefault, hashCode, merge, putIfAbsent, remove, replace, replace, replaceAll
-
Field Details
-
EMPTY_LIST
-
COMMA_SEPARATOR
-
-
Constructor Details
-
Configuration
Creates a new COnfiguration that uses parent as its parent Configuration.- Parameters:
theClass
-parent
-
-
Configuration
Creates an empty Configuration- Parameters:
theClass
-
-
-
Method Details
-
getString
Get a string from this object or one of its parents. If nothing is found, null is returned. If the Regex ${key} is found, then it is replaced by the value of that key within this (or parent's) map. Special COnstructs in ${}:class_path
will be replaced by the name of the Configuration (usually ClassName) with "." replaced by "/", and then converted to all lowercase is replaced by class.SimpleNameclass_simpleName
- Parameters:
key
-- Returns:
-
getString
Returns a non-null value either by traversing the current and parent(s) map, or returning the defaultValue- Parameters:
key
-defaultValue
-- Returns:
- Throws:
NullPointerException
- if defaultValue is null
-
getInteger
Gets an integer from the properties. If number cannot be found or if it cannot be decoded, the default is returned The integer is decoded using {@link Integer.decode(String)}- Parameters:
key
-Default
-- Returns:
-
getPropertyList
Returns a String[] of the comma separated items in the value. Does NOT return null. If the key is not found, then an empty string array is returned. So the return of this method can always be used directly in a foreach loop- Parameters:
key
-- Returns:
- non-null String[]
-
getBoolean
Returns a boolean from the configuration- Parameters:
key
-Default
-- Returns:
-
getColor
return the Color that has the given key or the Default- Parameters:
key
-Default
-- Returns:
-
putAll
-
stringPropertyNames
Returns ALL property names from this Configuration's parents and this Configuration. As usual, parents are added first so they are overriden by children.- Returns:
- Set of all String keys in this and parents
-
put
-
size
public int size() -
isEmpty
public boolean isEmpty() -
containsKey
- Specified by:
containsKey
in interfaceMap<String,
String>
-
containsValue
- Specified by:
containsValue
in interfaceMap<String,
String>
-
get
-
remove
-
clear
public void clear() -
keySet
-
values
-
entrySet
-
toString
-
getKeys
Obtain a set of all keys (and parent's keys) that match the given pattern. If no keys match, then an empty set is returned. Use this instead of thestringPropertyNames()
- Parameters:
pattern
-- Returns:
-