public class UserProperties extends Properties
Special property class which allows typed properties to be set and returned. It also allows the hookup of two default property objects to be searched if this property object does not contain the property.
Constructor and Description |
---|
UserProperties()
Initializes an empty instance of UserProperties class.
|
UserProperties(Properties defaults)
Initializes an of UserProperties class with default values.
|
UserProperties(Properties defaults,
Properties altDefaults)
Constructs UserProperties with a defaults and altDefaults table,
which are searched in that order.
|
Modifier and Type | Method and Description |
---|---|
String |
getProperty(String key)
Gets string property value.
|
String |
getProperty(String key,
String def)
Gets string property value.
|
Color |
getPropertyColor(String key)
Gets color property value.
|
Color |
getPropertyColor(String key,
Color def)
Gets color property value.
|
Dimension |
getPropertyDimension(String key)
Gets dimension property value.
|
Dimension |
getPropertyDimension(String key,
Dimension def)
Gets dimension property value.
|
double |
getPropertyDouble(String key)
Gets double property value.
|
double |
getPropertyDouble(String key,
double def)
Gets double property value.
|
float |
getPropertyFloat(String key)
Gets float property value.
|
float |
getPropertyFloat(String key,
float def)
Gets float property value.
|
Insets |
getPropertyInsets(String key)
Gets insets property value.
|
Insets |
getPropertyInsets(String key,
Insets def)
Gets insets property value.
|
int |
getPropertyInt(String key)
Gets integer property value.
|
int |
getPropertyInt(String key,
int def)
Gets integer property value.
|
Rectangle |
getPropertyRectangle(String key)
Gets rectangle property value.
|
Rectangle |
getPropertyRectangle(String key,
Rectangle def)
Gets rectangle property value.
|
String[] |
getPropertyStringArray(String key)
Gets string array property value.
|
String[] |
getPropertyStringArray(String key,
String[] def)
Gets string array property value.
|
boolean |
isProperty(String key)
Gets boolean property value.
|
boolean |
isProperty(String key,
boolean def)
Gets boolean property value.
|
Enumeration |
propertyNames()
Returns properties names.
|
void |
setProperties(Properties properties)
Copies properties, including its defaults into this UserProperties
|
static Object |
setProperty(Properties properties,
String key,
boolean value)
Sets boolean property value in specified properties table.
|
static Object |
setProperty(Properties properties,
String key,
Color value)
Sets color property value in specified properties table.
|
static Object |
setProperty(Properties properties,
String key,
Dimension value)
Sets dimension property value in specified properties table.
|
static Object |
setProperty(Properties properties,
String key,
double value)
Sets double property value in specified properties table.
|
static Object |
setProperty(Properties properties,
String key,
float value)
Sets float property value in specified properties table.
|
static Object |
setProperty(Properties properties,
String key,
Insets value)
Sets insets property value in specified properties table.
|
static Object |
setProperty(Properties properties,
String key,
int value)
Sets integer property value in specified properties table.
|
static Object |
setProperty(Properties properties,
String key,
Rectangle value)
Sets rectangle property value in specified properties table.
|
static Object |
setProperty(Properties properties,
String key,
String[] value)
Sets string array property value in specified properties table.
|
Object |
setProperty(String key,
boolean value)
Sets boolean property value.
|
Object |
setProperty(String key,
Color value)
Sets color property value.
|
Object |
setProperty(String key,
Dimension value)
Sets dimension property value.
|
Object |
setProperty(String key,
double value)
Sets double property value.
|
Object |
setProperty(String key,
float value)
Sets float property value.
|
Object |
setProperty(String key,
Insets value)
Sets insets property value.
|
Object |
setProperty(String key,
int value)
Sets integer property value.
|
Object |
setProperty(String key,
Rectangle value)
Sets rectangle property value.
|
Object |
setProperty(String key,
String value)
Sets string property value.
|
Object |
setProperty(String key,
String[] value)
Sets string array property value.
|
list, list, load, load, loadFromXML, save, store, store, storeToXML, storeToXML, stringPropertyNames
clear, clone, compute, computeIfAbsent, computeIfPresent, contains, containsKey, containsValue, elements, entrySet, equals, forEach, get, getOrDefault, hashCode, isEmpty, keys, keySet, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, size, toString, values
public UserProperties()
Initializes an empty instance of UserProperties class.
public UserProperties(Properties defaults)
Initializes an of UserProperties class with default values.
defaults
- Default properties values.public UserProperties(Properties defaults, Properties altDefaults)
Constructs UserProperties with a defaults and altDefaults table, which are searched in that order.
defaults
- Default properties.altDefaults
- Alternative default properties.public Enumeration propertyNames()
Returns properties names.
propertyNames
in class Properties
public void setProperties(Properties properties)
Copies properties, including its defaults into this UserProperties
properties
- Properties.public Object setProperty(String key, String value)
Sets string property value.
setProperty
in class Properties
key
- The name of property.value
- The value of property.public Object setProperty(String key, String[] value)
Sets string array property value.
key
- The name of property.value
- The value of property.public static Object setProperty(Properties properties, String key, String[] value)
Sets string array property value in specified properties table.
properties
- The properties table.key
- The name of property.value
- The value of property.public Object setProperty(String key, Color value)
Sets color property value.
key
- The name of property.value
- The value of property.public static Object setProperty(Properties properties, String key, Color value)
Sets color property value in specified properties table.
properties
- The properties table.key
- The name of property.value
- The value of property.public Object setProperty(String key, Rectangle value)
Sets rectangle property value.
key
- The name of property.value
- The value of property.public static Object setProperty(Properties properties, String key, Rectangle value)
Sets rectangle property value in specified properties table.
properties
- The properties table.key
- The name of property.value
- The value of property.public Object setProperty(String key, Insets value)
Sets insets property value.
key
- The name of property.value
- The value of property.public static Object setProperty(Properties properties, String key, Insets value)
Sets insets property value in specified properties table.
properties
- The properties table.key
- The name of property.value
- The value of property.public Object setProperty(String key, Dimension value)
Sets dimension property value.
key
- The name of property.value
- The value of property.public static Object setProperty(Properties properties, String key, Dimension value)
Sets dimension property value in specified properties table.
properties
- The properties table.key
- The name of property.value
- The value of property.public Object setProperty(String key, int value)
Sets integer property value.
key
- The name of property.value
- The value of property.public static Object setProperty(Properties properties, String key, int value)
Sets integer property value in specified properties table.
properties
- The properties table.key
- The name of property.value
- The value of property.public Object setProperty(String key, double value)
Sets double property value.
key
- The name of property.value
- The value of property.public static Object setProperty(Properties properties, String key, double value)
Sets double property value in specified properties table.
properties
- The properties table.key
- The name of property.value
- The value of property.public Object setProperty(String key, float value)
Sets float property value.
key
- The name of property.value
- The value of property.public static Object setProperty(Properties properties, String key, float value)
Sets float property value in specified properties table.
properties
- The properties table.key
- The name of property.value
- The value of property.public Object setProperty(String key, boolean value)
Sets boolean property value.
key
- The name of property.value
- The value of property.public static Object setProperty(Properties properties, String key, boolean value)
Sets boolean property value in specified properties table.
properties
- The properties table.key
- The name of property.value
- The value of property.public String getProperty(String key)
Gets string property value.
getProperty
in class Properties
key
- The name of property.public String getProperty(String key, String def)
Gets string property value. If requested property is absent, returns provided default value.
getProperty
in class Properties
key
- The name of property.def
- Default value of property.public String[] getPropertyStringArray(String key)
Gets string array property value.
key
- The name of property.public String[] getPropertyStringArray(String key, String[] def)
Gets string array property value. If requested property is absent, returns provided default value.
key
- The name of property.def
- Default value of property.public Color getPropertyColor(String key)
Gets color property value.
key
- The name of property.public Color getPropertyColor(String key, Color def)
Gets color property value. If requested property is absent, returns provided default value.
key
- The name of property.def
- Default value of property.public Rectangle getPropertyRectangle(String key)
Gets rectangle property value.
key
- The name of property.public Rectangle getPropertyRectangle(String key, Rectangle def)
Gets rectangle property value. If requested property is absent, returns provided default value.
key
- The name of property.def
- Default value of property.public Insets getPropertyInsets(String key)
Gets insets property value.
key
- The name of property.public Insets getPropertyInsets(String key, Insets def)
Gets insets property value. If requested property is absent, returns provided default value.
key
- The name of property.def
- Default value of property.public Dimension getPropertyDimension(String key)
Gets dimension property value.
key
- The name of property.public Dimension getPropertyDimension(String key, Dimension def)
Gets dimension property value. If requested property is absent, returns provided default value.
key
- The name of property.def
- Default value of property.public int getPropertyInt(String key)
Gets integer property value.
key
- The name of property.public int getPropertyInt(String key, int def)
Gets integer property value. If requested property is absent, returns provided default value.
key
- The name of property.def
- Default value of property.public double getPropertyDouble(String key)
Gets double property value.
key
- The name of property.public double getPropertyDouble(String key, double def)
Gets double property value. If requested property is absent, returns provided default value.
key
- The name of property.def
- Default value of property.public float getPropertyFloat(String key)
Gets float property value.
key
- The name of property.public float getPropertyFloat(String key, float def)
Gets float property value. If requested property is absent, returns provided default value.
key
- The name of property.def
- Default value of property.public boolean isProperty(String key)
Gets boolean property value.
key
- The name of property.public boolean isProperty(String key, boolean def)
Gets boolean property value. If requested property is absent, returns provided default value.
key
- The name of property.def
- Default value of property.