private Object createHandler(String handlerName) throws SAXException { try { Class handlerClass = ClassUtil.forName(handlerName, getClass()); return handlerClass.newInstance(); } catch (ClassNotFoundException e) { throw new SAXException("Failed to create SAX Handler '" + handlerName + "'.", e); } catch (IllegalAccessException e) { throw new SAXException("Failed to create SAX Handler '" + handlerName + "'.", e); } catch (InstantiationException e) { throw new SAXException("Failed to create SAX Handler '" + handlerName + "'.", e); } }
private Object createHandler(String handlerName) throws SAXException { try { Class handlerClass = ClassUtil.forName(handlerName, getClass()); return handlerClass.newInstance(); } catch (ClassNotFoundException e) { throw new SAXException("Failed to create SAX Handler '" + handlerName + "'.", e); } catch (IllegalAccessException e) { throw new SAXException("Failed to create SAX Handler '" + handlerName + "'.", e); } catch (InstantiationException e) { throw new SAXException("Failed to create SAX Handler '" + handlerName + "'.", e); } }
private Object createHandler(String handlerName) throws SAXException { try { Class handlerClass = ClassUtil.forName(handlerName, getClass()); return handlerClass.newInstance(); } catch (ClassNotFoundException e) { throw new SAXException("Failed to create SAX Handler '" + handlerName + "'.", e); } catch (IllegalAccessException e) { throw new SAXException("Failed to create SAX Handler '" + handlerName + "'.", e); } catch (InstantiationException e) { throw new SAXException("Failed to create SAX Handler '" + handlerName + "'.", e); } }
private Object createHandler(String handlerName) throws SAXException { try { Class handlerClass = ClassUtil.forName(handlerName, getClass()); return handlerClass.newInstance(); } catch (ClassNotFoundException e) { throw new SAXException("Failed to create SAX Handler '" + handlerName + "'.", e); } catch (IllegalAccessException e) { throw new SAXException("Failed to create SAX Handler '" + handlerName + "'.", e); } catch (InstantiationException e) { throw new SAXException("Failed to create SAX Handler '" + handlerName + "'.", e); } }
private Class<?> getClassForType(final String type) { try { return ClassUtil.forName(type, Exports.class); } catch (ClassNotFoundException e) { throw new SmooksException("Could not load class for type [" + type + "]."); } }
private Class<?> getClassForType(final String type) { try { return ClassUtil.forName(type, Exports.class); } catch (ClassNotFoundException e) { throw new SmooksException("Could not load class for type [" + type + "]."); } }
public Object decode(String data) throws DataDecodeException { try { return ClassUtil.forName(data.trim(), ClassDecoder.class); } catch (ClassNotFoundException e) { throw new DataDecodeException("Failed to decode '" + data + "' as a Java Class.", e); } } }
public Object decode(String data) throws DataDecodeException { try { return ClassUtil.forName(data.trim(), ClassDecoder.class); } catch (ClassNotFoundException e) { throw new DataDecodeException("Failed to decode '" + data + "' as a Java Class.", e); } } }
public Object decode(String data) throws DataDecodeException { try { return ClassUtil.forName(data.trim(), ClassDecoder.class); } catch (ClassNotFoundException e) { throw new DataDecodeException("Failed to decode '" + data + "' as a Java Class.", e); } } }
private Class<?> getClassForType(final String type) { try { return ClassUtil.forName(type, Exports.class); } catch (ClassNotFoundException e) { throw new SmooksException("Could not load class for type [" + type + "]."); } }
private Class<?> getClassForType(final String type) { try { return ClassUtil.forName(type, Exports.class); } catch (ClassNotFoundException e) { throw new SmooksException("Could not load class for type [" + type + "]."); } }
private Class<?> getBeanClass(Element bindingElement) { String beanClassName = getBeanTypeName(bindingElement); Class<?> beanClass; try { beanClass = ClassUtil.forName(beanClassName, getClass()); } catch (ClassNotFoundException e) { throw new SmooksConfigurationException("Bean class '" + beanClassName + "' not avilable on classpath."); } return beanClass; }
public void filter(String resourceName) { if(resourceName.endsWith(".class") && !isIgnorable(resourceName)) { String className = ClasspathUtils.toClassName(resourceName); try { Class clazz = ClassUtil.forName(className, InstanceOfFilter.class); if(addClass(clazz)) { classes.add(clazz); } } catch (Throwable throwable) { logger.debug("Resource '" + resourceName + "' presented to '" + InstanceOfFilter.class.getName() + "', but not loadable by classloader. Ignoring.", throwable); } } }
private Class<?> getBeanClass(Element bindingElement) { String beanClassName = getBeanTypeName(bindingElement); Class<?> beanClass; try { beanClass = ClassUtil.forName(beanClassName, getClass()); } catch (ClassNotFoundException e) { throw new SmooksConfigurationException("Bean class '" + beanClassName + "' not avilable on classpath."); } return beanClass; }
private Class<?> getBeanClass(Element bindingElement) { String beanClassName = getBeanTypeName(bindingElement); Class<?> beanClass; try { beanClass = ClassUtil.forName(beanClassName, getClass()); } catch (ClassNotFoundException e) { throw new SmooksConfigurationException("Bean class '" + beanClassName + "' not avilable on classpath."); } return beanClass; }
public void filter(String resourceName) { if(resourceName.endsWith(".class") && !isIgnorable(resourceName)) { String className = ClasspathUtils.toClassName(resourceName); try { Class clazz = ClassUtil.forName(className, InstanceOfFilter.class); if(addClass(clazz)) { classes.add(clazz); } } catch (Throwable throwable) { logger.debug("Resource '" + resourceName + "' presented to '" + InstanceOfFilter.class.getName() + "', but not loadable by classloader. Ignoring.", throwable); } } }
public void filter(String resourceName) { if(resourceName.endsWith(".class") && !isIgnorable(resourceName)) { String className = ClasspathUtils.toClassName(resourceName); try { Class clazz = ClassUtil.forName(className, InstanceOfFilter.class); if(addClass(clazz)) { classes.add(clazz); } } catch (Throwable throwable) { logger.debug("Resource '" + resourceName + "' presented to '" + InstanceOfFilter.class.getName() + "', but not loadable by classloader. Ignoring.", throwable); } } }
public void setConfiguration(Properties resourceConfig) throws SmooksConfigurationException { String enumTypeName = resourceConfig.getProperty("enumType"); if(enumTypeName == null || enumTypeName.trim().equals("")) { throw new SmooksConfigurationException("Invalid EnumDecoder configuration. 'enumType' param not specified."); } try { enumType = ClassUtil.forName(enumTypeName.trim(), EnumDecoder.class); } catch (ClassNotFoundException e) { throw new SmooksConfigurationException("Invalid Enum decoder configuration. Failed to resolve '" + enumTypeName + "' as a Java Enum Class.", e); } if(!Enum.class.isAssignableFrom(enumType)) { throw new SmooksConfigurationException("Invalid Enum decoder configuration. Resolved 'enumType' '" + enumTypeName + "' is not a Java Enum Class."); } strict = resourceConfig.getProperty("strict", "true").equals("true"); mappingDecoder.setConfiguration(resourceConfig); mappingDecoder.setStrict(false); this.configuration = resourceConfig; }
public static ExpressionEvaluator createInstance(String className, String conditionExpression) { try { ExpressionEvaluator evaluator = (ExpressionEvaluator) ClassUtil.forName(className, Factory.class).newInstance(); if(!(evaluator instanceof ExecutionContextExpressionEvaluator)) { throw new SmooksConfigurationException("Unsupported ExpressionEvaluator type '" + className + "'. Currently only support '" + ExecutionContextExpressionEvaluator.class.getName() + "' implementations."); } evaluator.setExpression(conditionExpression); return evaluator; } catch (ClassNotFoundException e) { throw new SmooksConfigurationException("Failed to load ExpressionEvaluator Class '" + className + "'.", e); } catch (ClassCastException e) { throw new SmooksConfigurationException("Class '" + className + "' is not a valid ExpressionEvaluator. It doesn't implement " + ExpressionEvaluator.class.getName()); } catch (IllegalAccessException e) { throw new SmooksConfigurationException("Failed to load ExpressionEvaluator Class '" + className + "'.", e); } catch (InstantiationException e) { throw new SmooksConfigurationException("Failed to load ExpressionEvaluator Class '" + className + "'.", e); } } }
public static ExpressionEvaluator createInstance(String className, String conditionExpression) { try { ExpressionEvaluator evaluator = (ExpressionEvaluator) ClassUtil.forName(className, Factory.class).newInstance(); if(!(evaluator instanceof ExecutionContextExpressionEvaluator)) { throw new SmooksConfigurationException("Unsupported ExpressionEvaluator type '" + className + "'. Currently only support '" + ExecutionContextExpressionEvaluator.class.getName() + "' implementations."); } evaluator.setExpression(conditionExpression); return evaluator; } catch (ClassNotFoundException e) { throw new SmooksConfigurationException("Failed to load ExpressionEvaluator Class '" + className + "'.", e); } catch (ClassCastException e) { throw new SmooksConfigurationException("Class '" + className + "' is not a valid ExpressionEvaluator. It doesn't implement " + ExpressionEvaluator.class.getName()); } catch (IllegalAccessException e) { throw new SmooksConfigurationException("Failed to load ExpressionEvaluator Class '" + className + "'.", e); } catch (InstantiationException e) { throw new SmooksConfigurationException("Failed to load ExpressionEvaluator Class '" + className + "'.", e); } } }