public static Object instantiateByClassNameAndParameter(String className, Class<?> superClass, ClassLoader classLoader, Class<?> type, Object parameter) throws IncompatibleClassException, DynamicClassLoadingException { if (className == null) { throw new NullPointerException(); } try { Class<?> classObj = null; classObj = classLoader.loadClass(className); if (!superClass.isAssignableFrom(classObj)) { throw new IncompatibleClassException(superClass, classObj); } if (type == null) { return classObj.newInstance(); } else { Constructor<?> constructor = classObj.getConstructor(type); return constructor.newInstance(parameter); } } catch (IncompatibleClassException ice) { throw ice; } catch (Throwable t) { throw new DynamicClassLoadingException("Failed to instantiate type " + className, t); } }
@SuppressWarnings("unchecked") public static Object instantiateByClassName(String className, Class superClass, ClassLoader classLoader) throws IncompatibleClassException, DynamicClassLoadingException { if (className == null) { throw new NullPointerException(); } try { Class classObj = null; classObj = classLoader.loadClass(className); if (!superClass.isAssignableFrom(classObj)) { throw new IncompatibleClassException(superClass, classObj); } return classObj.newInstance(); } catch (IncompatibleClassException ice) { throw ice; } catch (Throwable t) { throw new DynamicClassLoadingException("Failed to instantiate type " + className, t); } }
public static Object instantiateByClassNameAndParameter(String className, Class<?> superClass, ClassLoader classLoader, Class<?> type, Object parameter) throws IncompatibleClassException, DynamicClassLoadingException { if (className == null) { throw new NullPointerException(); } try { Class<?> classObj = null; classObj = classLoader.loadClass(className); if (!superClass.isAssignableFrom(classObj)) { throw new IncompatibleClassException(superClass, classObj); } if (type == null) { return classObj.newInstance(); } else { Constructor<?> constructor = classObj.getConstructor(type); return constructor.newInstance(parameter); } } catch (IncompatibleClassException ice) { throw ice; } catch (Throwable t) { throw new DynamicClassLoadingException("Failed to instantiate type " + className, t); } }
public static Object instantiateByClassNameAndParameter(String className, Class<?> superClass, ClassLoader classLoader, Class<?> type, Object parameter) throws IncompatibleClassException, DynamicClassLoadingException { if (className == null) { throw new NullPointerException(); } try { Class<?> classObj = null; classObj = classLoader.loadClass(className); if (!superClass.isAssignableFrom(classObj)) { throw new IncompatibleClassException(superClass, classObj); } if (type == null) { return classObj.getConstructor().newInstance(); } else { Constructor<?> constructor = classObj.getConstructor(type); return constructor.newInstance(parameter); } } catch (IncompatibleClassException ice) { throw ice; } catch (Throwable t) { throw new DynamicClassLoadingException("Failed to instantiate type " + className, t); } }
public static Object instantiateByClassNameAndParameter(String className, Class<?> superClass, ClassLoader classLoader, Class<?> type, Object parameter) throws IncompatibleClassException, DynamicClassLoadingException { if (className == null) { throw new NullPointerException(); } try { Class<?> classObj = null; classObj = classLoader.loadClass(className); if (!superClass.isAssignableFrom(classObj)) { throw new IncompatibleClassException(superClass, classObj); } if (type == null) { return classObj.newInstance(); } else { Constructor<?> constructor = classObj.getConstructor(type); return constructor.newInstance(parameter); } } catch (IncompatibleClassException ice) { throw ice; } catch (Throwable t) { throw new DynamicClassLoadingException("Failed to instantiate type " + className, t); } }
public static Object instantiateByClassNameAndParameter(String className, Class<?> superClass, ClassLoader classLoader, Class<?> type, Object parameter) throws IncompatibleClassException, DynamicClassLoadingException { if (className == null) { throw new NullPointerException(); } try { Class<?> classObj = null; classObj = classLoader.loadClass(className); if (!superClass.isAssignableFrom(classObj)) { throw new IncompatibleClassException(superClass, classObj); } if (type == null) { return classObj.newInstance(); } else { Constructor<?> constructor = classObj.getConstructor(type); return constructor.newInstance(parameter); } } catch (IncompatibleClassException ice) { throw ice; } catch (Throwable t) { throw new DynamicClassLoadingException("Failed to instantiate type " + className, t); } }
public static Object instantiateByClassNameAndParameter(String className, Class superClass, ClassLoader classLoader, Class type, Object parameter) throws IncompatibleClassException, DynamicClassLoadingException { if (className == null) { throw new NullPointerException(); } try { Class classObj = null; classObj = classLoader.loadClass(className); if (!superClass.isAssignableFrom(classObj)) { throw new IncompatibleClassException(superClass, classObj); } if (type == null) { return classObj.newInstance(); } else { Constructor constructor = classObj.getConstructor(type); return constructor.newInstance(parameter); } } catch (IncompatibleClassException ice) { throw ice; } catch (Throwable t) { throw new DynamicClassLoadingException("Failed to instantiate type " + className, t); } }
public static Object instantiateByClassNameAndParameter(String className, Class<?> superClass, ClassLoader classLoader, Class<?> type, Object parameter) throws IncompatibleClassException, DynamicClassLoadingException { if (className == null) { throw new NullPointerException(); } try { Class<?> classObj = null; classObj = classLoader.loadClass(className); if (!superClass.isAssignableFrom(classObj)) { throw new IncompatibleClassException(superClass, classObj); } if (type == null) { return classObj.newInstance(); } else { Constructor<?> constructor = classObj.getConstructor(type); return constructor.newInstance(parameter); } } catch (IncompatibleClassException ice) { throw ice; } catch (Throwable t) { throw new DynamicClassLoadingException("Failed to instantiate type " + className, t); } }
public static Object instantiateByClassNameAndParameter(String className, Class superClass, ClassLoader classLoader, Class type, Object parameter) throws IncompatibleClassException, DynamicClassLoadingException { if (className == null) { throw new NullPointerException(); } try { Class classObj = null; classObj = classLoader.loadClass(className); if (!superClass.isAssignableFrom(classObj)) { throw new IncompatibleClassException(superClass, classObj); } if (type == null) { return classObj.newInstance(); } else { Constructor constructor = classObj.getConstructor(type); return constructor.newInstance(parameter); } } catch (IncompatibleClassException ice) { throw ice; } catch (Throwable t) { throw new DynamicClassLoadingException("Failed to instantiate type " + className, t); } }