1 package net.sf.saxon.functions; 2 import net.sf.saxon.expr.Expression; 3 import net.sf.saxon.Configuration; 4 5 import java.io.Serializable ; 6 import java.lang.reflect.AccessibleObject ; 7 8 14 15 public class ExtensionFunctionFactory implements Serializable { 16 17 public ExtensionFunctionFactory(Configuration config) { 18 this.config = config; 19 } 20 21 private Class extensionFunctionCallClass = ExtensionFunctionCall.class; 22 private Configuration config; 23 24 29 30 public void setExtensionFunctionClass(Class subclass) { 31 extensionFunctionCallClass = subclass; 32 } 33 34 45 46 public Expression makeExtensionFunctionCall( 47 int nameCode, Class theClass, AccessibleObject method, Expression[] arguments) { 48 ExtensionFunctionCall fn; 49 try { 50 fn = (ExtensionFunctionCall)(extensionFunctionCallClass.newInstance()); 51 } catch (InstantiationException e) { 52 throw new IllegalArgumentException (e.getMessage()); 53 } catch (IllegalAccessException e) { 54 throw new IllegalArgumentException (e.getMessage()); 55 } 56 fn.init(nameCode, theClass, method, config); 57 fn.setArguments(arguments); 58 return fn; 59 } 60 61 } 62 63 | Popular Tags |