1 23 24 package org.dbforms.util; 25 26 import org.apache.commons.digester.AbstractObjectCreationFactory; 27 import org.apache.commons.logging.Log; 28 import org.apache.commons.logging.LogFactory; 29 30 import org.xml.sax.Attributes ; 31 32 33 34 41 public class SingletonClassFactoryCreate extends AbstractObjectCreationFactory { 42 43 private static Log logCat = LogFactory.getLog(SingletonClassFactoryCreate.class 44 .getName()); 45 46 47 private String className = null; 48 49 54 public SingletonClassFactoryCreate(String className) { 55 super(); 56 setClassName(className); 57 } 58 59 64 public void setClassName(String className) { 65 this.className = className; 66 } 67 68 69 74 public String getClassName() { 75 return className; 76 } 77 78 79 86 public Object createObject(Attributes attributes) { 87 Object obj = null; 88 89 try { 90 obj = ReflectionUtil.invoke(className, "instance", null, null); 91 } catch (Exception e) { 92 logCat.error("::createObject - cannot instance the class [" 93 + className + "]", e); 94 } 95 96 return obj; 97 } 98 } 99 | Popular Tags |