Bladeren bron

Remove group stuff as only one argument is ever faked

tags/0.6.3m1rc1
Chris Smith 15 jaren geleden
bovenliggende
commit
1b169985c8

+ 4
- 11
src/com/dmdirc/parser/irc/callbacks/CallbackObject.java Bestand weergeven

@@ -31,7 +31,6 @@ import java.lang.reflect.Constructor;
31 31
 import java.lang.reflect.InvocationTargetException;
32 32
 import java.lang.reflect.Method;
33 33
 import java.util.ArrayList;
34
-import java.util.Arrays;
35 34
 import java.util.HashMap;
36 35
 import java.util.List;
37 36
 import java.util.Map;
@@ -180,9 +179,7 @@ public class CallbackObject {
180 179
             for (Annotation ann : anns) {
181 180
                 if (ann.annotationType().equals(FakableArgument.class)
182 181
                         && args[i] == null) {
183
-                    args[i] = getFakeArg(args,
184
-                            type.getMethods()[0].getParameterTypes()[i],
185
-                            ((FakableArgument) ann).group());
182
+                    args[i] = getFakeArg(args, type.getMethods()[0].getParameterTypes()[i]);
186 183
                 }
187 184
             }
188 185
 
@@ -193,8 +190,6 @@ public class CallbackObject {
193 190
     /**
194 191
      * Tries to create fake argument of the specified target class, by using
195 192
      * {@link FakableSource} denoted parameters from the specified arg array.
196
-     * Parameters are only used if their groups value contains the specified
197
-     * group.
198 193
      *
199 194
      * If an argument is missing, the method attempts to create a fake instance
200 195
      * by recursing into this method again. Note that this could cause an
@@ -206,17 +201,15 @@ public class CallbackObject {
206 201
      *
207 202
      * @param args The arguments array to use for sources
208 203
      * @param target The class that should be constructed
209
-     * @param group The group of arguments to use
210 204
      * @return An instance of the target class, or null on failure
211 205
      */
212
-    protected Object getFakeArg(final Object[] args, final Class<?> target, final String group) {
206
+    protected Object getFakeArg(final Object[] args, final Class<?> target) {
213 207
         final Map<Class, Object> sources = new HashMap<Class, Object>();
214 208
         int i = 0;
215 209
 
216 210
         for (Annotation[] anns : type.getMethods()[0].getParameterAnnotations()) {
217 211
             for (Annotation ann : anns) {
218
-                if (ann.annotationType().equals(FakableSource.class)
219
-                        && Arrays.asList(((FakableSource) ann).group()).contains(group)) {
212
+                if (ann.annotationType().equals(FakableSource.class)) {
220 213
                     sources.put(type.getMethods()[0].getParameterTypes()[i], args[i]);
221 214
                 }
222 215
             }
@@ -234,7 +227,7 @@ public class CallbackObject {
234 227
             for (Class<?> needed : ctor.getParameterTypes()) {
235 228
                 if (sources.containsKey(needed)) {
236 229
                     params[i] = sources.get(needed);
237
-                } else if ((param = getFakeArg(args, needed, group)) != null) {
230
+                } else if ((param = getFakeArg(args, needed)) != null) {
238 231
                     params[i] = param;
239 232
                 } else {
240 233
                     failed = true;

+ 0
- 8
src/com/dmdirc/parser/irc/callbacks/FakableArgument.java Bestand weergeven

@@ -37,12 +37,4 @@ import java.lang.annotation.Target;
37 37
 @Target(ElementType.PARAMETER)
38 38
 public @interface FakableArgument {
39 39
 
40
-    /**
41
-     * A group name used to differentiate between multiple fakable arguments
42
-     * in the same method.
43
-     *
44
-     * @return The name of the group for multiple fakable arguments
45
-     */
46
-    String group() default "default";
47
-
48 40
 }

+ 0
- 8
src/com/dmdirc/parser/irc/callbacks/FakableSource.java Bestand weergeven

@@ -38,12 +38,4 @@ import java.lang.annotation.Target;
38 38
 @Target(ElementType.PARAMETER)
39 39
 public @interface FakableSource {
40 40
 
41
-    /**
42
-     * A group name used to differentiate between multiple fakable arguments
43
-     * in the same method.
44
-     *
45
-     * @return The name of the groups for multiple fakable arguments
46
-     */
47
-    String[] group() default {"default"};
48
-
49 41
 }

Laden…
Annuleren
Opslaan