loading table of contents...
4.3.1.2.1. The setting* Methods

          
public interface SettingsService {
  <T> T setting(
          String name,
          Class<T> expectedType,
          Object... beans);

  <T> T settingWithDefault([...]);

  <T> List<T> settingAsList([...]);

  <K, V> Map<K, V> settingAsMap([...]);

  [...]
}

        

All setting* methods are actually just variants of the basic setting method. Some provide additional convenience like settingWithDefault, others have complex return types which cannot be expressed as a simple type parameter, for example settingAsList. All setting* methods have some common parameters which are described in Table 4.4, “ Parameters of the settings* methods ”. For detailed descriptions of the setting* methods please consult the API documentation of the SettingsService.

Parameter Description

name

The name (or key) of the setting to fetch.

expectedType

The type of the returned object. This parameter allows for type safety and prevents you from unchecked casts of the result. For the settingAsList method, the expectedType parameter determines the type of the list entries, not the list itself. settingAsMap has separate type arguments for keys and values of the result map.

beans

Settings are always fetched for one or multiple targets, which are passed by the beans vararg parameter. In the Blueprint's default configuration the SettingsService supports content objects, content beans, pages, sites and some other kinds of beans.

Table 4.4.  Parameters of the settings* methods