abdera-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmsn...@apache.org
Subject svn commit: r555832 - /incubator/abdera/java/trunk/examples/src/main/java/org/apache/abdera/examples/extension/FooExtensionFactory.java
Date Fri, 13 Jul 2007 01:20:59 GMT
Author: jmsnell
Date: Thu Jul 12 18:20:58 2007
New Revision: 555832

URL: http://svn.apache.org/viewvc?view=rev&rev=555832
Log:
Use the new AbstractExtensionFactory utility to simplify the various ExtensionFactory instances
we ship.. missed one

Modified:
    incubator/abdera/java/trunk/examples/src/main/java/org/apache/abdera/examples/extension/FooExtensionFactory.java

Modified: incubator/abdera/java/trunk/examples/src/main/java/org/apache/abdera/examples/extension/FooExtensionFactory.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/examples/src/main/java/org/apache/abdera/examples/extension/FooExtensionFactory.java?view=diff&rev=555832&r1=555831&r2=555832
==============================================================================
--- incubator/abdera/java/trunk/examples/src/main/java/org/apache/abdera/examples/extension/FooExtensionFactory.java
(original)
+++ incubator/abdera/java/trunk/examples/src/main/java/org/apache/abdera/examples/extension/FooExtensionFactory.java
Thu Jul 12 18:20:58 2007
@@ -17,39 +17,21 @@
 */
 package org.apache.abdera.examples.extension;
 
-import java.util.List;
-
 import javax.xml.namespace.QName;
 
-import org.apache.abdera.factory.ExtensionFactory;
-import org.apache.abdera.model.Base;
-import org.apache.abdera.model.Element;
+import org.apache.abdera.util.AbstractExtensionFactory;
 
 public class FooExtensionFactory 
-  implements ExtensionFactory {
-
+  extends AbstractExtensionFactory {
+  
   public static final String NS = "tag:example.org,2006:foo";
   public static final QName FOO = new QName(NS, "foo", "f");
   public static final QName BAR = new QName(NS, "bar", "f");
   
-  @SuppressWarnings("unchecked")
-  public <T extends Element> T getElementWrapper(Element internal) {
-    QName qname = internal.getQName();
-    if (FOO.equals(qname)) return (T)new Foo(internal);
-    else if (BAR.equals(qname)) return (T)new Bar(internal);
-    else return (T)internal;
+  public FooExtensionFactory() {
+    super(NS);
+    addImpl(FOO,Foo.class);
+    addImpl(BAR,Bar.class);
   }
-
-  public List<String> getNamespaces() {
-    return java.util.Arrays.asList(new String[] {NS});
-  }
-
-  public boolean handlesNamespace(String namespace) {
-    return NS.equals(namespace);
-  }
-
-  public <T extends Base> String getMimeType(T base) {
-    return null;
-  }
-
+  
 }



Mime
View raw message