You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

AggregateConfigProvider.java 3.0KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. /*
  2. * Copyright (c) 2006-2015 DMDirc Developers
  3. *
  4. * Permission is hereby granted, free of charge, to any person obtaining a copy
  5. * of this software and associated documentation files (the "Software"), to deal
  6. * in the Software without restriction, including without limitation the rights
  7. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  8. * copies of the Software, and to permit persons to whom the Software is
  9. * furnished to do so, subject to the following conditions:
  10. *
  11. * The above copyright notice and this permission notice shall be included in
  12. * all copies or substantial portions of the Software.
  13. *
  14. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  17. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  18. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  19. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  20. * SOFTWARE.
  21. */
  22. package com.dmdirc.interfaces.config;
  23. import com.dmdirc.config.ConfigBinder;
  24. import java.util.List;
  25. import java.util.Set;
  26. /**
  27. * A configuration provider which aggregates an ordered list of other {@link ConfigProvider}s.
  28. *
  29. * Because this provider exposes settings from multiple independent sources, it cannot change any
  30. * settings as the scope of such changes may be unclear.
  31. */
  32. public interface AggregateConfigProvider extends ReadOnlyConfigProvider {
  33. /**
  34. * Adds a change listener for the specified domain.
  35. *
  36. * @param domain The domain to be monitored
  37. * @param listener The listener to register
  38. */
  39. void addChangeListener(String domain, ConfigChangeListener listener);
  40. /**
  41. * Adds a change listener for the specified domain and key.
  42. *
  43. * @param domain The domain of the option
  44. * @param key The option to be monitored
  45. * @param listener The listener to register
  46. */
  47. void addChangeListener(String domain, String key, ConfigChangeListener listener);
  48. /**
  49. * Returns the name of all domains known by this manager.
  50. *
  51. * @return A list of domains known to this manager
  52. */
  53. Set<String> getDomains();
  54. /**
  55. * Retrieves a list of sources for this config manager.
  56. *
  57. * @return This config manager's sources.
  58. */
  59. List<ConfigProvider> getSources();
  60. /**
  61. * Removes the specified listener for all domains and options.
  62. *
  63. * @param listener The listener to be removed
  64. */
  65. void removeListener(ConfigChangeListener listener);
  66. /**
  67. * Gets a binder that may be used to bind methods or fields in a class to configuration values
  68. * known by this provider. Bound values update automatically whenever the value in this provider
  69. * changes.
  70. *
  71. * @return A config binder for use with this provider.
  72. */
  73. ConfigBinder getBinder();
  74. }