1 16 19 package com.sun.org.apache.xpath.internal.compiler; 20 21 import javax.xml.transform.TransformerException ; 22 23 import com.sun.org.apache.xpath.internal.functions.Function; 24 25 30 public class FuncLoader 31 { 32 33 36 private int m_funcID; 37 38 39 private String m_funcName; 40 41 48 public String getName() 49 { 50 return m_funcName; 51 } 52 53 63 public FuncLoader(String funcName, int funcID) 64 { 65 66 super(); 67 68 m_funcID = funcID; 69 m_funcName = funcName; 70 } 71 72 80 Function getFunction() throws TransformerException 81 { 82 try 83 { 84 String className = m_funcName; 85 if (className.indexOf(".") < 0) { 86 className = "com.sun.org.apache.xpath.internal.functions." + className; 87 } 88 Function func = (Function) ObjectFactory.newInstance( 90 className, ObjectFactory.findClassLoader(), true); 91 if(func.getClass().getClassLoader() == null) 93 return func; 94 else 95 throw new TransformerException ("Application can't install his own xpath function."); 96 } 97 catch (ObjectFactory.ConfigurationError e) 98 { 99 throw new TransformerException (e.getException()); 100 } 101 } 102 } 103 | Popular Tags |