From 06d6e59c3eb34e11d99a559e48e461e2ff006bf6 Mon Sep 17 00:00:00 2001 From: Maxim Gorbunkov Date: Fri, 27 May 2016 11:05:04 +0400 Subject: [PATCH] PL-7281 ReflectionHelper loadClass processes primitive datatypes --- .../haulmont/bali/util/ReflectionHelper.java | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/modules/global/src/com/haulmont/bali/util/ReflectionHelper.java b/modules/global/src/com/haulmont/bali/util/ReflectionHelper.java index e9d71bde01..0af8a1d070 100644 --- a/modules/global/src/com/haulmont/bali/util/ReflectionHelper.java +++ b/modules/global/src/com/haulmont/bali/util/ReflectionHelper.java @@ -36,11 +36,29 @@ public final class ReflectionHelper { /** * Load class by name. - * @param name class FQN + * @param name class FQN or primitive type name * @return class instance * @throws ClassNotFoundException if not found */ public static Class loadClass(String name) throws ClassNotFoundException { + switch (name) { + case "int": + return int.class; + case "short": + return short.class; + case "char": + return char.class; + case "byte": + return byte.class; + case "long": + return long.class; + case "float": + return float.class; + case "double": + return double.class; + case "boolean": + return boolean.class; + } return Thread.currentThread().getContextClassLoader().loadClass(name); }