Kaynağa Gözat

Manually create some factories.

Change-Id: I94b86d126bee18237692072b7a4debb008ef3fda
Reviewed-on: http://gerrit.dmdirc.com/3691
Reviewed-by: Greg Holmes <greg@dmdirc.com>
Automatic-Compile: DMDirc Build Manager
pull/1/head
Chris Smith 9 yıl önce
ebeveyn
işleme
7cb8ebe6d3

+ 3
- 6
src/com/dmdirc/Channel.java Dosyayı Görüntüle

@@ -47,8 +47,6 @@ import com.dmdirc.ui.input.TabCompletionType;
47 47
 import com.dmdirc.ui.messages.ColourManager;
48 48
 import com.dmdirc.ui.messages.Styliser;
49 49
 import com.dmdirc.util.URLBuilder;
50
-import com.dmdirc.util.annotations.factory.Factory;
51
-import com.dmdirc.util.annotations.factory.Unbound;
52 50
 import com.dmdirc.util.collections.ListenerList;
53 51
 import com.dmdirc.util.collections.RollingList;
54 52
 
@@ -69,7 +67,6 @@ import javax.annotation.Nonnull;
69 67
  * events from the parser, maintains the corresponding ChannelWindow, and handles user input for the
70 68
  * channel.
71 69
  */
72
-@Factory(inject = true, providers = true, singleton = true)
73 70
 public class Channel extends MessageTarget implements GroupChat {
74 71
 
75 72
     /** List of registered listeners. */
@@ -109,9 +106,9 @@ public class Channel extends MessageTarget implements GroupChat {
109 106
      * @param eventBus            The bus to despatch events onto.
110 107
      */
111 108
     public Channel(
112
-            @Unbound final Server newServer,
113
-            @Unbound final ChannelInfo newChannelInfo,
114
-            @Unbound final ConfigProviderMigrator configMigrator,
109
+            final Server newServer,
110
+            final ChannelInfo newChannelInfo,
111
+            final ConfigProviderMigrator configMigrator,
115 112
             final TabCompleterFactory tabCompleterFactory,
116 113
             final CommandController commandController,
117 114
             final MessageSinkManager messageSinkManager,

+ 66
- 0
src/com/dmdirc/ChannelFactory.java Dosyayı Görüntüle

@@ -0,0 +1,66 @@
1
+/*
2
+ * Copyright (c) 2006-2014 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
+
23
+package com.dmdirc;
24
+
25
+import com.dmdirc.interfaces.CommandController;
26
+import com.dmdirc.interfaces.config.ConfigProviderMigrator;
27
+import com.dmdirc.messages.MessageSinkManager;
28
+import com.dmdirc.parser.interfaces.ChannelInfo;
29
+import com.dmdirc.ui.input.TabCompleterFactory;
30
+import com.dmdirc.util.URLBuilder;
31
+
32
+import com.google.common.eventbus.EventBus;
33
+
34
+import javax.inject.Inject;
35
+import javax.inject.Singleton;
36
+
37
+/**
38
+ * Factory for {@link Channel}s.
39
+ */
40
+@Singleton
41
+public class ChannelFactory {
42
+
43
+    private final TabCompleterFactory tabCompleterFactory;
44
+    private final CommandController commandController;
45
+    private final MessageSinkManager messageSinkManager;
46
+    private final URLBuilder urlBuilder;
47
+    private final EventBus eventBus;
48
+
49
+    @Inject
50
+    public ChannelFactory(final TabCompleterFactory tabCompleterFactory,
51
+            final CommandController commandController, final MessageSinkManager messageSinkManager,
52
+            final URLBuilder urlBuilder, final EventBus eventBus) {
53
+        this.tabCompleterFactory = tabCompleterFactory;
54
+        this.commandController = commandController;
55
+        this.messageSinkManager = messageSinkManager;
56
+        this.urlBuilder = urlBuilder;
57
+        this.eventBus = eventBus;
58
+    }
59
+
60
+    public Channel getChannel(final Server server,
61
+            final ChannelInfo channelInfo,
62
+            final ConfigProviderMigrator configMigrator) {
63
+        return new Channel(server, channelInfo, configMigrator, tabCompleterFactory,
64
+                commandController, messageSinkManager, urlBuilder, eventBus);
65
+    }
66
+}

+ 2
- 5
src/com/dmdirc/Query.java Dosyayı Görüntüle

@@ -51,8 +51,6 @@ import com.dmdirc.parser.interfaces.callbacks.QuitListener;
51 51
 import com.dmdirc.ui.core.components.WindowComponent;
52 52
 import com.dmdirc.ui.input.TabCompleterFactory;
53 53
 import com.dmdirc.util.URLBuilder;
54
-import com.dmdirc.util.annotations.factory.Factory;
55
-import com.dmdirc.util.annotations.factory.Unbound;
56 54
 
57 55
 import java.awt.Toolkit;
58 56
 import java.util.Arrays;
@@ -64,7 +62,6 @@ import java.util.List;
64 62
  * for query events from the parser, maintains the corresponding QueryWindow, and handles user input
65 63
  * for the query.
66 64
  */
67
-@Factory(inject = true, providers = true, singleton = true)
68 65
 public class Query extends MessageTarget implements PrivateActionListener,
69 66
         PrivateMessageListener, NickChangeListener, QuitListener,
70 67
         CompositionStateChangeListener, PrivateChat {
@@ -87,8 +84,8 @@ public class Query extends MessageTarget implements PrivateActionListener,
87 84
      * @param urlBuilder          The URL builder to use when finding icons.
88 85
      */
89 86
     public Query(
90
-            @Unbound final Server newServer,
91
-            @Unbound final String newHost,
87
+            final Server newServer,
88
+            final String newHost,
92 89
             final TabCompleterFactory tabCompleterFactory,
93 90
             final CommandController commandController,
94 91
             final MessageSinkManager messageSinkManager,

+ 59
- 0
src/com/dmdirc/QueryFactory.java Dosyayı Görüntüle

@@ -0,0 +1,59 @@
1
+/*
2
+ * Copyright (c) 2006-2014 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
+
23
+package com.dmdirc;
24
+
25
+import com.dmdirc.interfaces.CommandController;
26
+import com.dmdirc.messages.MessageSinkManager;
27
+import com.dmdirc.ui.input.TabCompleterFactory;
28
+import com.dmdirc.util.URLBuilder;
29
+
30
+import javax.inject.Inject;
31
+import javax.inject.Singleton;
32
+
33
+/**
34
+ * Factory for {@link Query}s.
35
+ */
36
+@Singleton
37
+public class QueryFactory {
38
+
39
+    private final TabCompleterFactory tabCompleterFactory;
40
+    private final CommandController commandController;
41
+    private final MessageSinkManager messageSinkManager;
42
+    private final URLBuilder urlBuilder;
43
+
44
+    @Inject
45
+    public QueryFactory(final TabCompleterFactory tabCompleterFactory,
46
+            final CommandController commandController, final MessageSinkManager messageSinkManager,
47
+            final URLBuilder urlBuilder) {
48
+        this.tabCompleterFactory = tabCompleterFactory;
49
+        this.commandController = commandController;
50
+        this.messageSinkManager = messageSinkManager;
51
+        this.urlBuilder = urlBuilder;
52
+    }
53
+
54
+    public Query getQuery(final Server server, final String host) {
55
+        return new Query(server, host, tabCompleterFactory, commandController,
56
+                messageSinkManager, urlBuilder);
57
+    }
58
+
59
+}

+ 1
- 4
src/com/dmdirc/Raw.java Dosyayı Görüntüle

@@ -34,8 +34,6 @@ import com.dmdirc.parser.interfaces.callbacks.DataInListener;
34 34
 import com.dmdirc.parser.interfaces.callbacks.DataOutListener;
35 35
 import com.dmdirc.ui.core.components.WindowComponent;
36 36
 import com.dmdirc.util.URLBuilder;
37
-import com.dmdirc.util.annotations.factory.Factory;
38
-import com.dmdirc.util.annotations.factory.Unbound;
39 37
 
40 38
 import java.util.Arrays;
41 39
 import java.util.Date;
@@ -44,7 +42,6 @@ import java.util.Date;
44 42
  * Handles the raw window (which shows the user raw data being sent and received to/from the
45 43
  * server).
46 44
  */
47
-@Factory(inject = true, providers = true, singleton = true)
48 45
 public class Raw extends FrameContainer implements DataInListener, DataOutListener {
49 46
 
50 47
     /** The server object that's being monitored. */
@@ -59,7 +56,7 @@ public class Raw extends FrameContainer implements DataInListener, DataOutListen
59 56
      * @param urlBuilder         The URL builder to use when finding icons.
60 57
      */
61 58
     public Raw(
62
-            @Unbound final Server newServer,
59
+            final Server newServer,
63 60
             final CommandController commandController,
64 61
             final MessageSinkManager messageSinkManager,
65 62
             final URLBuilder urlBuilder) {

+ 55
- 0
src/com/dmdirc/RawFactory.java Dosyayı Görüntüle

@@ -0,0 +1,55 @@
1
+/*
2
+ * Copyright (c) 2006-2014 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
+
23
+package com.dmdirc;
24
+
25
+import com.dmdirc.interfaces.CommandController;
26
+import com.dmdirc.messages.MessageSinkManager;
27
+import com.dmdirc.util.URLBuilder;
28
+
29
+import javax.inject.Inject;
30
+import javax.inject.Singleton;
31
+
32
+/**
33
+ * Factory for {@link Raw}s.
34
+ */
35
+@Singleton
36
+public class RawFactory {
37
+
38
+    private final CommandController commandController;
39
+    private final MessageSinkManager messageSinkManager;
40
+    private final URLBuilder urlBuilder;
41
+
42
+    @Inject
43
+    public RawFactory(final CommandController commandController,
44
+            final MessageSinkManager messageSinkManager,
45
+            final URLBuilder urlBuilder) {
46
+        this.commandController = commandController;
47
+        this.messageSinkManager = messageSinkManager;
48
+        this.urlBuilder = urlBuilder;
49
+    }
50
+
51
+    public Raw getRaw(final Server server) {
52
+        return new Raw(server, commandController, messageSinkManager, urlBuilder);
53
+    }
54
+
55
+}

Loading…
İptal
Kaydet