brooklyn-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sjcorb...@apache.org
Subject [04/14] git commit: Coerce String to Class
Date Mon, 01 Sep 2014 09:48:37 GMT
Coerce String to Class


Project: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/commit/5263b543
Tree: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/tree/5263b543
Diff: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/diff/5263b543

Branch: refs/heads/master
Commit: 5263b54393ce7978bab447e64e403138ecf5a306
Parents: c6a2212
Author: Andrew Kennedy <grkvlt@apache.org>
Authored: Thu Aug 28 17:12:05 2014 +0100
Committer: Andrew Kennedy <grkvlt@apache.org>
Committed: Sat Aug 30 17:23:48 2014 +0100

----------------------------------------------------------------------
 core/src/main/java/brooklyn/util/flags/TypeCoercions.java | 10 ++++++++++
 1 file changed, 10 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/5263b543/core/src/main/java/brooklyn/util/flags/TypeCoercions.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/brooklyn/util/flags/TypeCoercions.java b/core/src/main/java/brooklyn/util/flags/TypeCoercions.java
index 7e92ed5..5d705e9 100644
--- a/core/src/main/java/brooklyn/util/flags/TypeCoercions.java
+++ b/core/src/main/java/brooklyn/util/flags/TypeCoercions.java
@@ -619,6 +619,16 @@ public class TypeCoercions {
                 return BigInteger.valueOf(input);
             }
         });
+        registerAdapter(String.class, Class.class, new Function<String,Class>() {
+            @Override
+            public Class apply(final String input) {
+                try {
+                    return Class.forName(input);
+                } catch (ClassNotFoundException e) {
+                    throw Exceptions.propagate(e);
+                }
+            }
+        });
         registerAdapter(String.class, AttributeSensor.class, new Function<String,AttributeSensor>()
{
             @Override
             public AttributeSensor apply(final String input) {


Mime
View raw message