abdera-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmsn...@apache.org
Subject svn commit: r420727 - /incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/opensearch/OpenSearchExtensionFactory.java
Date Tue, 11 Jul 2006 05:04:51 GMT
Author: jmsnell
Date: Mon Jul 10 22:04:50 2006
New Revision: 420727

URL: http://svn.apache.org/viewvc?rev=420727&view=rev
Log:
Slightly cleaner implementation

Modified:
    incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/opensearch/OpenSearchExtensionFactory.java

Modified: incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/opensearch/OpenSearchExtensionFactory.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/opensearch/OpenSearchExtensionFactory.java?rev=420727&r1=420726&r2=420727&view=diff
==============================================================================
--- incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/opensearch/OpenSearchExtensionFactory.java
(original)
+++ incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/opensearch/OpenSearchExtensionFactory.java
Mon Jul 10 22:04:50 2006
@@ -48,18 +48,7 @@
                                                    Base base,
                                                    Factory factory)
   {
-    if (OpenSearchConstants.TOTAL_RESULTS.equals(qname)) {
-      return (T) new FOMTotalResults(qname, (OMContainer) base, (OMFactory) factory);
-    }
-    else if (OpenSearchConstants.ITEMS_PER_PAGE.equals(qname)) {
-      return (T) new FOMItemsPerPage(qname, (OMContainer) base, (OMFactory) factory);
-    }
-    else if (OpenSearchConstants.START_INDEX.equals(qname)) {
-      return (T) new FOMStartIndex(qname, (OMContainer) base, (OMFactory) factory);
-    }
-    else {
-      return null;
-    }
+    return newExtensionElement(qname, base, factory, null);
   }
 
   @SuppressWarnings("unchecked")
@@ -68,17 +57,23 @@
                                                    Factory factory,
                                                    OMXMLParserWrapper parserWrapper)
   {
+    OMContainer cbase = (OMContainer) base;
+    OMFactory cfactory = (OMFactory) factory;
     if (OpenSearchConstants.TOTAL_RESULTS.equals(qname)) {
-      return (T) new FOMTotalResults(qname, (OMContainer) base, (OMFactory) factory, parserWrapper);
+      return (parserWrapper != null) ? 
+        (T) new FOMTotalResults(qname, cbase, cfactory, parserWrapper) :
+        (T) new FOMTotalResults(qname, cbase, cfactory);
     }
     else if (OpenSearchConstants.ITEMS_PER_PAGE.equals(qname)) {
-      return (T) new FOMItemsPerPage(qname, (OMContainer) base, (OMFactory) factory, parserWrapper);
+      return (parserWrapper != null) ?
+        (T) new FOMItemsPerPage(qname, cbase, cfactory, parserWrapper) :
+        (T) new FOMItemsPerPage(qname, cbase, cfactory);
     }
     else if (OpenSearchConstants.START_INDEX.equals(qname)) {
-      return (T) new FOMStartIndex(qname, (OMContainer) base, (OMFactory) factory, parserWrapper);
-    }
-    else {
-      return null;
+      return (parserWrapper != null) ?
+        (T) new FOMStartIndex(qname, cbase, cfactory, parserWrapper) :
+        (T) new FOMStartIndex(qname, cbase, cfactory);
     }
+    return null;
   }
 }



Mime
View raw message