public Filter newInstance() { return (Filter) ClassUtils.newInstance(this.filterClass); }
protected final HashFormat newHashFormatInstance(Class clazz) { assertHashFormatImpl(clazz); return (HashFormat) ClassUtils.newInstance(clazz); } }
public static Object newInstance(String fqcn) { return newInstance(forName(fqcn)); }
public static Object newInstance(String fqcn, Object... args) { return newInstance(forName(fqcn), args); }
protected void createNewInstance(Map<String, Object> objects, String name, String value) { Object currentInstance = objects.get(name); if (currentInstance != null) { log.info("An instance with name '{}' already exists. " + "Redefining this object as a new instance of type {}", name, value); } Object instance;//name with no property, assume right hand side of equals sign is the class name: try { instance = ClassUtils.newInstance(value); if (instance instanceof Nameable) { ((Nameable) instance).setName(name); } } catch (Exception e) { String msg = "Unable to instantiate class [" + value + "] for object named '" + name + "'. " + "Please ensure you've specified the fully qualified class name correctly."; throw new ConfigurationException(msg, e); } objects.put(name, instance); }
@Test public void testMsgCauseConstructor() { ClassUtils.newInstance(getExceptionClass(), "Msg", new Throwable()); } }
@Test public void testCauseConstructor() throws Exception { ClassUtils.newInstance(getExceptionClass(), new Throwable()); }
webEnvironment = (WebEnvironment) ClassUtils.newInstance(webEnvironmentClass);
@Test public void testMsgConstructor() throws Exception { ClassUtils.newInstance(getExceptionClass(), "Msg"); }
@Test public void testNoArgConstructor() { ClassUtils.newInstance(getExceptionClass()); }
@Test public void testBasic() { CredentialsMatcher matcher = (CredentialsMatcher) ClassUtils.newInstance(getMatcherClass()); byte[] hashed = hash("password").getBytes(); AuthenticationInfo account = new SimpleAuthenticationInfo("username", hashed, "realmName"); AuthenticationToken token = new UsernamePasswordToken("username", "password"); assertTrue(matcher.doCredentialsMatch(token, account)); } }
public Filter newInstance() { return (Filter) ClassUtils.newInstance(this.filterClass); }
protected final HashFormat newHashFormatInstance(Class clazz) { assertHashFormatImpl(clazz); return (HashFormat) ClassUtils.newInstance(clazz); } }
public static Object newInstance(String fqcn) { return newInstance(forName(fqcn)); }
public static Object newInstance(String fqcn) { return newInstance(forName(fqcn)); }
public static Object newInstance(String fqcn, Object... args) { return newInstance(forName(fqcn), args); }
public static Object newInstance(String fqcn, Object... args) { return newInstance(forName(fqcn), args); }
protected void createNewInstance(Map<String, Object> objects, String name, String value) { Object currentInstance = objects.get(name); if (currentInstance != null) { log.info("An instance with name '{}' already exists. " + "Redefining this object as a new instance of type {}", name, value); } Object instance;//name with no property, assume right hand side of equals sign is the class name: try { instance = ClassUtils.newInstance(value); if (instance instanceof Nameable) { ((Nameable) instance).setName(name); } } catch (Exception e) { String msg = "Unable to instantiate class [" + value + "] for object named '" + name + "'. " + "Please ensure you've specified the fully qualified class name correctly."; throw new ConfigurationException(msg, e); } objects.put(name, instance); }
protected void createNewInstance(Map<String, Object> objects, String name, String value) { Object currentInstance = objects.get(name); if (currentInstance != null) { log.info("An instance with name '{}' already exists. " + "Redefining this object as a new instance of type []", name, value); } Object instance;//name with no property, assume right hand side of equals sign is the class name: try { instance = ClassUtils.newInstance(value); if (instance instanceof Nameable) { ((Nameable) instance).setName(name); } } catch (Exception e) { String msg = "Unable to instantiate class [" + value + "] for object named '" + name + "'. " + "Please ensure you've specified the fully qualified class name correctly."; throw new ConfigurationException(msg, e); } objects.put(name, instance); }