public class PropertyHolder extends Object implements Properties
Constructor and Description |
---|
PropertyHolder() |
PropertyHolder(String prefix,
Iterable<? extends Property> properties)
Creates a new
PropertyHolder |
Modifier and Type | Method and Description |
---|---|
Property |
addProperty(String name,
Object defaultValue,
String description) |
Property |
addProperty(String name,
Object defaultValue,
String description,
boolean asClob)
As long as
setFinal() has not be called, this method can be used to add new properties |
byte[] |
getBlob(String name)
Returns the byte-value of the given
Property . |
Boolean |
getBoolean(String name)
|
Boolean |
getBoolean(String name,
Boolean defaultValue) |
String |
getClob(String name)
Returns the string-value of the given
Property . |
String |
getClob(String name,
String defaultValue)
Returns the string-value of the given
Property (if existing), or the default-value. |
String |
getDescriptionFor(String name)
Returns the description for the
Property with the given name, if any |
Double |
getDouble(String name)
|
Double |
getDouble(String name,
Double defaultValue)
|
Float |
getFloat(String name)
|
Float |
getFloat(String name,
Float defaultValue)
|
Integer |
getInteger(String name)
|
Integer |
getInteger(String name,
Integer defaultValue)
|
List<String> |
getList(String name,
String delimiter)
|
List<String> |
getList(String name,
String defaultValue,
String delimiter)
|
protected SimpleProperty |
getNewProperty(String name) |
Properties |
getPlainProperties()
Takes this
Properties and transforms it into some (plain, old, uncool) Properties . |
Properties |
getProperties(String name)
Returns some
Properties parsed from the given Property (if existing). |
Property |
getProperty(String name) |
Set<String> |
getPropertyNames()
Returns all
Property names. |
String |
getString(String name)
Returns the string-value of the given
Property . |
String |
getString(String name,
String defaultValue)
Returns the string-value of the given
Property (if existing), or the default-value. |
boolean |
propertyExists(String name)
Checks whether the
Property with the given name exists. |
PropertyHolder |
setFinal()
Sets this
PropertyHolder to final, which means no more properties can be added using
addProperty(String, Object, String) . |
String |
toString() |
public PropertyHolder(String prefix, Iterable<? extends Property> properties)
PropertyHolder
prefix
- the prefix to useproperties
- the Property
-instances to holdpublic PropertyHolder()
public PropertyHolder setFinal()
PropertyHolder
to final, which means no more properties can be added using
addProperty(String, Object, String)
.PropertyHolder
public Set<String> getPropertyNames()
Properties
Property
names.getPropertyNames
in interface Properties
Property
namespublic boolean propertyExists(String name)
Properties
Property
with the given name exists.propertyExists
in interface Properties
name
- the name of the Property
true
if the Property
exists, false
otherwisepublic String getString(String name, String defaultValue)
Properties
Property
(if existing), or the default-value.getString
in interface Properties
name
- the name of the Property
defaultValue
- the default-valueProperty
(if existing), or the default-valuepublic final Property addProperty(String name, Object defaultValue, String description, boolean asClob)
setFinal()
has not be called, this method can be used to add new propertiesname
- the name of the property, without prefixdefaultValue
- the default value for the property to add, must not be null
description
- the description for the propertyasClob
- if the property should be created as clobIllegalArgumentException
- if defaultValue is null
or if setFinal()
has been called before.protected SimpleProperty getNewProperty(String name)
public Boolean getBoolean(String name)
Properties
getBoolean
in interface Properties
name
- the name of the Property
Boolean
, or null
if no such Property
exists.public Boolean getBoolean(String name, Boolean defaultValue)
getBoolean
in interface Properties
name
- the name of the Property
defaultValue
- the default-valueBoolean
, or the default-value if no such Property
exists.public Integer getInteger(String name, Integer defaultValue)
Properties
getInteger
in interface Properties
name
- the name of the Property
defaultValue
- the default-valueInteger
, or the default-value if no such Property
exists.public Float getFloat(String name, Float defaultValue)
Properties
getFloat
in interface Properties
name
- the name of the Property
defaultValue
- the default-valueFloat
, or the default-value if no such Property
exists.public Double getDouble(String name, Double defaultValue)
Properties
getDouble
in interface Properties
name
- the name of the Property
defaultValue
- the default-valueDouble
, or the default-value if no such Property
exists.public byte[] getBlob(String name)
Properties
Property
.getBlob
in interface Properties
name
- the name of the Property
Property
, or null
if no such Property
exists.public String getClob(String name, String defaultValue)
Properties
Property
(if existing), or the default-value.getClob
in interface Properties
name
- the name of the Property
defaultValue
- the default-valueProperty
(if existing), or the default-valuepublic String getString(String name)
Properties
Property
.getString
in interface Properties
name
- the name of the Property
Property
, or null
if no such property exists.public Integer getInteger(String name)
Properties
getInteger
in interface Properties
name
- the name of the Property
Integer
, or null
if no such Property
exists.public Float getFloat(String name)
Properties
getFloat
in interface Properties
name
- the name of the Property
Float
, or null
if no such Property
exists.public Double getDouble(String name)
Properties
getDouble
in interface Properties
name
- the name of the Property
Double
, or null
if no such Property
exists.public String getClob(String name)
Properties
Property
.getClob
in interface Properties
name
- the name of the Property
Property
, or null
if no such Property
exists.public List<String> getList(String name, String defaultValue, String delimiter)
Properties
List
of String
s which is parsed from the value of the Property
with the given
name (if present) or from the default-value.getList
in interface Properties
name
- the name of the Property
defaultValue
- the default-string to parse the list fromdelimiter
- the delimiter to split the (default-)value byList
, never null
public List<String> getList(String name, String delimiter)
Properties
public Properties getPlainProperties()
Properties
Properties
and transforms it into some (plain, old, uncool) Properties
.getPlainProperties
in interface Properties
Properties
public Properties getProperties(String name)
Properties
Properties
parsed from the given Property
(if existing).getProperties
in interface Properties
name
- the name of the Property
Properties
, or null
if no such Property
exists.public String getDescriptionFor(String name)
Properties
Property
with the given name, if anygetDescriptionFor
in interface Properties
name
- the name of the propertyCopyright © 2011–2019 aiticon GmbH. All rights reserved.