scala-news-reader

rss/atom news reader in scala

git clone https://9o.is/git/scala-news-reader.git

GDataModuleGenerator.java

(1492B)


      1 package com.joereader.lib.rss.gdata.io;
      2 
      3 import java.util.Collections;
      4 import java.util.HashSet;
      5 import java.util.Set;
      6 
      7 import com.joereader.lib.rss.gdata.GDataModule;
      8 import org.jdom.Element;
      9 import org.jdom.Namespace;
     10 
     11 import com.sun.syndication.feed.module.Module;
     12 import com.sun.syndication.io.ModuleGenerator;
     13 
     14 
     15 /**
     16  * @author Lukasz Radziwonowicz
     17  *
     18  */
     19 public class GDataModuleGenerator implements ModuleGenerator {
     20 
     21     // boilerplate code
     22     private static final Namespace NAMESPACE = Namespace.getNamespace("gd", GDataModule.URI);
     23     private static final Set<Namespace> NAMESPACES;
     24     static {
     25         Set<Namespace> namespaces = new HashSet<Namespace>();
     26         namespaces.add(NAMESPACE);
     27         NAMESPACES = Collections.unmodifiableSet(namespaces);
     28     }
     29 
     30     /*
     31     * (non-Javadoc)
     32     *
     33     * @see com.sun.syndication.io.ModuleGenerator#getNamespaceUri()
     34     */
     35     @Override
     36     public String getNamespaceUri() {
     37         return GDataModule.URI;
     38     }
     39 
     40     /*
     41     * (non-Javadoc)
     42     *
     43     * @see com.sun.syndication.io.ModuleGenerator#getNamespaces()
     44     */
     45     @Override
     46     public Set<Namespace> getNamespaces() {
     47         return NAMESPACES;
     48     }
     49 
     50     public GDataModuleGenerator() {
     51     }
     52 
     53     public void generate(Module module, Element element) {
     54 // MyModule myModule = (MyModule) module;
     55 // if (myModule.getTag() != null) {
     56 // Element myElement = new Element("tag", NAMESPACE);
     57 // myElement.setText(myModule.getTag());
     58 // element.addContent(myElement);
     59 // }
     60     }
     61 
     62 }