class sap/base/util/Properties

Visiblity: public
UX Guidelines:
Implements:
Available since: N/A
Extends:
Module: sap/base/util/Properties
Application Component:

Represents a collection of string properties (key/value pairs).

Each key and its corresponding value in the collection is a string, keys are case-sensitive.

Use module:sap/base/util/Properties.create to create an instance of module:sap/base/util/Properties.

The #getProperty method can be used to retrieve a value from the collection, #setProperty to store or change a value for a key and #getKeys can be used to retrieve an array of all keys that are currently stored in the collection.


Constructor


Methods Overview

Method Description
clone

Creates and returns a clone of the property collection.

module:sap/base/util/Properties.create

Creates and returns a new instance of module:sap/base/util/Properties.

If option 'url' is passed, immediately a load request for the given target is triggered. A property file that is loaded can contain comments with a leading ! or #. The loaded property list does not contain any comments.

getKeys

Returns an array of all keys in the property collection.

getProperty

Returns the value for the given key or null if the collection has no value for the key.

Optionally, a default value can be given which will be returned if the collection does not contain a value for the key; only non-empty default values are supported.

setProperty

Stores or changes the value for the given key in the collection.

If the given value is not a string, the collection won't be modified. The key is always cast to a string.

clone

Creates and returns a clone of the property collection.

module:sap/base/util/Properties.create

Creates and returns a new instance of module:sap/base/util/Properties.

If option 'url' is passed, immediately a load request for the given target is triggered. A property file that is loaded can contain comments with a leading ! or #. The loaded property list does not contain any comments.

Param Type DefaultValue Description
mParams object

Parameters used to initialize the property list

url string

The URL to the .properties file which should be loaded

async boolean false

Whether the .properties file should be loaded asynchronously or not

headers object

A map of additional header key/value pairs to send along with the request (see headers option of jQuery.ajax)

returnNullIfMissing object false

Whether null should be returned for a missing properties file; by default an empty collection is returned

getKeys

Returns an array of all keys in the property collection.

getProperty

Returns the value for the given key or null if the collection has no value for the key.

Optionally, a default value can be given which will be returned if the collection does not contain a value for the key; only non-empty default values are supported.

Param Type DefaultValue Description
sKey string

Key to return the value for

sDefaultValue string

Optional, a default value that will be returned if the requested key is not in the collection

setProperty

Stores or changes the value for the given key in the collection.

If the given value is not a string, the collection won't be modified. The key is always cast to a string.

Param Type DefaultValue Description
sKey string

Key of the property

sValue string

String value for the key