Package org.silverpeas.kernel.bundle
Interface SilverpeasBundle
- All Known Implementing Classes:
LocalizationBundle,SettingBundle,XmlSettingBundle,XmlSettingBundle.SettingSection
public interface SilverpeasBundle
A Silverpeas bundle represents a bundle containing data required by the different features
of Silverpeas. Each data is defined by a pair of key-value whose key identifies the data.
- Author:
- mmoquillon
-
Method Summary
Modifier and TypeMethodDescriptionbooleancontainsKey(String key) Is this bundle contains the specified databooleanexists()Is this bundle exists?What is the fully qualified name of this bundle.Gets the value as a String of the data identified by the specified key.default PropertyValuesListgetStringList(String list, String property) The resource is a list of objects.default PropertyValuesListgetStringList(String list, String property, int max) The resource is a list of objects.keySet()Gets a set of all keys defined in this bundle.
-
Method Details
-
keySet
Gets a set of all keys defined in this bundle.- Returns:
- a set of keys.
-
containsKey
Is this bundle contains the specified data- Parameters:
key- the name of the data.- Returns:
- true if this bundle has a data with the specified key, false otherwise.
-
getBaseBundleName
String getBaseBundleName()What is the fully qualified name of this bundle.- Returns:
- the base bundle name (that is to say without the hierarchy path name that is handled
by
org.silverpeas.core.util.ResourceLocator).
-
getString
Gets the value as a String of the data identified by the specified key. The key should exist in the bundle otherwise ajava.util.MissingResourceExceptionexception is thrown.- Parameters:
key- the unique name of the data in this bundle.- Returns:
- the value of the data as a string of characters.
- Throws:
MissingResourceException- if either the bundle doesn't exist or the key isn't defined in the bundle.
-
getStringList
default PropertyValuesList getStringList(String list, String property) throws MissingResourceException The resource is a list of objects. Gets the value(s) of the specified property of one or more objects in the list. The objects in the list are identified by their index in the list (from 1 to n). The key used to find the asked value(s) is composed first by the list identifier, an underscore separator, then by the index of the object in the list, a dot separator, and finally ends with the object's property name.
For example :User_1.Name=firstNameUser_2.Name=lastName- ...
MissingResourceExceptionexception is thrown (for compatibility reason with Silverpeas versions lesser than 6).- Parameters:
list- the identifier of the list in the bundle.property- the object's property for which the value will be fetch iterated up to find an object whose the property is set. If max is >= 1 then the specified property of the first max objects are read (if the property isn't set for an object, it is set to an empty string).- Returns:
- a list of values, each of them as String. If the property of an object to read exists but isn't set, then an empty string is set in the array.
- Throws:
MissingResourceException- if the bundle doesn't exist.
-
getStringList
default PropertyValuesList getStringList(String list, String property, int max) throws MissingResourceException The resource is a list of objects. Gets the value(s) of the specified property of one or more objects in the list. The objects in the list are identified by their index in the list (from 1 to n). The key used to find the asked value(s) is composed first by the list identifier, an underscore separator, then by the index of the object in the list, a dot separator, and finally ends with the object's property name.
For example :User_1.Name=firstNameUser_2.Name=lastName- ...
MissingResourceExceptionexception is thrown (for compatibility reason with Silverpeas versions lesser than 6) but an empty list is returned.- Parameters:
list- the identifier of the list in the bundle.property- the object's property for which the value will be fetch.max- the maximum number of objects to read from 1 to n. If max is -1 then the list is iterated up to find an object whose the property is set. If max is >= 1 then the specified property of the first max objects are read (if the property isn't set for an object, it is set to an empty string).- Returns:
- an a list of string with one property value (if max is 1) or with several values (if max = -1 or > 1). If the property of an object to read exists but isn't set, then an empty string is set in the array.
- Throws:
MissingResourceException- if the bundle doesn't exist.
-
exists
boolean exists()Is this bundle exists?- Returns:
- true if this bundle exists, false otherwise.
-