Coverage Report - org.mule.module.xml.stax.MapNamespaceContext
 
Classes in this File Line Coverage Branch Coverage Complexity
MapNamespaceContext
0%
0/19
0%
0/4
1.375
 
 1  
 /*
 2  
  * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.com
 3  
  * The software in this package is published under the terms of the CPAL v1.0
 4  
  * license, a copy of which has been included with this distribution in the
 5  
  * LICENSE.txt file.
 6  
  */
 7  
 package org.mule.module.xml.stax;
 8  
 
 9  
 import java.util.HashMap;
 10  
 import java.util.Iterator;
 11  
 import java.util.Map;
 12  
 
 13  
 import javax.xml.namespace.NamespaceContext;
 14  
 
 15  
 public final class MapNamespaceContext implements NamespaceContext
 16  
 {
 17  0
     private Map namespaces = new HashMap();
 18  
 
 19  
     public MapNamespaceContext()
 20  
     {
 21  0
         super();
 22  0
     }
 23  
 
 24  
     public MapNamespaceContext(final Map ns)
 25  
     {
 26  0
         this();
 27  0
         this.namespaces = ns;
 28  0
     }
 29  
 
 30  
     public void addNamespace(final String prefix, final String namespaceURI)
 31  
     {
 32  0
         this.namespaces.put(prefix, namespaceURI);
 33  0
     }
 34  
 
 35  
     public void addNamespaces(final Map ns)
 36  
     {
 37  0
         this.namespaces.putAll(ns);
 38  0
     }
 39  
 
 40  
     public String getNamespaceURI(String prefix)
 41  
     {
 42  0
         return (String) namespaces.get(prefix);
 43  
     }
 44  
 
 45  
     public String getPrefix(String namespaceURI)
 46  
     {
 47  0
         for (Iterator itr = namespaces.entrySet().iterator(); itr.hasNext();)
 48  
         {
 49  0
             Map.Entry e = (Map.Entry) itr.next();
 50  0
             if (e.getValue().equals(namespaceURI))
 51  
             {
 52  0
                 return (String) e.getKey();
 53  
             }
 54  0
         }
 55  0
         return null;
 56  
     }
 57  
 
 58  
     public Iterator getPrefixes(String namespaceURI)
 59  
     {
 60  0
         return null;
 61  
     }
 62  
 
 63  
     public Map getUsedNamespaces()
 64  
     {
 65  0
         return namespaces;
 66  
     }
 67  
 }