@Test public void testParseTypes() { assertContainsInOrder(Utils.parseTypes(" java.lang.Number ", getClass().getClassLoader()), Number.class); assertContainsInOrder( Utils.parseTypes("java.lang.Number,java.lang.String,java.util.Map", getClass().getClassLoader()), Number.class, String.class, Map.class); assertContainsInOrder( Utils.parseTypes("java.lang.Number, java.lang.String, java.util.Map", getClass().getClassLoader()), Number.class, String.class, Map.class); assertContainsInOrder( Utils.parseTypes("java/lang/Number, java/lang/String, java/util/Map", getClass().getClassLoader()), Number.class, String.class, Map.class); assertContainsInOrder( Utils.parseTypes("java.lang.Number,\njava.lang.String,\njava.util.Map", getClass().getClassLoader()), Number.class, String.class, Map.class); }
static Set<Class<?>> parseTypes(final String types, final ClassLoader classLoader) { final Set<Class<?>> result = new LinkedHashSet<>(); for (final String token : StringUtils.splitByWholeSeparatorPreserveAllTokens(types, ",")) { try { result.add(ClassUtils.getClass(classLoader, token.trim().replace('/', '.'))); } catch (final ClassNotFoundException e) { throw new IllegalArgumentException(e); } } return result; }
Utils { static Set<Class<?>> parseTypes(final String types, final ClassLoader classLoader) { final Set<Class<?>> result = new LinkedHashSet<>(); for (final String token : StringUtils.splitByWholeSeparatorPreserveAllTokens(types, ",")) { try { result.add(ClassUtils.getClass(classLoader, token.trim().replace('/', '.'))); } catch (final ClassNotFoundException e) { throw new IllegalArgumentException(e); } } return result; } }
Utils { static Set<Class<?>> parseTypes(final String types, final ClassLoader classLoader) { final Set<Class<?>> result = new LinkedHashSet<>(); for (final String token : StringUtils.splitByWholeSeparatorPreserveAllTokens(types, ",")) { try { result.add(ClassUtils.getClass(classLoader, token.trim().replace('/', '.'))); } catch (final ClassNotFoundException e) { throw new IllegalArgumentException(e); } } return result; } private  Utils(); }
Utils { static Set<Class<?>> parseTypes(final String types, final ClassLoader classLoader) { final Set<Class<?>> result = new LinkedHashSet<>(); for (final String token : StringUtils.splitByWholeSeparatorPreserveAllTokens(types, ",")) { try { result.add(ClassUtils.getClass(classLoader, token.trim().replace('/', '.'))); } catch (final ClassNotFoundException e) { throw new IllegalArgumentException(e); } } return result; } private  Utils();  }
Utils { static Set<Class<?>> parseTypes(final String types, final ClassLoader classLoader) { final Set<Class<?>> result = new LinkedHashSet<>(); for (final String token : StringUtils.splitByWholeSeparatorPreserveAllTokens(types, ",")) { try { result.add(ClassUtils.getClass(classLoader, token.trim().replace('/', '.'))); } catch (final ClassNotFoundException e) { throw new IllegalArgumentException(e); } } return result; } private  Utils();   }