polygene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From paulmer...@apache.org
Subject [1/2] zest-java git commit: Minor edits (unnecessary/missing generics, dead code...) around @This injection
Date Mon, 16 Nov 2015 16:08:39 GMT
Repository: zest-java
Updated Branches:
  refs/heads/develop 73b7f1969 -> 3c6c11f4d


Minor edits (unnecessary/missing generics, dead code...) around @This injection


Project: http://git-wip-us.apache.org/repos/asf/zest-java/repo
Commit: http://git-wip-us.apache.org/repos/asf/zest-java/commit/f871f7a8
Tree: http://git-wip-us.apache.org/repos/asf/zest-java/tree/f871f7a8
Diff: http://git-wip-us.apache.org/repos/asf/zest-java/diff/f871f7a8

Branch: refs/heads/develop
Commit: f871f7a8e2077145894438fe27424c1dcd2eaece
Parents: 73b7f19
Author: Paul Merlin <paulmerlin@apache.org>
Authored: Mon Nov 16 16:05:45 2015 +0100
Committer: Paul Merlin <paulmerlin@apache.org>
Committed: Mon Nov 16 16:05:45 2015 +0100

----------------------------------------------------------------------
 .../runtime/composite/ConstructorsModel.java    | 31 +++++++-------------
 .../injection/InjectedParametersModel.java      | 16 ----------
 2 files changed, 10 insertions(+), 37 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/zest-java/blob/f871f7a8/core/runtime/src/main/java/org/apache/zest/runtime/composite/ConstructorsModel.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/zest/runtime/composite/ConstructorsModel.java
b/core/runtime/src/main/java/org/apache/zest/runtime/composite/ConstructorsModel.java
index 435a020..faf0754 100644
--- a/core/runtime/src/main/java/org/apache/zest/runtime/composite/ConstructorsModel.java
+++ b/core/runtime/src/main/java/org/apache/zest/runtime/composite/ConstructorsModel.java
@@ -56,24 +56,24 @@ public final class ConstructorsModel
     implements Binder, Dependencies, VisitableHierarchy<Object, Object>
 {
     @SuppressWarnings( "raw" )
-    private final Class fragmentClass;
+    private final Class<?> fragmentClass;
     private final List<ConstructorModel> constructorModels;
     private List<ConstructorModel> boundConstructors;
 
     @SuppressWarnings( { "raw", "unchecked" } )
-    public ConstructorsModel( Class fragmentClass )
+    public ConstructorsModel( Class<?> fragmentClass )
     {
         this.fragmentClass = fragmentClass;
         validate( fragmentClass );
         constructorModels = new ArrayList<>();
-        Constructor[] realConstructors = this.fragmentClass.getDeclaredConstructors();
-        Class injectionClass = FragmentClassLoader.getSourceClass( fragmentClass );
-        for( Constructor constructor : realConstructors )
+        Constructor<?>[] realConstructors = this.fragmentClass.getDeclaredConstructors();
+        Class<?> injectionClass = FragmentClassLoader.getSourceClass( fragmentClass
);
+        for( Constructor<?> constructor : realConstructors )
         {
             constructor.setAccessible( true );
             try
             {
-                Constructor injectionConstructor = injectionClass.getDeclaredConstructor(
constructor.getParameterTypes() );
+                Constructor<?> injectionConstructor = injectionClass.getDeclaredConstructor(
constructor.getParameterTypes() );
                 injectionConstructor.setAccessible( true );
                 ConstructorModel constructorModel = newConstructorModel( this.fragmentClass,
constructor,
                                                                          injectionConstructor
);
@@ -91,7 +91,7 @@ public final class ConstructorsModel
     }
 
     @SuppressWarnings( "raw" )
-    private void validate( Class fragmentClass )
+    private void validate( Class<?> fragmentClass )
     {
         // Ensure that the fragment class is not an inner class, in which case we should
give a reasonable exception
         if( fragmentClass.getDeclaringClass() == null )
@@ -113,23 +113,12 @@ public final class ConstructorsModel
             return constructorModels.stream().flatMap( ConstructorModel::dependencies );
         }
         return boundConstructors.stream().flatMap( ConstructorModel::dependencies );
-
-//        Function<ConstructorModel, Iterable<DependencyModel>> constructorDependencies
= new Function<ConstructorModel, Iterable<DependencyModel>>()
-//        {
-//            @Override
-//            public Iterable<DependencyModel> apply( ConstructorModel constructorModel
)
-//            {
-//                return constructorModel.dependencies();
-//            }
-//        };
-//
-//        return Iterables.flattenIterables( Iterables.map( constructorDependencies, boundConstructors
== null ? constructorModels : boundConstructors ) );
     }
 
     @SuppressWarnings( "raw" )
-    private ConstructorModel newConstructorModel( Class fragmentClass,
-                                                  Constructor realConstructor,
-                                                  Constructor injectedConstructor
+    private ConstructorModel newConstructorModel( Class<?> fragmentClass,
+                                                  Constructor<?> realConstructor,
+                                                  Constructor<?> injectedConstructor
     )
     {
         int idx = 0;

http://git-wip-us.apache.org/repos/asf/zest-java/blob/f871f7a8/core/runtime/src/main/java/org/apache/zest/runtime/injection/InjectedParametersModel.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/zest/runtime/injection/InjectedParametersModel.java
b/core/runtime/src/main/java/org/apache/zest/runtime/injection/InjectedParametersModel.java
index db1665c..4fdd2a8 100644
--- a/core/runtime/src/main/java/org/apache/zest/runtime/injection/InjectedParametersModel.java
+++ b/core/runtime/src/main/java/org/apache/zest/runtime/injection/InjectedParametersModel.java
@@ -15,14 +15,11 @@
 package org.apache.zest.runtime.injection;
 
 import java.util.ArrayList;
-import java.util.Collection;
 import java.util.List;
-import java.util.function.Predicate;
 import java.util.stream.Stream;
 import org.apache.zest.api.composite.InjectedParametersDescriptor;
 import org.apache.zest.functional.HierarchicalVisitor;
 import org.apache.zest.functional.VisitableHierarchy;
-import org.apache.zest.runtime.composite.ConstructorModel;
 
 /**
  * JAVADOC
@@ -81,19 +78,6 @@ public final class InjectedParametersModel
         return visitor.visitLeave( this );
     }
 
-    public Collection<DependencyModel> filter( Predicate<DependencyModel> specification
)
-    {
-        ArrayList<DependencyModel> result = new ArrayList<DependencyModel>();
-        for( DependencyModel model : parameterDependencies )
-        {
-            if( specification.test( model ) )
-            {
-                result.add( model );
-            }
-        }
-        return result;
-    }
-
     @Override
     public String toString()
     {


Mime
View raw message