public class Specification
extends java.util.Properties
| Constructor and Description |
|---|
Specification() |
Specification(java.util.Properties defaults) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
containsKey(java.lang.Object name)
If
Map#containsKey is invoked the result will be as expected
when the parameter name exists as a property, but false when it was
included in defaults. |
java.util.Map<java.lang.String,java.lang.Object> |
convertToMap() |
java.util.Map<java.lang.String,java.lang.Object> |
convertToMap(java.util.Collection<java.lang.String> keys) |
java.lang.String |
get(java.lang.Object name)
This override is ugly but necessary; if
#get in inadvertently
invoked instead of #getProperty then all is well as long as
the parameter name specifies a property that is present. |
java.lang.Boolean |
getBoolean(java.lang.String name)
Accessor for a boolean property; returns true if the property value is
"true", returns false in all other cases unless the property is not
present in which case null is returned.
|
java.lang.Boolean |
getBoolean(java.lang.String name,
java.lang.Boolean defaultValue)
Accessor for a boolean property; returns true if the property value is
"true", returns false in all other cases except when the property is not
present when the provided default value is returned.
|
java.lang.Integer |
getInteger(java.lang.String name)
Accessor for an integer property; returns the parsed integer if the
property value can be parsed, returns null if the property is not
defined and throws
RuntimeException (with a wrapped
NumberFormatException) if the property is available but
can't be parsed to an integer. |
java.lang.Integer |
getInteger(java.lang.String name,
java.lang.Integer defaultValue)
Accessor for an integer property; returns the parsed integer if the
property value can be parsed, returns a default if the property is not
defined and throws
RuntimeException (with a wrapped
NumberFormatException) if the property is available but
can't be parsed to an integer. |
java.util.List<java.lang.String> |
getKeys() |
java.lang.String |
getString(java.lang.String name)
Accessor for a string property; returns the string value if the
property value is defined, or returns null if the property is not
defined.
|
java.lang.String |
getString(java.lang.String name,
java.lang.String defaultValue)
Accessor for a string property; returns the string value if the
property value exists, or returns a default if the property is not
defined.
|
boolean |
isEmpty() |
java.lang.Boolean |
isFalse(java.lang.String name) |
java.lang.Boolean |
isTrue(java.lang.String name) |
protected void |
loadProperties(java.lang.String path,
java.io.InputStream inputStream) |
static void |
loadProperties(java.lang.String path,
java.io.InputStream inputStream,
java.util.Properties target) |
protected void |
loadPropertiesFromFile(java.io.File file) |
protected void |
loadPropertiesFromFile(java.lang.String filePath) |
protected void |
loadPropertiesFromList(java.lang.String key)
Takes a parameter properties key with a list value and loads a properties
file for each element in the list.
|
protected void |
loadPropertiesFromResource(java.lang.String resourcePath) |
static java.util.List<java.lang.String> |
parseListing(java.lang.String value) |
getProperty, getProperty, list, list, load, load, loadFromXML, propertyNames, save, setProperty, store, store, storeToXML, storeToXML, stringPropertyNamesclear, clone, compute, computeIfAbsent, computeIfPresent, contains, containsValue, elements, entrySet, equals, forEach, getOrDefault, hashCode, keys, keySet, merge, put, putAll, putIfAbsent, rehash, remove, remove, replace, replace, replaceAll, size, toString, valuespublic Specification()
public Specification(java.util.Properties defaults)
protected void loadPropertiesFromList(java.lang.String key)
com.brambolt.calypso.hosts
with the values brambolt,docker, two properties files are
loaded from the classpath:
com/brambolt/calypso/hosts/brambolt.properties
com/brambolt/calypso/hosts/docker.properties
key - The list property key to load properties forprotected void loadPropertiesFromResource(java.lang.String resourcePath)
protected void loadPropertiesFromFile(java.lang.String filePath)
protected void loadPropertiesFromFile(java.io.File file)
protected void loadProperties(java.lang.String path,
java.io.InputStream inputStream)
public static void loadProperties(java.lang.String path,
java.io.InputStream inputStream,
java.util.Properties target)
public java.util.List<java.lang.String> getKeys()
public java.util.Map<java.lang.String,java.lang.Object> convertToMap()
public java.util.Map<java.lang.String,java.lang.Object> convertToMap(java.util.Collection<java.lang.String> keys)
public java.lang.String get(java.lang.Object name)
#get in inadvertently
invoked instead of #getProperty then all is well as long as
the parameter name specifies a property that is present. But, if the name
specifies a property that is only available in defaults then it will not
be returned.get in interface java.util.Map<java.lang.Object,java.lang.Object>get in class java.util.Hashtable<java.lang.Object,java.lang.Object>name - The name of the property to get the value forpublic boolean containsKey(java.lang.Object name)
Map#containsKey is invoked the result will be as expected
when the parameter name exists as a property, but false when it was
included in defaults.containsKey in interface java.util.Map<java.lang.Object,java.lang.Object>containsKey in class java.util.Hashtable<java.lang.Object,java.lang.Object>name - The property name to checkpublic java.lang.Boolean getBoolean(java.lang.String name)
name - The property name to accesspublic java.lang.Boolean getBoolean(java.lang.String name,
java.lang.Boolean defaultValue)
name - The property name to accessdefaultValue - The value to return if the property is not presentpublic java.lang.Boolean isTrue(java.lang.String name)
public java.lang.Boolean isFalse(java.lang.String name)
public java.lang.Integer getInteger(java.lang.String name)
RuntimeException (with a wrapped
NumberFormatException) if the property is available but
can't be parsed to an integer.
"name - The property name to look upjava.lang.RuntimeException - If the value can't be parsed to an integerpublic java.lang.Integer getInteger(java.lang.String name,
java.lang.Integer defaultValue)
RuntimeException (with a wrapped
NumberFormatException) if the property is available but
can't be parsed to an integer.
"name - The property name to look updefaultValue - The default value when the property is not definedjava.lang.RuntimeException - If the value can't be parsed to an integerpublic java.lang.String getString(java.lang.String name)
name - The property name to look uppublic java.lang.String getString(java.lang.String name,
java.lang.String defaultValue)
name - The property name to look updefaultValue - The default value when the property is not definedpublic boolean isEmpty()
isEmpty in interface java.util.Map<java.lang.Object,java.lang.Object>isEmpty in class java.util.Hashtable<java.lang.Object,java.lang.Object>public static java.util.List<java.lang.String> parseListing(java.lang.String value)