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.

DebugModule.java 5.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  1. /*
  2. * Copyright (c) 2006-2017 DMDirc Developers
  3. *
  4. * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
  5. * documentation files (the "Software"), to deal in the Software without restriction, including without limitation the
  6. * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
  7. * permit persons to whom the Software is furnished to do so, subject to the following conditions:
  8. *
  9. * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
  10. * Software.
  11. *
  12. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
  13. * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS
  14. * OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  15. * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  16. */
  17. package com.dmdirc.addons.debug;
  18. import com.dmdirc.ClientModule;
  19. import com.dmdirc.addons.debug.commands.Benchmark;
  20. import com.dmdirc.addons.debug.commands.ColourSpam;
  21. import com.dmdirc.addons.debug.commands.ConfigInfo;
  22. import com.dmdirc.addons.debug.commands.EventBusViewer;
  23. import com.dmdirc.addons.debug.commands.FakeError;
  24. import com.dmdirc.addons.debug.commands.FakeUpdates;
  25. import com.dmdirc.addons.debug.commands.FirstRun;
  26. import com.dmdirc.addons.debug.commands.ForceUpdate;
  27. import com.dmdirc.addons.debug.commands.GlobalConfigInfo;
  28. import com.dmdirc.addons.debug.commands.Identities;
  29. import com.dmdirc.addons.debug.commands.MemInfo;
  30. import com.dmdirc.addons.debug.commands.Notify;
  31. import com.dmdirc.addons.debug.commands.RunGC;
  32. import com.dmdirc.addons.debug.commands.ServerInfo;
  33. import com.dmdirc.addons.debug.commands.Services;
  34. import com.dmdirc.addons.debug.commands.ShowRaw;
  35. import com.dmdirc.addons.debug.commands.StatusbarMessage;
  36. import com.dmdirc.addons.debug.commands.Threads;
  37. import com.dmdirc.addons.debug.commands.Time;
  38. import com.dmdirc.plugins.PluginDomain;
  39. import com.dmdirc.plugins.PluginInfo;
  40. import dagger.Module;
  41. import dagger.Provides;
  42. /**
  43. * Dependency injection module for the debug plugin.
  44. */
  45. @Module(addsTo = ClientModule.class, injects = {DebugManager.class, Debug.class})
  46. public class DebugModule {
  47. private final PluginInfo pluginInfo;
  48. public DebugModule(final PluginInfo pluginInfo) {
  49. this.pluginInfo = pluginInfo;
  50. }
  51. @Provides
  52. @PluginDomain(DebugPlugin.class)
  53. public String getDomain() {
  54. return pluginInfo.getDomain();
  55. }
  56. @Provides(type = Provides.Type.SET)
  57. public DebugCommand getCommand(final Benchmark command) {
  58. return command;
  59. }
  60. @Provides(type = Provides.Type.SET)
  61. public DebugCommand getCommand(final ColourSpam command) {
  62. return command;
  63. }
  64. @Provides(type = Provides.Type.SET)
  65. public DebugCommand getCommand(final ConfigInfo command) {
  66. return command;
  67. }
  68. @Provides(type = Provides.Type.SET)
  69. public DebugCommand getCommand(final FakeError command) {
  70. return command;
  71. }
  72. @Provides(type = Provides.Type.SET)
  73. public DebugCommand getCommand(final FakeUpdates command) {
  74. return command;
  75. }
  76. @Provides(type = Provides.Type.SET)
  77. public DebugCommand getCommand(final FirstRun command) {
  78. return command;
  79. }
  80. @Provides(type = Provides.Type.SET)
  81. public DebugCommand getCommand(final ForceUpdate command) {
  82. return command;
  83. }
  84. @Provides(type = Provides.Type.SET)
  85. public DebugCommand getCommand(final GlobalConfigInfo command) {
  86. return command;
  87. }
  88. @Provides(type = Provides.Type.SET)
  89. public DebugCommand getCommand(final Identities command) {
  90. return command;
  91. }
  92. @Provides(type = Provides.Type.SET)
  93. public DebugCommand getCommand(final MemInfo command) {
  94. return command;
  95. }
  96. @Provides(type = Provides.Type.SET)
  97. public DebugCommand getCommand(final Notify command) {
  98. return command;
  99. }
  100. @Provides(type = Provides.Type.SET)
  101. public DebugCommand getCommand(final RunGC command) {
  102. return command;
  103. }
  104. @Provides(type = Provides.Type.SET)
  105. public DebugCommand getCommand(final ServerInfo command) {
  106. return command;
  107. }
  108. @Provides(type = Provides.Type.SET)
  109. public DebugCommand getCommand(final Services command) {
  110. return command;
  111. }
  112. @Provides(type = Provides.Type.SET)
  113. public DebugCommand getCommand(final ShowRaw command) {
  114. return command;
  115. }
  116. @Provides(type = Provides.Type.SET)
  117. public DebugCommand getCommand(final StatusbarMessage command) {
  118. return command;
  119. }
  120. @Provides(type = Provides.Type.SET)
  121. public DebugCommand getCommand(final Threads command) {
  122. return command;
  123. }
  124. @Provides(type = Provides.Type.SET)
  125. public DebugCommand getCommand(final Time command) {
  126. return command;
  127. }
  128. @Provides(type = Provides.Type.SET)
  129. public DebugCommand getCommand(final EventBusViewer command) {
  130. return command;
  131. }
  132. }