Refactoring code to use generics
This commit is contained in:
parent
ac3fed65ce
commit
abd3681044
15 changed files with 35 additions and 84 deletions
|
@ -31,15 +31,9 @@ import com.sun.syndication.feed.CopyFrom;
|
||||||
*/
|
*/
|
||||||
public class CustomTagsImpl implements CustomTags {
|
public class CustomTagsImpl implements CustomTags {
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
private List<CustomTag> values;
|
|
||||||
|
|
||||||
/** Creates a new instance of CustomTagsImpl */
|
private List<CustomTag> values;
|
||||||
public CustomTagsImpl() {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<CustomTag> getValues() {
|
public List<CustomTag> getValues() {
|
||||||
|
@ -66,7 +60,7 @@ public class CustomTagsImpl implements CustomTags {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Class getInterface() {
|
public Class<CustomTags> getInterface() {
|
||||||
return CustomTags.class;
|
return CustomTags.class;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -676,7 +676,7 @@ public class GoogleBaseImpl implements GoogleBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Class getInterface() {
|
public Class<GoogleBase> getInterface() {
|
||||||
return GoogleBase.class;
|
return GoogleBase.class;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -54,10 +54,8 @@ import com.sun.syndication.feed.impl.ToStringBean;
|
||||||
*/
|
*/
|
||||||
public class CreativeCommonsImpl implements CreativeCommons {
|
public class CreativeCommonsImpl implements CreativeCommons {
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
public static final String RDF_URI = "http://www.w3.org/1999/02/22-rdf-syntax-ns#";
|
public static final String RDF_URI = "http://www.w3.org/1999/02/22-rdf-syntax-ns#";
|
||||||
public static final String RSS2_URI = "http://backend.userland.com/creativeCommonsRssModule";
|
public static final String RSS2_URI = "http://backend.userland.com/creativeCommonsRssModule";
|
||||||
public static final String RSS1_URI = "http://web.resource.org/cc/";
|
public static final String RSS1_URI = "http://web.resource.org/cc/";
|
||||||
|
@ -90,7 +88,7 @@ public class CreativeCommonsImpl implements CreativeCommons {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Class getInterface() {
|
public Class<CreativeCommons> getInterface() {
|
||||||
return CreativeCommons.class;
|
return CreativeCommons.class;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -132,8 +130,8 @@ public class CreativeCommonsImpl implements CreativeCommons {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
|
|
||||||
final ToStringBean tsb = new ToStringBean(CreativeCommonsImpl.class, this);
|
final ToStringBean tsb = new ToStringBean(CreativeCommonsImpl.class, this);
|
||||||
return tsb.toString();
|
return tsb.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -65,7 +65,7 @@ public class ContentModuleImpl extends ModuleImpl implements ContentModule {
|
||||||
super(ContentModuleImpl.class, URI);
|
super(ContentModuleImpl.class, URI);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected ContentModuleImpl(final Class beanClass, final java.lang.String uri) {
|
protected ContentModuleImpl(final Class<ContentModuleImpl> beanClass, final java.lang.String uri) {
|
||||||
super(beanClass, uri);
|
super(beanClass, uri);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -89,7 +89,7 @@ public class ContentModuleImpl extends ModuleImpl implements ContentModule {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Class getInterface() {
|
public Class<ContentModule> getInterface() {
|
||||||
return ContentModule.class;
|
return ContentModule.class;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -78,7 +78,7 @@ public class FeedBurnerImpl implements FeedBurner {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Class getInterface() {
|
public Class<FeedBurner> getInterface() {
|
||||||
return FeedBurner.class;
|
return FeedBurner.class;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,8 @@
|
||||||
package org.rometools.feed.module.georss;
|
package org.rometools.feed.module.georss;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* GMLModuleImpl is the implementation of the {@link GeoRSSModule} Interface for the gml GeoRSS format.
|
* GMLModuleImpl is the implementation of the {@link GeoRSSModule} Interface for the gml GeoRSS
|
||||||
|
* format.
|
||||||
*
|
*
|
||||||
* @author Marc Wick
|
* @author Marc Wick
|
||||||
* @version $Id: GMLModuleImpl.java,v 1.1 2007/04/18 09:59:29 marcwick Exp $
|
* @version $Id: GMLModuleImpl.java,v 1.1 2007/04/18 09:59:29 marcwick Exp $
|
||||||
|
@ -25,21 +26,15 @@ package org.rometools.feed.module.georss;
|
||||||
*/
|
*/
|
||||||
public class GMLModuleImpl extends GeoRSSModule {
|
public class GMLModuleImpl extends GeoRSSModule {
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
public GMLModuleImpl() {
|
public GMLModuleImpl() {
|
||||||
super(GeoRSSModule.class, GeoRSSModule.GEORSS_GML_URI);
|
super(GeoRSSModule.class, GeoRSSModule.GEORSS_GML_URI);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
* @see com.sun.syndication.feed.CopyFrom#getInterface()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public Class getInterface() {
|
public Class<GeoRSSModule> getInterface() {
|
||||||
return GeoRSSModule.class;
|
return GeoRSSModule.class;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,9 +32,7 @@ import com.sun.syndication.feed.module.ModuleImpl;
|
||||||
* @version $Id: GeoRSSModule.java,v 1.8 2007/06/06 09:47:32 marcwick Exp $
|
* @version $Id: GeoRSSModule.java,v 1.8 2007/06/06 09:47:32 marcwick Exp $
|
||||||
*/
|
*/
|
||||||
public abstract class GeoRSSModule extends ModuleImpl implements Cloneable {
|
public abstract class GeoRSSModule extends ModuleImpl implements Cloneable {
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
protected AbstractGeometry geometry;
|
protected AbstractGeometry geometry;
|
||||||
|
@ -73,7 +71,7 @@ public abstract class GeoRSSModule extends ModuleImpl implements Cloneable {
|
||||||
*/
|
*/
|
||||||
public static final Namespace GML_NS = Namespace.getNamespace("gml", GeoRSSModule.GEORSS_GML_URI);
|
public static final Namespace GML_NS = Namespace.getNamespace("gml", GeoRSSModule.GEORSS_GML_URI);
|
||||||
|
|
||||||
protected GeoRSSModule(final Class beanClass, final java.lang.String uri) {
|
protected GeoRSSModule(final Class<? extends GeoRSSModule> beanClass, final java.lang.String uri) {
|
||||||
super(beanClass, uri);
|
super(beanClass, uri);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -146,4 +144,5 @@ public abstract class GeoRSSModule extends ModuleImpl implements Cloneable {
|
||||||
}
|
}
|
||||||
throw new CloneNotSupportedException();
|
throw new CloneNotSupportedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,28 +17,24 @@
|
||||||
package org.rometools.feed.module.georss;
|
package org.rometools.feed.module.georss;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* SimpleModuleImpl is the implementation of the {@link GeoRSSModule} Interface for the GeoRSS Simple format.
|
* SimpleModuleImpl is the implementation of the {@link GeoRSSModule} Interface for the GeoRSS
|
||||||
|
* Simple format.
|
||||||
*
|
*
|
||||||
* @author Marc Wick
|
* @author Marc Wick
|
||||||
* @version $Id: SimpleModuleImpl.java,v 1.4 2007/04/18 09:59:29 marcwick Exp $
|
* @version $Id: SimpleModuleImpl.java,v 1.4 2007/04/18 09:59:29 marcwick Exp $
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class SimpleModuleImpl extends GeoRSSModule {
|
public class SimpleModuleImpl extends GeoRSSModule {
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
public SimpleModuleImpl() {
|
public SimpleModuleImpl() {
|
||||||
super(GeoRSSModule.class, GeoRSSModule.GEORSS_GEORSS_URI);
|
super(GeoRSSModule.class, GeoRSSModule.GEORSS_GEORSS_URI);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
* @see com.sun.syndication.feed.CopyFrom#getInterface()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public Class getInterface() {
|
public Class<GeoRSSModule> getInterface() {
|
||||||
return GeoRSSModule.class;
|
return GeoRSSModule.class;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,8 @@
|
||||||
package org.rometools.feed.module.georss;
|
package org.rometools.feed.module.georss;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* W3CGeoModuleImpl is the implementation of the {@link GeoRSSModule} Interface for the W3C geo format.
|
* W3CGeoModuleImpl is the implementation of the {@link GeoRSSModule} Interface for the W3C geo
|
||||||
|
* format.
|
||||||
*
|
*
|
||||||
* @author Marc Wick
|
* @author Marc Wick
|
||||||
* @version $Id: W3CGeoModuleImpl.java,v 1.2 2007/04/18 09:59:29 marcwick Exp $
|
* @version $Id: W3CGeoModuleImpl.java,v 1.2 2007/04/18 09:59:29 marcwick Exp $
|
||||||
|
@ -25,21 +26,14 @@ package org.rometools.feed.module.georss;
|
||||||
*/
|
*/
|
||||||
public class W3CGeoModuleImpl extends GeoRSSModule {
|
public class W3CGeoModuleImpl extends GeoRSSModule {
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
public W3CGeoModuleImpl() {
|
public W3CGeoModuleImpl() {
|
||||||
super(GeoRSSModule.class, GeoRSSModule.GEORSS_W3CGEO_URI);
|
super(GeoRSSModule.class, GeoRSSModule.GEORSS_W3CGEO_URI);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
* @see com.sun.syndication.feed.CopyFrom#getInterface()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public Class getInterface() {
|
public Class<GeoRSSModule> getInterface() {
|
||||||
return GeoRSSModule.class;
|
return GeoRSSModule.class;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -40,8 +40,6 @@
|
||||||
*/
|
*/
|
||||||
package org.rometools.feed.module.itunes;
|
package org.rometools.feed.module.itunes;
|
||||||
|
|
||||||
import com.sun.syndication.feed.CopyFrom;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is an abstract object that implements the attributes common across Feeds or Items in an
|
* This is an abstract object that implements the attributes common across Feeds or Items in an
|
||||||
* iTunes compatible RSS feed.
|
* iTunes compatible RSS feed.
|
||||||
|
@ -80,21 +78,13 @@ public abstract class AbstractITunesObject implements ITunes, java.lang.Cloneabl
|
||||||
private String subtitle;
|
private String subtitle;
|
||||||
private String summary;
|
private String summary;
|
||||||
|
|
||||||
/**
|
|
||||||
* Defined by the ROME module API
|
|
||||||
*
|
|
||||||
* @param obj Object to copy from
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public abstract void copyFrom(CopyFrom obj);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Defined by the ROME API
|
* Defined by the ROME API
|
||||||
*
|
*
|
||||||
* @return Class of the Interface for this module.
|
* @return Class of the Interface for this module.
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Class getInterface() {
|
public Class<? extends AbstractITunesObject> getInterface() {
|
||||||
return getClass();
|
return getClass();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -53,12 +53,12 @@ public class MediaModuleImpl extends ModuleImpl implements MediaModule, Serializ
|
||||||
* @param clazz
|
* @param clazz
|
||||||
* @param uri
|
* @param uri
|
||||||
*/
|
*/
|
||||||
public MediaModuleImpl(final Class clazz, final String uri) {
|
public MediaModuleImpl(final Class<? extends MediaModule> clazz, final String uri) {
|
||||||
super(clazz, uri);
|
super(clazz, uri);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Class getInterface() {
|
public Class<MediaModule> getInterface() {
|
||||||
return MediaModule.class;
|
return MediaModule.class;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -147,7 +147,7 @@ public class PhotocastModuleImpl implements PhotocastModule {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Class getInterface() {
|
public Class<PhotocastModule> getInterface() {
|
||||||
return PhotocastModule.class;
|
return PhotocastModule.class;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -50,23 +50,13 @@ import com.sun.syndication.feed.impl.EqualsBean;
|
||||||
*/
|
*/
|
||||||
public class SlashImpl implements Slash {
|
public class SlashImpl implements Slash {
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
private String section;
|
private String section;
|
||||||
|
|
||||||
private String department;
|
private String department;
|
||||||
|
|
||||||
private Integer comments;
|
private Integer comments;
|
||||||
|
|
||||||
private Integer[] hitParade;
|
private Integer[] hitParade;
|
||||||
|
|
||||||
/** Creates a new instance of SlashImpl */
|
|
||||||
public SlashImpl() {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getSection() {
|
public String getSection() {
|
||||||
return section;
|
return section;
|
||||||
|
@ -142,7 +132,7 @@ public class SlashImpl implements Slash {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Class getInterface() {
|
public Class<Slash> getInterface() {
|
||||||
return Slash.class;
|
return Slash.class;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -151,4 +141,5 @@ public class SlashImpl implements Slash {
|
||||||
final EqualsBean eBean = new EqualsBean(this.getClass(), this);
|
final EqualsBean eBean = new EqualsBean(this.getClass(), this);
|
||||||
return eBean.beanEquals(obj);
|
return eBean.beanEquals(obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,13 +54,14 @@ public class SimpleListExtensionImpl extends ModuleImpl implements SimpleListExt
|
||||||
/**
|
/**
|
||||||
* Returns the interface the copyFrom works on.
|
* Returns the interface the copyFrom works on.
|
||||||
* <p>
|
* <p>
|
||||||
* This is useful when dealing with properties that may have multiple implementations. For example, Module.
|
* This is useful when dealing with properties that may have multiple implementations. For
|
||||||
|
* example, Module.
|
||||||
* <p>
|
* <p>
|
||||||
*
|
*
|
||||||
* @return the interface the copyFrom works on.
|
* @return the interface the copyFrom works on.
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Class getInterface() {
|
public Class<SimpleListExtension> getInterface() {
|
||||||
return SimpleListExtension.class;
|
return SimpleListExtension.class;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -100,8 +101,8 @@ public class SimpleListExtensionImpl extends ModuleImpl implements SimpleListExt
|
||||||
* <p>
|
* <p>
|
||||||
* Any existing properties in this bean are lost.
|
* Any existing properties in this bean are lost.
|
||||||
* <p>
|
* <p>
|
||||||
* This method is useful for moving from one implementation of a bean interface to another. For example from the default SyndFeed bean implementation to a
|
* This method is useful for moving from one implementation of a bean interface to another. For
|
||||||
* Hibernate ready implementation.
|
* example from the default SyndFeed bean implementation to a Hibernate ready implementation.
|
||||||
* <p>
|
* <p>
|
||||||
*
|
*
|
||||||
* @param obj the instance to copy properties from.
|
* @param obj the instance to copy properties from.
|
||||||
|
|
|
@ -104,13 +104,6 @@ public class GoogleBaseGeneratorTest extends AbstractTestCase {
|
||||||
product.setCondition("New");
|
product.setCondition("New");
|
||||||
product.setDeliveryNotes("Insight");
|
product.setDeliveryNotes("Insight");
|
||||||
|
|
||||||
// FIXME
|
|
||||||
final List modules = new ArrayList();
|
|
||||||
modules.add(vehicle);
|
|
||||||
modules.add(product);
|
|
||||||
|
|
||||||
entry.setModules(modules);
|
|
||||||
|
|
||||||
entries.add(entry);
|
entries.add(entry);
|
||||||
|
|
||||||
feed.setEntries(entries);
|
feed.setEntries(entries);
|
||||||
|
|
Loading…
Reference in a new issue