commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mben...@apache.org
Subject svn commit: r1437221 - /commons/sandbox/weaver/branches/mjb/processor/src/main/java/org/apache/commons/weaver/model/ScanResult.java
Date Tue, 22 Jan 2013 22:27:01 GMT
Author: mbenson
Date: Tue Jan 22 22:27:01 2013
New Revision: 1437221

URL: http://svn.apache.org/viewvc?rev=1437221&view=rev
Log:
be more straightforward with wrapping packages to AnnotatedElements

Modified:
    commons/sandbox/weaver/branches/mjb/processor/src/main/java/org/apache/commons/weaver/model/ScanResult.java

Modified: commons/sandbox/weaver/branches/mjb/processor/src/main/java/org/apache/commons/weaver/model/ScanResult.java
URL: http://svn.apache.org/viewvc/commons/sandbox/weaver/branches/mjb/processor/src/main/java/org/apache/commons/weaver/model/ScanResult.java?rev=1437221&r1=1437220&r2=1437221&view=diff
==============================================================================
--- commons/sandbox/weaver/branches/mjb/processor/src/main/java/org/apache/commons/weaver/model/ScanResult.java
(original)
+++ commons/sandbox/weaver/branches/mjb/processor/src/main/java/org/apache/commons/weaver/model/ScanResult.java
Tue Jan 22 22:27:01 2013
@@ -24,7 +24,6 @@ import java.lang.reflect.AnnotatedElemen
 import java.lang.reflect.Constructor;
 import java.lang.reflect.Field;
 import java.lang.reflect.Method;
-import java.util.Collections;
 import java.util.Iterator;
 import java.util.NoSuchElementException;
 import java.util.concurrent.ConcurrentNavigableMap;
@@ -34,7 +33,8 @@ import java.util.concurrent.ConcurrentSk
  * Encapsulates the result of scanning based on a {@link ScanRequest}.
  */
 public class ScanResult {
-    private static abstract class Projection<PARENT, CHILD extends AnnotatedElement>
implements AnnotatedElements<CHILD> {
+    private static abstract class Projection<PARENT, CHILD extends AnnotatedElement>
implements
+        AnnotatedElements<CHILD> {
         private final Iterable<PARENT> parents;
 
         Projection(Iterable<PARENT> parents) {
@@ -179,10 +179,16 @@ public class ScanResult {
     }
 
     public AnnotatedElements<WeavablePackage> getPackages() {
-        return new Projection<WeavablePackage, WeavablePackage>(packages.values())
{
+        return new AnnotatedElements<WeavablePackage>() {
+
+            @Override
+            public Iterator<WeavablePackage> iterator() {
+                return packages.values().iterator();
+            }
+
             @Override
-            protected Iterable<WeavablePackage> childrenOf(WeavablePackage parent)
{
-                return Collections.singleton(parent);
+            public AnnotatedElements<WeavablePackage> with(Class<? extends Annotation>
annotationType) {
+                return new AnnotatedWith<WeavablePackage>(packages.values(), annotationType);
             }
         };
     }



Mime
View raw message