@Override public Reader getResourceReader(String name, String encoding) throws ResourceNotFoundException { InputStreamReader result = null; if (StringUtils.isEmpty(name)) { throw new ResourceNotFoundException("No template name provided"); } String path = base + name; try { result = new InputStreamReader(ClassUtils.getResourceAsStream(getClass(), path), encoding); } catch (Exception fnfe) { throw new ResourceNotFoundException("problem with template: " + path, fnfe); } if (result == null) { throw new ResourceNotFoundException("ClasspathResourceLoader Error: cannot find resource " + path); } return result; }
Object o = ClassUtils.getNewInstance(contextObj); context.put (contextName,o);
/** * Return a new instance of the given class. Checks the ThreadContext * classloader first, then uses the System classloader. Should replace all * calls to <code>Class.forName( claz ).newInstance()</code> (which only * calls the System class loader) when the class might be in a different * classloader (e.g. in a webapp). * * @param clazz the name of the class to instantiate * @return an instance of the specified class * @throws ClassNotFoundException * @throws IllegalAccessException * @throws InstantiationException */ public static Object getNewInstance(String clazz) throws ClassNotFoundException,IllegalAccessException,InstantiationException { return getClass(clazz).newInstance(); }
VelMethod method = ClassUtils.getMethod("size", noParams, noTypes, o, context, node, false); if (method == null)
VelMethod method = ClassUtils.getMethod("size", noParams, noTypes, o, context, node, false); if (method == null)
Object o = ClassUtils.getNewInstance(contextObj); context.put (contextName,o);
@Override public InputStream getResourceStream(String name) throws ResourceNotFoundException { InputStream result = null; if (StringUtils.isEmpty(name)) { throw new ResourceNotFoundException("No template name provided"); } String path = base + name; try { result = ClassUtils.getResourceAsStream(getClass(), path); } catch (Exception fnfe) { throw (ResourceNotFoundException) ExceptionUtils.createWithCause( ResourceNotFoundException.class, "problem with template: " + path, fnfe); } if (result == null) { throw new ResourceNotFoundException("ClasspathResourceLoader Error: cannot find resource " + path); } return result; }
/** * Return a new instance of the given class. Checks the ThreadContext * classloader first, then uses the System classloader. Should replace all * calls to <code>Class.forName( claz ).newInstance()</code> (which only * calls the System class loader) when the class might be in a different * classloader (e.g. in a webapp). * * @param clazz the name of the class to instantiate * @return an instance of the specified class * @throws ClassNotFoundException * @throws IllegalAccessException * @throws InstantiationException */ public static Object getNewInstance(String clazz) throws ClassNotFoundException,IllegalAccessException,InstantiationException { return getClass(clazz).newInstance(); }
Class[] paramClasses = {argument == null ? null : argument.getClass()}; VelMethod method = ClassUtils.getMethod(methodName, params, paramClasses, o, context, this, strictRef);
/** * Gets the loader specified in the configuration file. * @param rs * @param loaderClassName * @return TemplateLoader */ public static ResourceLoader getLoader(RuntimeServices rs, String loaderClassName) { ResourceLoader loader = null; try { loader = (ResourceLoader) ClassUtils.getNewInstance( loaderClassName ); rs.getLog().debug("ResourceLoader instantiated: {}", loader.getClass().getName()); return loader; } // The ugly three strike again: ClassNotFoundException,IllegalAccessException,InstantiationException catch(Exception e) { String msg = "Problem instantiating the template loader: "+loaderClassName+"." + System.lineSeparator() + "Look at your properties file and make sure the" + System.lineSeparator() + "name of the template loader is correct."; rs.getLog().error(msg, e); throw new VelocityException(msg, e); } } }
result = ClassUtils.getResourceAsStream( getClass(), name );
/** * Return a new instance of the given class. Checks the ThreadContext * classloader first, then uses the System classloader. Should replace all * calls to <code>Class.forName( claz ).newInstance()</code> (which only * calls the System class loader) when the class might be in a different * classloader (e.g. in a webapp). * * @param clazz the name of the class to instantiate * @return an instance of the specified class * @throws ClassNotFoundException * @throws IllegalAccessException * @throws InstantiationException */ public static Object getNewInstance(String clazz) throws ClassNotFoundException,IllegalAccessException,InstantiationException { return getClass(clazz).newInstance(); }
Class[] paramClasses = {argument == null ? null : argument.getClass()}; VelMethod method = ClassUtils.getMethod(methodName, params, paramClasses, o, context, this, strictRef);
o = ClassUtils.getNewInstance(classname);
result = ClassUtils.getResourceAsStream( getClass(), name );
/** * Add the Name of the class to methodize * @param s * @throws Exception */ public void addObject ( String s ) throws Exception { inspect(ClassUtils.getClass(s)); }
VelMethod method = ClassUtils.getMethod(methodName, params, paramClasses, o, context, this, strictRef); if (method == null) return null;
Object o = ClassUtils.getNewInstance( directiveClass );
try rawStream = ClassUtils.getResourceAsStream( getClass(), name ); if (rawStream != null)
/** * Add the Name of the class to methodize * @param s * @throws Exception */ public void addObject ( String s ) throws Exception { inspect(ClassUtils.getClass(s)); }