Removed type parameter from CopyFrom interface

This commit is contained in:
Patrick Gotthard 2014-04-13 19:31:05 +02:00
parent 1f2001abc5
commit d4b34a05cd
19 changed files with 40 additions and 40 deletions

View file

@ -20,7 +20,7 @@ package com.sun.syndication.feed;
/** /**
* @author Alejandro Abdelnur * @author Alejandro Abdelnur
*/ */
public interface CopyFrom<T> { public interface CopyFrom {
/** /**
* Returns the interface the copyFrom works on. * Returns the interface the copyFrom works on.
@ -31,7 +31,7 @@ public interface CopyFrom<T> {
* *
* @return the interface the copyFrom works on. * @return the interface the copyFrom works on.
*/ */
public Class<? extends CopyFrom<T>> getInterface(); public Class<? extends CopyFrom> getInterface();
/** /**
* Copies all the properties of the given bean into this one. * Copies all the properties of the given bean into this one.
@ -45,6 +45,6 @@ public interface CopyFrom<T> {
* @param obj the instance to copy properties from. * @param obj the instance to copy properties from.
* *
*/ */
public void copyFrom(CopyFrom<? extends T> obj); public void copyFrom(CopyFrom obj);
} }

View file

@ -46,9 +46,9 @@ public class CopyFromHelper {
private static final Set<Class<?>> BASIC_TYPES = new HashSet<Class<?>>(); private static final Set<Class<?>> BASIC_TYPES = new HashSet<Class<?>>();
private static final Object[] NO_PARAMS = new Object[0]; private static final Object[] NO_PARAMS = new Object[0];
private final Class<? extends CopyFrom<?>> beanInterfaceClass; private final Class<? extends CopyFrom> beanInterfaceClass;
private final Map<String, Class<?>> baseInterfaceMap; // ENTRIES(propertyName,interface.class) private final Map<String, Class<?>> baseInterfaceMap; // ENTRIES(propertyName,interface.class)
private final Map<Class<? extends CopyFrom<?>>, Class<?>> baseImplMap; // ENTRIES(interface.class,implementation.class) private final Map<Class<? extends CopyFrom>, Class<?>> baseImplMap; // ENTRIES(interface.class,implementation.class)
static { static {
BASIC_TYPES.add(Boolean.class); BASIC_TYPES.add(Boolean.class);
@ -63,8 +63,8 @@ public class CopyFromHelper {
BASIC_TYPES.add(Date.class); BASIC_TYPES.add(Date.class);
} }
public CopyFromHelper(final Class<? extends CopyFrom<?>> beanInterfaceClass, final Map<String, Class<?>> basePropInterfaceMap, public CopyFromHelper(final Class<? extends CopyFrom> beanInterfaceClass, final Map<String, Class<?>> basePropInterfaceMap,
final Map<Class<? extends CopyFrom<?>>, Class<?>> basePropClassImplMap) { final Map<Class<? extends CopyFrom>, Class<?>> basePropClassImplMap) {
this.beanInterfaceClass = beanInterfaceClass; this.beanInterfaceClass = beanInterfaceClass;
baseInterfaceMap = basePropInterfaceMap; baseInterfaceMap = basePropInterfaceMap;
baseImplMap = basePropClassImplMap; baseImplMap = basePropClassImplMap;
@ -104,11 +104,11 @@ public class CopyFromHelper {
} }
private CopyFrom<?> createInstance(final Class<? extends CopyFrom<?>> interfaceClass) throws Exception { private CopyFrom createInstance(final Class<? extends CopyFrom> interfaceClass) throws Exception {
if (baseImplMap.get(interfaceClass) == null) { if (baseImplMap.get(interfaceClass) == null) {
return null; return null;
} else { } else {
return (CopyFrom<?>) baseImplMap.get(interfaceClass).newInstance(); return (CopyFrom) baseImplMap.get(interfaceClass).newInstance();
} }
} }
@ -128,11 +128,11 @@ public class CopyFromHelper {
value = (T) ((Date) value).clone(); value = (T) ((Date) value).clone();
} }
} else { // it goes CopyFrom } else { // it goes CopyFrom
if (value instanceof CopyFrom<?>) { if (value instanceof CopyFrom) {
final CopyFrom<T> source = (CopyFrom<T>) value; final CopyFrom source = (CopyFrom) value;
CopyFrom<T> target = (CopyFrom<T>) createInstance(source.getInterface()); CopyFrom target = (CopyFrom) createInstance(source.getInterface());
if (target == null) { if (target == null) {
target = (CopyFrom<T>) value.getClass().newInstance(); target = (CopyFrom) value.getClass().newInstance();
} }
target.copyFrom(source); target.copyFrom(source);
value = (T) target; value = (T) target;

View file

@ -1031,7 +1031,7 @@ public class DCModuleImpl extends ModuleImpl implements DCModule {
} }
@Override @Override
public final void copyFrom(final CopyFrom<? extends Module> obj) { public final void copyFrom(final CopyFrom obj) {
COPY_FROM_HELPER.copy(this, obj); COPY_FROM_HELPER.copy(this, obj);
} }
@ -1055,7 +1055,7 @@ public class DCModuleImpl extends ModuleImpl implements DCModule {
basePropInterfaceMap.put("coverages", String.class); basePropInterfaceMap.put("coverages", String.class);
basePropInterfaceMap.put("rightsList", String.class); basePropInterfaceMap.put("rightsList", String.class);
final Map<Class<? extends CopyFrom<?>>, Class<?>> basePropClassImplMap = new HashMap<Class<? extends CopyFrom<?>>, Class<?>>(); final Map<Class<? extends CopyFrom>, Class<?>> basePropClassImplMap = new HashMap<Class<? extends CopyFrom>, Class<?>>();
basePropClassImplMap.put(DCSubject.class, DCSubjectImpl.class); basePropClassImplMap.put(DCSubject.class, DCSubjectImpl.class);
COPY_FROM_HELPER = new CopyFromHelper(DCModule.class, basePropInterfaceMap, basePropClassImplMap); COPY_FROM_HELPER = new CopyFromHelper(DCModule.class, basePropInterfaceMap, basePropClassImplMap);

View file

@ -26,7 +26,7 @@ import com.sun.syndication.feed.CopyFrom;
* @author Alejandro Abdelnur * @author Alejandro Abdelnur
* *
*/ */
public interface DCSubject extends Cloneable, CopyFrom<DCSubject> { public interface DCSubject extends Cloneable, CopyFrom {
/** /**
* Returns the DublinCore subject taxonomy URI. * Returns the DublinCore subject taxonomy URI.
* <p> * <p>

View file

@ -158,7 +158,7 @@ public class DCSubjectImpl implements Cloneable, Serializable, DCSubject {
} }
@Override @Override
public void copyFrom(final CopyFrom<? extends DCSubject> obj) { public void copyFrom(final CopyFrom obj) {
COPY_FROM_HELPER.copy(this, obj); COPY_FROM_HELPER.copy(this, obj);
} }
@ -169,7 +169,7 @@ public class DCSubjectImpl implements Cloneable, Serializable, DCSubject {
basePropInterfaceMap.put("taxonomyUri", String.class); basePropInterfaceMap.put("taxonomyUri", String.class);
basePropInterfaceMap.put("value", String.class); basePropInterfaceMap.put("value", String.class);
final Map<Class<? extends CopyFrom<?>>, Class<?>> basePropClassImplMap = Collections.<Class<? extends CopyFrom<?>>, Class<?>> emptyMap(); final Map<Class<? extends CopyFrom>, Class<?>> basePropClassImplMap = Collections.<Class<? extends CopyFrom>, Class<?>> emptyMap();
COPY_FROM_HELPER = new CopyFromHelper(DCSubject.class, basePropInterfaceMap, basePropClassImplMap); COPY_FROM_HELPER = new CopyFromHelper(DCSubject.class, basePropInterfaceMap, basePropClassImplMap);
} }

View file

@ -28,7 +28,7 @@ import com.sun.syndication.feed.CopyFrom;
* @author Alejandro Abdelnur * @author Alejandro Abdelnur
* *
*/ */
public interface Module extends Cloneable, CopyFrom<Module>, Serializable { public interface Module extends Cloneable, CopyFrom, Serializable {
/** /**
* Returns the URI of the module. * Returns the URI of the module.

View file

@ -140,7 +140,7 @@ public class SyModuleImpl extends ModuleImpl implements SyModule {
} }
@Override @Override
public void copyFrom(final CopyFrom<? extends Module> obj) { public void copyFrom(final CopyFrom obj) {
COPY_FROM_HELPER.copy(this, obj); COPY_FROM_HELPER.copy(this, obj);
} }
@ -152,7 +152,7 @@ public class SyModuleImpl extends ModuleImpl implements SyModule {
basePropInterfaceMap.put("updateFrequency", Integer.TYPE); basePropInterfaceMap.put("updateFrequency", Integer.TYPE);
basePropInterfaceMap.put("updateBase", Date.class); basePropInterfaceMap.put("updateBase", Date.class);
final Map<Class<? extends CopyFrom<?>>, Class<?>> basePropClassImplMap = Collections.<Class<? extends CopyFrom<?>>, Class<?>> emptyMap(); final Map<Class<? extends CopyFrom>, Class<?>> basePropClassImplMap = Collections.<Class<? extends CopyFrom>, Class<?>> emptyMap();
COPY_FROM_HELPER = new CopyFromHelper(SyModule.class, basePropInterfaceMap, basePropClassImplMap); COPY_FROM_HELPER = new CopyFromHelper(SyModule.class, basePropInterfaceMap, basePropClassImplMap);
} }

View file

@ -26,7 +26,7 @@ import com.sun.syndication.feed.CopyFrom;
* @author Alejandro Abdelnur * @author Alejandro Abdelnur
* *
*/ */
public interface SyndCategory extends Cloneable, CopyFrom<SyndCategory> { public interface SyndCategory extends Cloneable, CopyFrom {
/** /**
* Returns the category name. * Returns the category name.
* <p> * <p>

View file

@ -180,12 +180,12 @@ public class SyndCategoryImpl implements Serializable, SyndCategory {
} }
@Override @Override
public Class<? extends CopyFrom<SyndCategory>> getInterface() { public Class<? extends CopyFrom> getInterface() {
return SyndCategory.class; return SyndCategory.class;
} }
@Override @Override
public void copyFrom(final CopyFrom<? extends SyndCategory> obj) { public void copyFrom(final CopyFrom obj) {
COPY_FROM_HELPER.copy(this, obj); COPY_FROM_HELPER.copy(this, obj);
} }
@ -195,7 +195,7 @@ public class SyndCategoryImpl implements Serializable, SyndCategory {
final Map<String, Class<?>> basePropInterfaceMap = new HashMap<String, Class<?>>(); final Map<String, Class<?>> basePropInterfaceMap = new HashMap<String, Class<?>>();
basePropInterfaceMap.put("name", String.class); basePropInterfaceMap.put("name", String.class);
basePropInterfaceMap.put("taxonomyUri", String.class); basePropInterfaceMap.put("taxonomyUri", String.class);
final Map<Class<? extends CopyFrom<?>>, Class<?>> basePropClassImplMap = Collections.emptyMap(); final Map<Class<? extends CopyFrom>, Class<?>> basePropClassImplMap = Collections.emptyMap();
COPY_FROM_HELPER = new CopyFromHelper(SyndCategory.class, basePropInterfaceMap, basePropClassImplMap); COPY_FROM_HELPER = new CopyFromHelper(SyndCategory.class, basePropInterfaceMap, basePropClassImplMap);
} }

View file

@ -25,7 +25,7 @@ import com.sun.syndication.feed.CopyFrom;
* @author Alejandro Abdelnur * @author Alejandro Abdelnur
* *
*/ */
public interface SyndContent extends Cloneable, CopyFrom<SyndContent> { public interface SyndContent extends Cloneable, CopyFrom {
/** /**
* Returns the content type. * Returns the content type.
* <p> * <p>

View file

@ -181,7 +181,7 @@ public class SyndContentImpl implements Serializable, SyndContent {
} }
@Override @Override
public void copyFrom(final CopyFrom<? extends SyndContent> obj) { public void copyFrom(final CopyFrom obj) {
COPY_FROM_HELPER.copy(this, obj); COPY_FROM_HELPER.copy(this, obj);
} }
@ -192,7 +192,7 @@ public class SyndContentImpl implements Serializable, SyndContent {
basePropInterfaceMap.put("type", String.class); basePropInterfaceMap.put("type", String.class);
basePropInterfaceMap.put("value", String.class); basePropInterfaceMap.put("value", String.class);
final Map<Class<? extends CopyFrom<?>>, Class<?>> basePropClassImplMap = Collections.<Class<? extends CopyFrom<?>>, Class<?>> emptyMap(); final Map<Class<? extends CopyFrom>, Class<?>> basePropClassImplMap = Collections.<Class<? extends CopyFrom>, Class<?>> emptyMap();
COPY_FROM_HELPER = new CopyFromHelper(SyndContent.class, basePropInterfaceMap, basePropClassImplMap); COPY_FROM_HELPER = new CopyFromHelper(SyndContent.class, basePropInterfaceMap, basePropClassImplMap);
} }

View file

@ -5,7 +5,7 @@ import com.sun.syndication.feed.CopyFrom;
/** /**
* @author Alejandro Abdelnur * @author Alejandro Abdelnur
*/ */
public interface SyndEnclosure extends Cloneable, CopyFrom<SyndEnclosure> { public interface SyndEnclosure extends Cloneable, CopyFrom {
/** /**
* Returns the enclosure URL. * Returns the enclosure URL.
* <p> * <p>

View file

@ -153,7 +153,7 @@ public class SyndEnclosureImpl implements Serializable, SyndEnclosure {
} }
@Override @Override
public void copyFrom(final CopyFrom<? extends SyndEnclosure> obj) { public void copyFrom(final CopyFrom obj) {
COPY_FROM_HELPER.copy(this, obj); COPY_FROM_HELPER.copy(this, obj);
} }
@ -165,7 +165,7 @@ public class SyndEnclosureImpl implements Serializable, SyndEnclosure {
basePropInterfaceMap.put("type", String.class); basePropInterfaceMap.put("type", String.class);
basePropInterfaceMap.put("length", Long.TYPE); basePropInterfaceMap.put("length", Long.TYPE);
final Map<Class<? extends CopyFrom<?>>, Class<?>> basePropClassImplMap = Collections.<Class<? extends CopyFrom<?>>, Class<?>> emptyMap(); final Map<Class<? extends CopyFrom>, Class<?>> basePropClassImplMap = Collections.<Class<? extends CopyFrom>, Class<?>> emptyMap();
COPY_FROM_HELPER = new CopyFromHelper(SyndEnclosure.class, basePropInterfaceMap, basePropClassImplMap); COPY_FROM_HELPER = new CopyFromHelper(SyndEnclosure.class, basePropInterfaceMap, basePropClassImplMap);
} }

View file

@ -32,7 +32,7 @@ import com.sun.syndication.feed.module.Module;
* @author Alejandro Abdelnur * @author Alejandro Abdelnur
* *
*/ */
public interface SyndEntry extends Cloneable, CopyFrom<SyndEntry>, Extendable { public interface SyndEntry extends Cloneable, CopyFrom, Extendable {
/** /**
* Returns the entry URI. * Returns the entry URI.

View file

@ -483,7 +483,7 @@ public class SyndEntryImpl implements Serializable, SyndEntry {
} }
@Override @Override
public void copyFrom(final CopyFrom<? extends SyndEntry> obj) { public void copyFrom(final CopyFrom obj) {
COPY_FROM_HELPER.copy(this, obj); COPY_FROM_HELPER.copy(this, obj);
} }
@ -501,7 +501,7 @@ public class SyndEntryImpl implements Serializable, SyndEntry {
basePropInterfaceMap.put("modules", Module.class); basePropInterfaceMap.put("modules", Module.class);
basePropInterfaceMap.put("categories", SyndCategory.class); basePropInterfaceMap.put("categories", SyndCategory.class);
final Map<Class<? extends CopyFrom<?>>, Class<?>> basePropClassImplMap = new HashMap<Class<? extends CopyFrom<?>>, Class<?>>(); final Map<Class<? extends CopyFrom>, Class<?>> basePropClassImplMap = new HashMap<Class<? extends CopyFrom>, Class<?>>();
basePropClassImplMap.put(SyndContent.class, SyndContentImpl.class); basePropClassImplMap.put(SyndContent.class, SyndContentImpl.class);
basePropClassImplMap.put(SyndEnclosure.class, SyndEnclosureImpl.class); basePropClassImplMap.put(SyndEnclosure.class, SyndEnclosureImpl.class);
basePropClassImplMap.put(SyndCategory.class, SyndCategoryImpl.class); basePropClassImplMap.put(SyndCategory.class, SyndCategoryImpl.class);

View file

@ -35,7 +35,7 @@ import com.sun.syndication.feed.module.Module;
* @author Alejandro Abdelnur * @author Alejandro Abdelnur
* *
*/ */
public interface SyndFeed extends Cloneable, CopyFrom<SyndFeed>, Extendable { public interface SyndFeed extends Cloneable, CopyFrom, Extendable {
/** /**
* Returns the real feed types the SyndFeedImpl supports when converting from and to. * Returns the real feed types the SyndFeedImpl supports when converting from and to.

View file

@ -762,7 +762,7 @@ public class SyndFeedImpl implements Serializable, SyndFeed {
} }
@Override @Override
public void copyFrom(final CopyFrom<? extends SyndFeed> obj) { public void copyFrom(final CopyFrom obj) {
COPY_FROM_HELPER.copy(this, obj); COPY_FROM_HELPER.copy(this, obj);
} }
@ -783,7 +783,7 @@ public class SyndFeedImpl implements Serializable, SyndFeed {
basePropInterfaceMap.put("modules", Module.class); basePropInterfaceMap.put("modules", Module.class);
basePropInterfaceMap.put("categories", SyndCategory.class); basePropInterfaceMap.put("categories", SyndCategory.class);
final Map<Class<? extends CopyFrom<?>>, Class<?>> basePropClassImplMap = new HashMap<Class<? extends CopyFrom<?>>, Class<?>>(); final Map<Class<? extends CopyFrom>, Class<?>> basePropClassImplMap = new HashMap<Class<? extends CopyFrom>, Class<?>>();
basePropClassImplMap.put(SyndEntry.class, SyndEntryImpl.class); basePropClassImplMap.put(SyndEntry.class, SyndEntryImpl.class);
basePropClassImplMap.put(SyndImage.class, SyndImageImpl.class); basePropClassImplMap.put(SyndImage.class, SyndImageImpl.class);
basePropClassImplMap.put(SyndCategory.class, SyndCategoryImpl.class); basePropClassImplMap.put(SyndCategory.class, SyndCategoryImpl.class);

View file

@ -26,7 +26,7 @@ import com.sun.syndication.feed.CopyFrom;
* @author Alejandro Abdelnur * @author Alejandro Abdelnur
* *
*/ */
public interface SyndImage extends Cloneable, CopyFrom<SyndImage> { public interface SyndImage extends Cloneable, CopyFrom {
/** /**
* Returns the image title. * Returns the image title.
* <p> * <p>

View file

@ -204,7 +204,7 @@ public class SyndImageImpl implements Serializable, SyndImage {
} }
@Override @Override
public void copyFrom(final CopyFrom<? extends SyndImage> syndImage) { public void copyFrom(final CopyFrom syndImage) {
COPY_FROM_HELPER.copy(this, syndImage); COPY_FROM_HELPER.copy(this, syndImage);
} }
@ -217,7 +217,7 @@ public class SyndImageImpl implements Serializable, SyndImage {
basePropInterfaceMap.put("link", String.class); basePropInterfaceMap.put("link", String.class);
basePropInterfaceMap.put("description", String.class); basePropInterfaceMap.put("description", String.class);
final Map<Class<? extends CopyFrom<?>>, Class<?>> basePropClassImplMap = Collections.<Class<? extends CopyFrom<?>>, Class<?>> emptyMap(); final Map<Class<? extends CopyFrom>, Class<?>> basePropClassImplMap = Collections.<Class<? extends CopyFrom>, Class<?>> emptyMap();
COPY_FROM_HELPER = new CopyFromHelper(SyndImage.class, basePropInterfaceMap, basePropClassImplMap); COPY_FROM_HELPER = new CopyFromHelper(SyndImage.class, basePropInterfaceMap, basePropClassImplMap);
} }