View Javadoc

1   package com.atlassian.sal.api.usersettings;
2   
3   import com.atlassian.fugue.Option;
4   
5   import java.util.Set;
6   
7   /**
8    * An immutable container of user-specific settings.
9    *
10   * Key is global - two values of different types can _not_ be stored against a common key.
11   */
12  public interface UserSettings
13  {
14      /**
15       * @param key the setting key being queried
16       * @return a {@link Option.Some Some} containing the String stored against key if one exists (and is a String),
17       * a {@link Option.None} otherwise.
18       */
19      Option<String> getString(String key);
20  
21      /**
22       * @param key the setting key being queried
23       * @return a {@link Option.Some Some} containing the Boolean stored against key if one exists (and is a Boolean),
24       * a {@link Option.None} otherwise.
25       */
26      Option<Boolean> getBoolean(String key);
27  
28      /**
29       * @param key the setting key being queried
30       * @return a {@link Option.Some Some} containing the Long stored against key if one exists (and is a Long),
31       * a {@link Option.None} otherwise.
32       */
33      Option<Long> getLong(String key);
34  
35      /**
36       * @return the set of keys known to this UserSettings
37       */
38      Set<String> getKeys();
39  }