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.Type type)
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) |
Object |
getObject(String name)
Returns the object representation of the
Property according to it's Property.Type:
an Integer (for type Property.Type.INT)
a Double (for type Property.Type.DECIMAL)
a Boolean (for type Property.Type.BOOLEAN)
a String (for types Property.Type.TEXT, Property.Type.PASSWORD and Property.Type.MULTILINE)
|
<T> T |
getObject(String name,
T defaultValue) |
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, Type). |
String |
toString() |
public PropertyHolder(String prefix, Iterable<? extends Property> properties)
PropertyHolderprefix - 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, Type).PropertyHolderpublic Set<String> getPropertyNames()
PropertiesProperty names.getPropertyNames in interface PropertiesProperty namespublic boolean propertyExists(String name)
PropertiesProperty with the given name exists.propertyExists in interface Propertiesname - the name of the Propertytrue if the Property exists, false otherwisepublic String getString(String name, String defaultValue)
PropertiesProperty (if existing), or the default-value.getString in interface Propertiesname - the name of the PropertydefaultValue - the default-valueProperty (if existing), or the default-valuepublic final Property addProperty(String name, Object defaultValue, String description, Property.Type type)
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 nulldescription - the description for the propertytype - the type of the propertyIllegalArgumentException - if defaultValue is null or if setFinal() has been called
before.protected SimpleProperty getNewProperty(String name)
public Boolean getBoolean(String name)
PropertiesgetBoolean in interface Propertiesname - the name of the PropertyBoolean, or null if no such Property exists.public Boolean getBoolean(String name, Boolean defaultValue)
getBoolean in interface Propertiesname - the name of the PropertydefaultValue - the default-valueBoolean, or the default-value if no such Property exists.public Integer getInteger(String name, Integer defaultValue)
PropertiesgetInteger in interface Propertiesname - the name of the PropertydefaultValue - the default-valueInteger, or the default-value if no such Property exists.public Float getFloat(String name, Float defaultValue)
PropertiesgetFloat in interface Propertiesname - the name of the PropertydefaultValue - the default-valueFloat, or the default-value if no such Property exists.public Double getDouble(String name, Double defaultValue)
PropertiesgetDouble in interface Propertiesname - the name of the PropertydefaultValue - the default-valueDouble, or the default-value if no such Property exists.public byte[] getBlob(String name)
PropertiesProperty.getBlob in interface Propertiesname - the name of the PropertyProperty, or null if no such Property exists.public String getClob(String name, String defaultValue)
PropertiesProperty (if existing), or the default-value.getClob in interface Propertiesname - the name of the PropertydefaultValue - the default-valueProperty (if existing), or the default-valuepublic String getString(String name)
PropertiesProperty.getString in interface Propertiesname - the name of the PropertyProperty, or null if no such property exists.public Integer getInteger(String name)
PropertiesgetInteger in interface Propertiesname - the name of the PropertyInteger, or null if no such Property exists.public Float getFloat(String name)
PropertiesgetFloat in interface Propertiesname - the name of the PropertyFloat, or null if no such Property exists.public Double getDouble(String name)
PropertiesgetDouble in interface Propertiesname - the name of the PropertyDouble, or null if no such Property exists.public String getClob(String name)
PropertiesProperty.getClob in interface Propertiesname - the name of the PropertyProperty, or null if no such Property exists.public Object getObject(String name)
PropertiesProperty according to it's Property.Type:
Integer (for type Property.Type.INT)
Double (for type Property.Type.DECIMAL)
Boolean (for type Property.Type.BOOLEAN)
String (for types Property.Type.TEXT, Property.Type.PASSWORD and Property.Type.MULTILINE)
getObject in interface Propertiesname - the name of the propertypublic <T> T getObject(String name, T defaultValue)
public List<String> getList(String name, String defaultValue, String delimiter)
PropertiesList of Strings which is parsed from the value of the Property with the given
name (if present) or from the default-value.getList in interface Propertiesname - the name of the PropertydefaultValue - the default-string to parse the list fromdelimiter - the delimiter to split the (default-)value byList, never nullpublic List<String> getList(String name, String delimiter)
Propertiespublic Properties getPlainProperties()
PropertiesProperties and transforms it into some (plain, old, uncool) Properties.getPlainProperties in interface PropertiesPropertiespublic Properties getProperties(String name)
PropertiesProperties parsed from the given Property (if existing).getProperties in interface Propertiesname - the name of the PropertyProperties, or null if no such Property exists.public String getDescriptionFor(String name)
PropertiesProperty with the given name, if anygetDescriptionFor in interface Propertiesname - the name of the propertyCopyright © 2011–2023 aiticon GmbH. All rights reserved.