You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jclouds.apache.org by an...@apache.org on 2014/10/27 00:15:22 UTC

git commit: Re-adding Reflection2.constructor

Repository: jclouds
Updated Branches:
  refs/heads/1.8.x 62fe88a60 -> 879355573


Re-adding Reflection2.constructor

Removed in 33ce3ee but used downstream in jclouds-labs


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

Branch: refs/heads/1.8.x
Commit: 879355573eb588fb551a501c466e2f1844b42c35
Parents: 62fe88a
Author: Andrew Phillips <an...@apache.org>
Authored: Sun Oct 26 19:14:49 2014 -0400
Committer: Andrew Phillips <an...@apache.org>
Committed: Sun Oct 26 19:14:49 2014 -0400

----------------------------------------------------------------------
 .../main/java/org/jclouds/reflect/Reflection2.java | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jclouds/blob/87935557/core/src/main/java/org/jclouds/reflect/Reflection2.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/jclouds/reflect/Reflection2.java b/core/src/main/java/org/jclouds/reflect/Reflection2.java
index bfd39b4..4c08b08 100644
--- a/core/src/main/java/org/jclouds/reflect/Reflection2.java
+++ b/core/src/main/java/org/jclouds/reflect/Reflection2.java
@@ -72,6 +72,23 @@ public class Reflection2 {
    }
 
    /**
+    * returns an {@link Invokable} object that reflects a constructor present in the {@link TypeToken} type.
+    * 
+    * @param ownerType
+    *           corresponds to {@link Invokable#getOwnerType()}
+    * @param parameterTypes
+    *           corresponds to {@link Constructor#getParameterTypes()}
+    * 
+    * @throws IllegalArgumentException
+    *            if the constructor doesn't exist or a security exception occurred
+    */
+   @SuppressWarnings("unchecked")
+   public static <T> Invokable<T, T> constructor(Class<T> ownerType, Class<?>... parameterTypes) {
+      return (Invokable<T, T>) get(constructorForParams, new TypeTokenAndParameterTypes(typeToken(ownerType),
+            parameterTypes));
+   }
+
+   /**
     * return all constructors present in the class as {@link Invokable}s.
     * 
     * @param ownerType