PropertySheet

public interface PropertySheet

PropertySheet is a common interface of a properties container.

Author:Hugo Y. K. Lam

Methods

append

public boolean append(PropertySheet p)

Appends a property sheet to this property sheet.

Parameters:
  • p – the property sheet to be appended.
Returns:

true if the operation is successful. false otherwise.

containsKey

public boolean containsKey(String key)

Checks if the specified key exists in this property sheet.

Parameters:
  • key – the property key.
Returns:

true if the specified key exists in this property sheet.

createProperties

public Properties createProperties(String key)

Creates a Properties object which stores the properties retrieved by the specified key.

Parameters:
  • key – the property key.
Returns:

a Properties object which stores the retrieved properties.

getProperties

public String[] getProperties(String key)

Gets a list of properties with the specified key.

Parameters:
  • key – the property key.
Returns:

the properties with the specified key.

getProperties

public String[][] getProperties(String key, String key2)

Gets a two-dimensional list of properties with the specified keys. The first key will define the first dimension of the list and the second key will define the second dimension.

Parameters:
  • key – the first property key.
  • key2 – the second property key.
Returns:

a two-dimensional list of properties with the specified keys.

getProperty

public String getProperty(String key)

Gets a property with the specified key.

Parameters:
  • key – the property key.
Returns:

the property with the specified key.

getProperty

public String getProperty(String key, String def)

Gets a property with the specified key.

Parameters:
  • key – the property key.
  • def – the default value.
Returns:

the property with the specified key.

load

public void load()

Loads the properties from a persistent storage.

Throws:
  • Exception – if the operation is unsuccessful.

propertyNames

public Enumeration propertyNames()

Gets all the existing property names.

Returns:all the existing property names.

removeProperty

public boolean removeProperty(String key)

Removes a property with the specified key.

Parameters:
  • key – the property key.
Returns:

true if the operation is successful. false otherwise.

setProperty

public boolean setProperty(String key, String value)

Sets a property value with the specified key.

Parameters:
  • key – the property key.
  • value – the property value.
Returns:

true if the operation is successful. false otherwise.

store

public void store()

Stores the properties to a persistent storage.

Throws:
  • Exception – if the operation is unsuccessful.