1 4 7 package javax.xml.crypto.dsig.spec; 8 9 import javax.xml.crypto.dsig.Transform; 10 import java.util.Collections ; 11 import java.util.HashMap ; 12 import java.util.Iterator ; 13 import java.util.Map ; 14 import java.util.Map.Entry; 15 16 31 public final class XPathFilterParameterSpec implements TransformParameterSpec { 32 33 private String xPath; 34 private Map nsMap; 35 36 43 public XPathFilterParameterSpec(String xPath) { 44 if (xPath == null) { 45 throw new NullPointerException (); 46 } 47 this.xPath = xPath; 48 this.nsMap = Collections.EMPTY_MAP; 49 } 50 51 65 public XPathFilterParameterSpec(String xPath, Map namespaceMap) { 66 if (xPath == null || namespaceMap == null) { 67 throw new NullPointerException (); 68 } 69 this.xPath = xPath; 70 nsMap = new HashMap (namespaceMap); 71 Iterator entries = nsMap.entrySet().iterator(); 72 while (entries.hasNext()) { 73 Map.Entry me = (Map.Entry ) entries.next(); 74 if (!(me.getKey() instanceof String ) || 75 !(me.getValue() instanceof String )) { 76 throw new ClassCastException ("not a String"); 77 } 78 } 79 nsMap = Collections.unmodifiableMap(nsMap); 80 } 81 82 87 public String getXPath() { 88 return xPath; 89 } 90 91 102 public Map getNamespaceMap() { 103 return nsMap; 104 } 105 } 106 | Popular Tags |