1 61 62 63 package org.jaxen; 64 65 import java.util.HashMap ; 66 67 79 public class SimpleFunctionContext implements FunctionContext 80 { 81 82 private HashMap functions; 83 84 90 public SimpleFunctionContext() 91 { 92 this.functions = new HashMap (); 93 } 94 95 123 public void registerFunction(String namespaceURI, 124 String localName, 125 Function function ) 126 { 127 this.functions.put( new QualifiedName(namespaceURI, localName), 128 function ); 129 } 130 131 public Function getFunction(String namespaceURI, 132 String prefix, 133 String localName ) 134 throws UnresolvableException 135 { 136 Object key = new QualifiedName( namespaceURI, localName ); 137 138 if ( this.functions.containsKey(key) ) { 139 return (Function) this.functions.get( key ); 140 } 141 else { 142 throw new UnresolvableException( "Function " + 143 prefix + ":" + localName ); 144 } 145 } 146 } 147 | Popular Tags |