Package org.europa.together.application
Class PropertyFileReader
- java.lang.Object
-
- org.europa.together.application.PropertyFileReader
-
- All Implemented Interfaces:
PropertyReader
@Repository @FeatureToggle(featureID="CM-0004") public class PropertyFileReader extends Object implements PropertyReader
Implementation of the PropertyReader.
-
-
Field Summary
-
Fields inherited from interface org.europa.together.business.PropertyReader
FEATURE_ID
-
-
Constructor Summary
Constructors Constructor Description PropertyFileReader()
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
addProperty(String key, String value)
Add a single Property to the Property list.boolean
addPropertyList(Map<String,String> resource)
Extend property list by Map<String, String>.boolean
appendPropertiesFromClasspath(String resource)
Load a property List from an given file inside the classpath.boolean
appendPropertiesFromFile(String resource)
Load a property List from an external file.boolean
clear()
Clear the entire property list.int
count()
Counts the amount of all properties and return the value.Boolean
getPropertyAsBoolean(String key)
Get the value of a property as boolean.Double
getPropertyAsDouble(String key)
Get the property value as Double.Float
getPropertyAsFloat(String key)
Get the property value as Float.Integer
getPropertyAsInt(String key)
Get the value of a property as Integer.String
getPropertyAsString(String key)
Get the property value as String.Map<String,String>
getPropertyList()
Get the full property list as Map.boolean
removeProperty(String key)
Remove a property by the given key from the list.boolean
updateProperty(String key, String value)
Update an existing property entry.
-
-
-
Method Detail
-
addProperty
public boolean addProperty(String key, String value)
Description copied from interface:PropertyReader
Add a single Property to the Property list. If the property already exist in the List, the new entry will not added and the method return false.- Specified by:
addProperty
in interfacePropertyReader
- Parameters:
key
- as Stringvalue
- as String- Returns:
- true on success
-
addPropertyList
public boolean addPropertyList(Map<String,String> resource)
Description copied from interface:PropertyReader
Extend property list by Map<String, String>.- Specified by:
addPropertyList
in interfacePropertyReader
- Parameters:
resource
- as Map- Returns:
- true on success
-
appendPropertiesFromClasspath
public boolean appendPropertiesFromClasspath(String resource)
Description copied from interface:PropertyReader
Load a property List from an given file inside the classpath. eg: org/europa/together/properties/file.properties- Specified by:
appendPropertiesFromClasspath
in interfacePropertyReader
- Parameters:
resource
- as String- Returns:
- true on success
-
appendPropertiesFromFile
public boolean appendPropertiesFromFile(String resource)
Description copied from interface:PropertyReader
Load a property List from an external file. eg: /home/usr/application/file.properties- Specified by:
appendPropertiesFromFile
in interfacePropertyReader
- Parameters:
resource
- as String- Returns:
- true on success
-
clear
public boolean clear()
Description copied from interface:PropertyReader
Clear the entire property list.- Specified by:
clear
in interfacePropertyReader
- Returns:
- true on success
-
removeProperty
public boolean removeProperty(String key)
Description copied from interface:PropertyReader
Remove a property by the given key from the list. If the property not exists the method return false.- Specified by:
removeProperty
in interfacePropertyReader
- Parameters:
key
- as String- Returns:
- true on success
-
updateProperty
public boolean updateProperty(String key, String value)
Description copied from interface:PropertyReader
Update an existing property entry. In the case the entry don't exist, he will be created.- Specified by:
updateProperty
in interfacePropertyReader
- Parameters:
key
- as Stringvalue
- as String- Returns:
- true on success
-
count
public int count()
Description copied from interface:PropertyReader
Counts the amount of all properties and return the value.- Specified by:
count
in interfacePropertyReader
- Returns:
- count of properties as int
-
getPropertyAsBoolean
public Boolean getPropertyAsBoolean(String key)
Description copied from interface:PropertyReader
Get the value of a property as boolean. Allowed values are:- 0 | 1
- false | true
- FALSE | TRUE
- Specified by:
getPropertyAsBoolean
in interfacePropertyReader
- Parameters:
key
- property given as String- Returns:
- Boolean PropertyKeyAsBoolean
-
getPropertyAsDouble
public Double getPropertyAsDouble(String key)
Description copied from interface:PropertyReader
Get the property value as Double.- Specified by:
getPropertyAsDouble
in interfacePropertyReader
- Parameters:
key
- as String- Returns:
- Double PropertyAsDouble
-
getPropertyAsFloat
public Float getPropertyAsFloat(String key)
Description copied from interface:PropertyReader
Get the property value as Float.- Specified by:
getPropertyAsFloat
in interfacePropertyReader
- Parameters:
key
- as String- Returns:
- Float PropertyAsFloat
-
getPropertyAsInt
public Integer getPropertyAsInt(String key)
Description copied from interface:PropertyReader
Get the value of a property as Integer.- Specified by:
getPropertyAsInt
in interfacePropertyReader
- Parameters:
key
- property given as String- Returns:
- int PropertyKeyAsInteger
-
getPropertyAsString
public String getPropertyAsString(String key)
Description copied from interface:PropertyReader
Get the property value as String.- Specified by:
getPropertyAsString
in interfacePropertyReader
- Parameters:
key
- property given as String- Returns:
- String PropertyAsString
-
getPropertyList
public Map<String,String> getPropertyList()
Description copied from interface:PropertyReader
Get the full property list as Map.- Specified by:
getPropertyList
in interfacePropertyReader
- Returns:
- propertyLit as Map
-
-