You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ws.apache.org by sa...@apache.org on 2012/01/21 18:41:28 UTC

svn commit: r1234376 - in /webservices/woden/trunk/java/woden-api/src: main/java/org/apache/woden/wsdl20/extensions/ main/java/org/apache/woden/wsdl20/extensions/http/ main/java/org/apache/woden/xpointer/ test/java/org/apache/woden/types/

Author: sagara
Date: Sat Jan 21 17:41:28 2012
New Revision: 1234376

URL: http://svn.apache.org/viewvc?rev=1234376&view=rev
Log:
Introduced some Java 5 features to the API. 

Modified:
    webservices/woden/trunk/java/woden-api/src/main/java/org/apache/woden/wsdl20/extensions/ExtensionRegistry.java
    webservices/woden/trunk/java/woden-api/src/main/java/org/apache/woden/wsdl20/extensions/http/HTTPLocation.java
    webservices/woden/trunk/java/woden-api/src/main/java/org/apache/woden/xpointer/ElementPointerPart.java
    webservices/woden/trunk/java/woden-api/src/main/java/org/apache/woden/xpointer/XPointer.java
    webservices/woden/trunk/java/woden-api/src/test/java/org/apache/woden/types/NCNameTest.java

Modified: webservices/woden/trunk/java/woden-api/src/main/java/org/apache/woden/wsdl20/extensions/ExtensionRegistry.java
URL: http://svn.apache.org/viewvc/webservices/woden/trunk/java/woden-api/src/main/java/org/apache/woden/wsdl20/extensions/ExtensionRegistry.java?rev=1234376&r1=1234375&r2=1234376&view=diff
==============================================================================
--- webservices/woden/trunk/java/woden-api/src/main/java/org/apache/woden/wsdl20/extensions/ExtensionRegistry.java (original)
+++ webservices/woden/trunk/java/woden-api/src/main/java/org/apache/woden/wsdl20/extensions/ExtensionRegistry.java Sat Jan 21 17:41:28 2012
@@ -87,36 +87,36 @@ public class ExtensionRegistry
     This is a Map of Maps. The top-level Map is keyed by (Class)parentType,
     and the inner Maps are keyed by (QName)elementQN.
   */
-  protected Map serializerReg = new Hashtable();
+  protected Map<Class, Map<QName, ExtensionSerializer>> serializerReg = new Hashtable<Class, Map<QName, ExtensionSerializer>>();
   /*
     This is a Map of Maps. The top-level Map is keyed by (Class)parentType,
     and the inner Maps are keyed by (QName)elementQN.
   */
-  protected Map deserializerReg = new Hashtable();
+  protected Map<Class, Map<QName, ExtensionDeserializer>> deserializerReg = new Hashtable<Class, Map<QName, ExtensionDeserializer>>();
   /*
     This is a Map of Maps. The top-level Map is keyed by (Class)parentType,
     and the inner Maps are keyed by (QName)elementQN.
   */
-  protected Map extElementReg = new Hashtable();
+  protected Map<Class, Map<QName, Class>> extElementReg = new Hashtable<Class, Map<QName, Class>>();
   protected ExtensionSerializer defaultSer = null;
   protected ExtensionDeserializer defaultDeser = null;
   /*
     This is a Map of Maps. The top-level Map is keyed by (Class)parentType,
     and the inner Maps are keyed by (QName)attrName.
   */
-  protected Map extAttributeReg = new Hashtable();
+  protected Map<Class, Map<QName, Class>> extAttributeReg = new Hashtable<Class, Map<QName, Class>>();
   
   /*
    * This is a Map of Maps. The top-level Map is keyed by (Class)parentComponent
    * and the inner Map is keyed by (URI)extensionNamespace with a value of
    * (Class)componentExtensions.
    */
-  protected Map compExtReg = new Hashtable();
+ protected Map<Class, Map<URI, Class<ComponentExtensionContext>>> compExtReg = new Hashtable<Class, Map<URI, Class<ComponentExtensionContext>>>();
   
   /*
    * Error message property files.
    */
-  private List fResourceBundleNames = new ArrayList();
+  private List<String> fResourceBundleNames = new ArrayList<String>();
   
   private ErrorReporter errorReporter = null;
   
@@ -129,7 +129,7 @@ public class ExtensionRegistry
    * A Map of assertions, where the key is an assertion id string and 
    * the value is an AssertionInfo object.
    */
-  protected Map assertionReg = new Hashtable();
+  protected Map<String, AssertionInfo> assertionReg = new Hashtable<String, AssertionInfo> ();
 
   /**
    * Set the serializer to be used when none is found for an extensibility
@@ -198,11 +198,11 @@ public class ExtensionRegistry
                                  QName elementType,
                                  ExtensionSerializer es)
   {
-    Map innerSerializerReg = (Map)serializerReg.get(parentType);
+    Map<QName, ExtensionSerializer> innerSerializerReg = serializerReg.get(parentType);
 
     if (innerSerializerReg == null)
     {
-      innerSerializerReg = new Hashtable();
+      innerSerializerReg = new Hashtable<QName, ExtensionSerializer>();
 
       serializerReg.put(parentType, innerSerializerReg);
     }
@@ -230,11 +230,11 @@ public class ExtensionRegistry
                                    QName elementType,
                                    ExtensionDeserializer ed)
   {
-    Map innerDeserializerReg = (Map)deserializerReg.get(parentType);
+    Map<QName, ExtensionDeserializer> innerDeserializerReg = deserializerReg.get(parentType);
 
     if (innerDeserializerReg == null)
     {
-      innerDeserializerReg = new Hashtable();
+      innerDeserializerReg = new Hashtable<QName, ExtensionDeserializer>();
 
       deserializerReg.put(parentType, innerDeserializerReg);
     }
@@ -267,12 +267,12 @@ public class ExtensionRegistry
                                              QName elementType)
                                                throws WSDLException
   {
-    Map innerSerializerReg = (Map)serializerReg.get(parentType);
+    Map<QName, ExtensionSerializer> innerSerializerReg = serializerReg.get(parentType);
     ExtensionSerializer es = null;
 
     if (innerSerializerReg != null)
     {
-      es = (ExtensionSerializer)innerSerializerReg.get(elementType);
+      es = innerSerializerReg.get(elementType);
     }
 
     if (es == null)
@@ -316,12 +316,12 @@ public class ExtensionRegistry
                                                  QName elementType)
                                                    throws WSDLException
   {
-    Map innerDeserializerReg = (Map)deserializerReg.get(parentType);
+    Map<QName, ExtensionDeserializer> innerDeserializerReg = deserializerReg.get(parentType);
     ExtensionDeserializer ed = null;
 
     if (innerDeserializerReg != null)
     {
-      ed = (ExtensionDeserializer)innerDeserializerReg.get(elementType);
+      ed = innerDeserializerReg.get(elementType);
     }
 
     if (ed == null)
@@ -358,13 +358,12 @@ public class ExtensionRegistry
    */
   public Class queryExtElementType(Class parentClass, QName elemQN)
   {
-    Map innerExtensionAttributeReg =
-      (Map)extAttributeReg.get(parentClass);
-    Class elemClass = null;
+    Map<QName, Class> innerExtensionAttributeReg = extAttributeReg.get(parentClass);
+    Class<XMLAttr> elemClass = null;
 
     if (innerExtensionAttributeReg != null)
     {
-        elemClass = (Class)innerExtensionAttributeReg.get(elemQN);
+        elemClass = innerExtensionAttributeReg.get(elemQN);
     }
 
     return elemClass;
@@ -380,9 +379,9 @@ public class ExtensionRegistry
    * Returns null if no extension deserializers are registered for
    * this parent type.
    */
-  public Set getAllowableExtensions(Class parentType)
+  public Set<QName> getAllowableExtensions(Class parentType)
   {
-    Map innerDeserializerReg = (Map)deserializerReg.get(parentType);
+    Map<QName, ExtensionDeserializer> innerDeserializerReg = deserializerReg.get(parentType);
 
     return (innerDeserializerReg != null)
            ? innerDeserializerReg.keySet()
@@ -410,11 +409,11 @@ public class ExtensionRegistry
                                 QName elementType,
                                 Class extensionType)
   {
-    Map innerExtensionTypeReg = (Map)extElementReg.get(parentType);
+    Map<QName, Class> innerExtensionTypeReg = extElementReg.get(parentType);
 
     if (innerExtensionTypeReg == null)
     {
-      innerExtensionTypeReg = new Hashtable();
+      innerExtensionTypeReg = new Hashtable<QName, Class>();
 
       extElementReg.put(parentType, innerExtensionTypeReg);
     }
@@ -446,12 +445,12 @@ public class ExtensionRegistry
                                               QName elementType)
                                                 throws WSDLException
   {
-    Map innerExtensionTypeReg = (Map)extElementReg.get(parentType);
-    Class extensionType = null;
+    Map<QName, Class> innerExtensionTypeReg = extElementReg.get(parentType);
+    Class<ExtensionElement> extensionType = null;
 
     if (innerExtensionTypeReg != null)
     {
-      extensionType = (Class)innerExtensionTypeReg.get(elementType);
+      extensionType = innerExtensionTypeReg.get(elementType);
     }
 
     if (extensionType == null)
@@ -475,7 +474,7 @@ public class ExtensionRegistry
 
     try
     {
-        ExtensionElement ee = (ExtensionElement)extensionType.newInstance();
+        ExtensionElement ee = extensionType.newInstance();
       /*
       if (ee.getElementType() == null)
       {
@@ -520,12 +519,11 @@ public class ExtensionRegistry
                                        QName attrQName,
                                        Class attrClass)
   {
-    Map innerExtensionAttributeReg =
-      (Map)extAttributeReg.get(ownerClass);
+    Map<QName, Class> innerExtensionAttributeReg = extAttributeReg.get(ownerClass);
 
     if (innerExtensionAttributeReg == null)
     {
-      innerExtensionAttributeReg = new Hashtable();
+      innerExtensionAttributeReg = new Hashtable<QName, Class>();
 
       extAttributeReg.put(ownerClass, innerExtensionAttributeReg);
     }
@@ -548,15 +546,14 @@ public class ExtensionRegistry
    * @see #registerExtAttributeType(Class, QName, Class)
    * @see AttributeExtensible
    */
-  public Class queryExtAttributeType(Class parentClass, QName attrQN)
+  public Class<XMLAttr> queryExtAttributeType(Class parentClass, QName attrQN)
   {
-    Map innerExtensionAttributeReg =
-      (Map)extAttributeReg.get(parentClass);
-    Class attrClass = null;
+    Map<QName, Class> innerExtensionAttributeReg = extAttributeReg.get(parentClass);
+    Class<XMLAttr> attrClass = null;
 
     if (innerExtensionAttributeReg != null)
     {
-        attrClass = (Class)innerExtensionAttributeReg.get(attrQN);
+        attrClass = innerExtensionAttributeReg.get(attrQN);
     }
 
     return attrClass;
@@ -565,13 +562,13 @@ public class ExtensionRegistry
   public XMLAttr createExtAttribute(Class ownerClass, QName attrQName, XMLElement ownerElement, String attrValue)
                                           throws WSDLException
   {
-      Map innerExtensionAttributeReg = (Map)extAttributeReg.get(ownerClass);
-      Class implClass = null;
+      Map<QName, Class> innerExtensionAttributeReg = extAttributeReg.get(ownerClass);
+      Class<XMLAttr> implClass = null;
       XMLAttr attr = null;
       
       if (innerExtensionAttributeReg != null)
       {
-          implClass = (Class)innerExtensionAttributeReg.get(attrQName);
+          implClass = innerExtensionAttributeReg.get(attrQName);
       }
       
       if (implClass == null)
@@ -587,7 +584,7 @@ public class ExtensionRegistry
                   new QName("http://ws.apache.org/woden", "DefaultAttr"));
 
           //If no default Java class is registered, use the UnknownAttr class.
-          if(implClass == null) implClass = UnknownAttr.class;
+          if(implClass == null) implClass = (Class)UnknownAttr.class;
           
            
           //Decided it is not necessary to report WSDL010 as a warning to the user, 
@@ -618,9 +615,9 @@ public class ExtensionRegistry
       
       try {
           Class[] ctorParms = new Class[] {XMLElement.class, QName.class, String.class, ErrorReporter.class};
-          Constructor ctor = implClass.getConstructor(ctorParms);
+          Constructor<XMLAttr> ctor = implClass.getConstructor(ctorParms);
           Object[] ctorParmValues = new Object[] {ownerElement, attrQName, attrValue, getErrorReporter()};
-          attr = (XMLAttr)ctor.newInstance(ctorParmValues);
+          attr = ctor.newInstance(ctorParmValues);
       } 
       catch (Exception e) {
           //SecurityException
@@ -656,12 +653,11 @@ public class ExtensionRegistry
           throw new IllegalArgumentException(msg);
       }
       
-      Map innerCompExtReg =
-          (Map)compExtReg.get(parentClass);
+      Map<URI, Class<ComponentExtensionContext>> innerCompExtReg = compExtReg.get(parentClass);
       
       if (innerCompExtReg == null)
       {
-          innerCompExtReg = new Hashtable();
+          innerCompExtReg = new Hashtable<URI, Class<ComponentExtensionContext>>();
           
           compExtReg.put(parentClass, innerCompExtReg);
       }
@@ -678,15 +674,14 @@ public class ExtensionRegistry
    * @param extNamespace the extension namespace
    * @return the Class of the component extensions
    */
-  public Class queryComponentExtension(Class parentClass, URI extNamespace)
+  public Class<ComponentExtensionContext> queryComponentExtension(Class parentClass, URI extNamespace)
   {
-      Map innerCompExtReg =
-          (Map)compExtReg.get(parentClass);
-      Class compExtClass = null;
+      Map<URI, Class<ComponentExtensionContext>> innerCompExtReg = compExtReg.get(parentClass);
+      Class<ComponentExtensionContext> compExtClass = null;
       
       if (innerCompExtReg != null)
       {
-          compExtClass = (Class)innerCompExtReg.get(extNamespace);
+          compExtClass = innerCompExtReg.get(extNamespace);
       }
       
       return compExtClass;
@@ -700,12 +695,11 @@ public class ExtensionRegistry
    */
   public URI[] queryComponentExtensionNamespaces(Class parentClass)
   {
-      Map innerCompExtReg =
-          (Map)compExtReg.get(parentClass);
+      Map<URI, Class<ComponentExtensionContext>> innerCompExtReg = compExtReg.get(parentClass);
       
       if (innerCompExtReg != null)
       {
-          Set namespaceKeys = innerCompExtReg.keySet();
+          Set<URI> namespaceKeys = innerCompExtReg.keySet();
           URI[] extNamespaces = new URI[namespaceKeys.size()];
           namespaceKeys.toArray(extNamespaces);
           return extNamespaces;
@@ -762,9 +756,9 @@ public class ExtensionRegistry
       
       try {
           Class[] ctorParms = new Class[] {WSDLComponent.class, URI.class, ErrorReporter.class};
-          Constructor ctor = compExtCtxClass.getConstructor(ctorParms);
+          Constructor<ComponentExtensionContext> ctor = compExtCtxClass.getConstructor(ctorParms);
           Object[] ctorParmValues = new Object[] {parentComp, extNamespace, getErrorReporter()};
-          compExtCtx = (ComponentExtensionContext)ctor.newInstance(ctorParmValues);
+          compExtCtx = ctor.newInstance(ctorParmValues);
       } 
       catch (Exception e) {
           //SecurityException
@@ -811,11 +805,11 @@ public class ExtensionRegistry
     }
     
     public AssertionInfo queryAssertion(String assertionId) {
-        return (AssertionInfo) this.assertionReg.get(assertionId);
+        return this.assertionReg.get(assertionId);
     }
     
     public AssertionInfo[] queryAssertions() {
-        Collection values = this.assertionReg.values();
+        Collection<AssertionInfo> values = this.assertionReg.values();
         AssertionInfo[] array = new AssertionInfo[values.size()];
         values.toArray(array);
         return array;

Modified: webservices/woden/trunk/java/woden-api/src/main/java/org/apache/woden/wsdl20/extensions/http/HTTPLocation.java
URL: http://svn.apache.org/viewvc/webservices/woden/trunk/java/woden-api/src/main/java/org/apache/woden/wsdl20/extensions/http/HTTPLocation.java?rev=1234376&r1=1234375&r2=1234376&view=diff
==============================================================================
--- webservices/woden/trunk/java/woden-api/src/main/java/org/apache/woden/wsdl20/extensions/http/HTTPLocation.java (original)
+++ webservices/woden/trunk/java/woden-api/src/main/java/org/apache/woden/wsdl20/extensions/http/HTTPLocation.java Sat Jan 21 17:41:28 2012
@@ -69,8 +69,8 @@ public class HTTPLocation {
     private String fOriginalLocation;
     boolean fValid = true;
     
-    private List fValidatedList = null; //used for validating the HTTP location string
-    private List fConsolidatedList = null; //used for substitution and formatting
+    private List<String> fValidatedList = null; //used for validating the HTTP location string
+    private List<String> fConsolidatedList = null; //used for substitution and formatting
     
     private static final String emptyString = "".intern();
     private static final String questionMark = "?".intern();
@@ -96,9 +96,9 @@ public class HTTPLocation {
             //TODO throw NPE with suitable error message
             fValid = false;
         } else if(location.equals(emptyString)) {
-            fValidatedList = new Vector();
+            fValidatedList = new Vector<String>();
             fValidatedList.add(emptyString);
-            fConsolidatedList = new Vector();
+            fConsolidatedList = new Vector<String>();
             fConsolidatedList.add(emptyString);
         } else {
             List tokenizedList = tokenizeLocation();
@@ -154,7 +154,7 @@ public class HTTPLocation {
         StringBuffer buffer = new StringBuffer();
         Object currToken;
         HTTPLocationTemplate template;
-        Iterator it = fConsolidatedList.iterator();
+        Iterator<String> it = fConsolidatedList.iterator();
         
         while(it.hasNext()) {
             currToken = it.next();
@@ -194,7 +194,7 @@ public class HTTPLocation {
         List templates = new Vector();
         
         if(fValid) {
-            Iterator it = fConsolidatedList.iterator();
+            Iterator<String> it = fConsolidatedList.iterator();
             while(it.hasNext()) {
                 Object next = it.next();
                 if(next instanceof HTTPLocationTemplate) {
@@ -221,7 +221,7 @@ public class HTTPLocation {
         List templates = new Vector();
         
         if(fValid) {
-            Iterator it = fConsolidatedList.iterator();
+            Iterator<String> it = fConsolidatedList.iterator();
             while(it.hasNext()) {
                 Object next = it.next();
                 if(next instanceof HTTPLocationTemplate) {
@@ -251,7 +251,7 @@ public class HTTPLocation {
         List templates = new Vector();
         
         if(fValid) {
-            Iterator it = fConsolidatedList.iterator();
+            Iterator<String> it = fConsolidatedList.iterator();
             while(it.hasNext()) {
                 Object next = it.next();
                 if(next instanceof HTTPLocationTemplate) {
@@ -280,7 +280,7 @@ public class HTTPLocation {
         List names = new Vector();
         
         if(fValid) {
-            Iterator it = fConsolidatedList.iterator();
+            Iterator<String> it = fConsolidatedList.iterator();
             while(it.hasNext()) {
                 Object next = it.next();
                 if(next instanceof HTTPLocationTemplate) {
@@ -308,7 +308,7 @@ public class HTTPLocation {
         List names = new Vector();
         
         if(fValid) {
-            Iterator it = fConsolidatedList.iterator();
+            Iterator<String> it = fConsolidatedList.iterator();
             while(it.hasNext()) {
                 Object next = it.next();
                 if(next instanceof HTTPLocationTemplate) {
@@ -338,7 +338,7 @@ public class HTTPLocation {
         List names = new Vector();
         
         if(fValid) {
-            Iterator it = fConsolidatedList.iterator();
+            Iterator<String> it = fConsolidatedList.iterator();
             while(it.hasNext()) {
                 Object next = it.next();
                 if(next instanceof HTTPLocationTemplate) {
@@ -688,7 +688,7 @@ public class HTTPLocation {
         StringBuffer buffer = new StringBuffer();
         Object currToken;
         List tokens = new Vector();
-        Iterator it = fValidatedList.iterator();
+        Iterator<String> it = fValidatedList.iterator();
         
         while(it.hasNext()) {
             currToken = it.next();

Modified: webservices/woden/trunk/java/woden-api/src/main/java/org/apache/woden/xpointer/ElementPointerPart.java
URL: http://svn.apache.org/viewvc/webservices/woden/trunk/java/woden-api/src/main/java/org/apache/woden/xpointer/ElementPointerPart.java?rev=1234376&r1=1234375&r2=1234376&view=diff
==============================================================================
--- webservices/woden/trunk/java/woden-api/src/main/java/org/apache/woden/xpointer/ElementPointerPart.java (original)
+++ webservices/woden/trunk/java/woden-api/src/main/java/org/apache/woden/xpointer/ElementPointerPart.java Sat Jan 21 17:41:28 2012
@@ -36,7 +36,7 @@ import java.lang.NumberFormatException;
  */
 public class ElementPointerPart implements PointerPart {
     private final NCName ncname;
-    private final List childSequence;
+    private final List<Integer> childSequence;
     
     /**
      * Constructs an ElementPointerPart with only an elementID NCName.
@@ -59,18 +59,13 @@ public class ElementPointerPart implemen
      * @throws NullPointerException if childSequence is null.
      * @throws IllegalArgumentException if childSequence is empty or contains elements other than Integers.
      */
-    public ElementPointerPart(List childSequence) {
+    public ElementPointerPart(List<Integer> childSequence) {
         if(childSequence == null) {
             throw new NullPointerException("The childSequence argument is null.");
         }
         if(childSequence.isEmpty()) {
             throw new IllegalArgumentException("The childSequence list is empty.");
-        }
-        for(Iterator it = childSequence.iterator(); it.hasNext();) {
-            if(!(it.next() instanceof Integer)){
-                throw new IllegalArgumentException("The childSequence list must only contain Integers.");
-            }
-        }
+        }       
         this.ncname = null;
         this.childSequence = childSequence;
     }
@@ -83,7 +78,7 @@ public class ElementPointerPart implemen
      * @throws NullPointerException if elementID or childSequence are null.
      * @throws IllegalArgumentException if childSequence is empty or contains elements other than Integers.
      */
-    public ElementPointerPart(NCName elementID, List childSequence) {
+    public ElementPointerPart(NCName elementID, List<Integer> childSequence) {
         if(elementID == null) {
             throw new NullPointerException("The elementID argument is null.");
         }
@@ -93,14 +88,11 @@ public class ElementPointerPart implemen
         if(childSequence.isEmpty()) {
             throw new IllegalArgumentException("The childSequence list is empty.");
         }
-        for(Iterator it = childSequence.iterator(); it.hasNext();) {
-            Object integer = it.next();
-            if(!(integer instanceof Integer)){
-                throw new IllegalArgumentException("the childSequence list must only contain Integers.");
-            } else if (((Integer)integer).intValue() == 0){
-                throw new IllegalArgumentException("the childSequence list must only contain Integers bigger than 0.");
-            }
+        if (childSequence.contains(0)) {
+            throw new IllegalArgumentException(
+                    "the childSequence list must only contain Integers bigger than 0.");
         }
+        
         this.ncname = elementID;
         this.childSequence = childSequence;
     }
@@ -169,7 +161,7 @@ public class ElementPointerPart implemen
      */
     private String serialiseChildSequence() {
         StringBuffer buffer = new StringBuffer();
-        for(Iterator it = childSequence.iterator(); it.hasNext();) {
+        for(Iterator<Integer> it = childSequence.iterator(); it.hasNext();) {
             Integer child = (Integer)it.next();
             buffer.append("/" + child.toString());
         }
@@ -184,7 +176,7 @@ public class ElementPointerPart implemen
      * @throws IllegalArgumentException if the schemeData has invalid scheme syntax.
      */
     public static ElementPointerPart parseFromString(final String schemeData) throws InvalidXPointerException {
-        List childSequence = null;
+        List<Integer> childSequence = null;
         NCName elementID = null;
         int startChar;
         int endChar;
@@ -214,7 +206,7 @@ public class ElementPointerPart implemen
         }
         
         //Find remaining child sequence.
-        childSequence = new ArrayList();
+        childSequence = new ArrayList<Integer>();
         
         endChar = schemeData.indexOf("/", startChar+1);
         // -1 Only single child sequence element. > 0 A childSequence.

Modified: webservices/woden/trunk/java/woden-api/src/main/java/org/apache/woden/xpointer/XPointer.java
URL: http://svn.apache.org/viewvc/webservices/woden/trunk/java/woden-api/src/main/java/org/apache/woden/xpointer/XPointer.java?rev=1234376&r1=1234375&r2=1234376&view=diff
==============================================================================
--- webservices/woden/trunk/java/woden-api/src/main/java/org/apache/woden/xpointer/XPointer.java (original)
+++ webservices/woden/trunk/java/woden-api/src/main/java/org/apache/woden/xpointer/XPointer.java Sat Jan 21 17:41:28 2012
@@ -36,10 +36,10 @@ import org.apache.woden.types.NCName;
  */
 public class XPointer {
     private static final String emptyString = "".intern();
-    private final Map prefixBindingContex;
-    private final Map namespaceBindingContex;
+    private final Map<NCName, String> prefixBindingContex;
+    private final Map<String, NCName>namespaceBindingContex;
     private NCName shorthandPointer;
-    private final List pointerParts;
+    private final List<PointerPart> pointerParts;
     
     private static final NCName emptyNCName = new NCName(emptyString);
     
@@ -52,12 +52,12 @@ public class XPointer {
      * 
      */
     public XPointer() {
-        pointerParts = new ArrayList();
+        pointerParts = new ArrayList<PointerPart>();
         shorthandPointer = emptyNCName;
         
         //Setup prefix/namespace binding context.
-        prefixBindingContex = new HashMap();
-        namespaceBindingContex = new HashMap();
+        prefixBindingContex = new HashMap<NCName, String>();
+        namespaceBindingContex = new HashMap<String, NCName>();
         addPrefixNamespaceBinding(new NCName("xml"), NS_URI_XML);
     }
     
@@ -184,7 +184,7 @@ public class XPointer {
      * @return A String of the namespace bound to this prefix or null if none exists.
      */
     public String getPrefixBinding(NCName prefix) {
-        return (String)prefixBindingContex.get(prefix);
+        return prefixBindingContex.get(prefix);
     }
     
     /**
@@ -195,7 +195,7 @@ public class XPointer {
      * @return A NCName of the prefix bound to this namespace or null if none exists.
      */
     public NCName getNamespaceBinding(String namespace) {
-        return (NCName)namespaceBindingContex.get(namespace);
+        return namespaceBindingContex.get(namespace);
     }
     
     /**
@@ -244,7 +244,7 @@ public class XPointer {
     public String toString() {
         if (shorthandPointer.equals(emptyNCName)) {
             StringBuffer buffer = new StringBuffer();
-            Iterator parts = pointerParts.iterator();
+            Iterator<PointerPart> parts = pointerParts.iterator();
             while (parts.hasNext()) {
                 buffer.append(parts.next());
             }

Modified: webservices/woden/trunk/java/woden-api/src/test/java/org/apache/woden/types/NCNameTest.java
URL: http://svn.apache.org/viewvc/webservices/woden/trunk/java/woden-api/src/test/java/org/apache/woden/types/NCNameTest.java?rev=1234376&r1=1234375&r2=1234376&view=diff
==============================================================================
--- webservices/woden/trunk/java/woden-api/src/test/java/org/apache/woden/types/NCNameTest.java (original)
+++ webservices/woden/trunk/java/woden-api/src/test/java/org/apache/woden/types/NCNameTest.java Sat Jan 21 17:41:28 2012
@@ -95,7 +95,7 @@ public class NCNameTest extends TestCase
         String keyStr = new String("bar");
         NCName nOrig = new NCName(keyStr);
         NCName n;
-        Map ncnameMap = new HashMap();
+        Map<String, NCName> ncnameMap = new HashMap<String, NCName>();
         ncnameMap.put(keyStr, nOrig);
         n = (NCName)ncnameMap.get(keyStr);
         assertNotNull("Couldn't find NCName in Map keyed off String key object used to put it there", n);
@@ -109,7 +109,7 @@ public class NCNameTest extends TestCase
         NCName keyNCName = new NCName("bar");
         String sOrig = keyNCName.toString();
         String s;
-        Map stringMap = new HashMap();
+        Map<NCName, String> stringMap = new HashMap<NCName, String>();
         stringMap.put(keyNCName, sOrig);
         s = (String)stringMap.get(keyNCName);
         assertNotNull("Couldn't find String in Map keyed off NCName key object used to put it there", s);