View Javadoc

1   package com.github.smokestack.jpa;
2   
3   import java.util.Iterator;
4   
5   import javax.xml.XMLConstants;
6   import javax.xml.namespace.NamespaceContext;
7   
8   public class PersistenceNamespaceContext implements NamespaceContext {
9   
10      public String getNamespaceURI(String prefix) {
11          if (prefix == null) throw new NullPointerException("Null prefix");
12          else if ("p".equals(prefix)) return "http://java.sun.com/xml/ns/persistence";
13          else if ("xml".equals(prefix)) return XMLConstants.XML_NS_URI;
14          return XMLConstants.NULL_NS_URI;
15      }
16  
17      // This method isn't necessary for XPath processing.
18      public String getPrefix(String uri) {
19          throw new UnsupportedOperationException();
20      }
21  
22      // This method isn't necessary for XPath processing either.
23      public Iterator getPrefixes(String uri) {
24          throw new UnsupportedOperationException();
25      }
26  }